1#!/bin/sh
2#
3#       Installation of the include files in the OS/400 library.
4#
5
6SCRIPTDIR=`dirname "${0}"`
7. "${SCRIPTDIR}/initscript.sh"
8cd "${TOPDIR}/include"
9
10
11#	Produce the curlbuild.h include file if not yet in distribution (CVS).
12
13if action_needed curl/curlbuild.h
14then	if action_needed curl/curlbuild.h curl/curlbuild.h.dist
15	then	cp -p curl/curlbuild.h.dist curl/curlbuild.h
16	fi
17fi
18
19
20#       Create the OS/400 source program file for the include files.
21
22SRCPF="${LIBIFSNAME}/H.FILE"
23
24if action_needed "${SRCPF}"
25then    CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
26        CMD="${CMD} CCSID(${TGTCCSID}) TEXT('curl: Header files')"
27        system "${CMD}"
28fi
29
30
31#       Enumeration values are used as va_arg tagfields, so they MUST be
32#               integers.
33
34copy_hfile()
35
36{
37	destfile="${1}"
38	srcfile="${2}"
39	shift
40	shift
41        sed -e '1i\
42#pragma enum(int)\
43' "${@}" -e '$a\
44#pragma enum(pop)\
45' < "${srcfile}" > "${destfile}"
46}
47
48#       Copy the header files.
49
50for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h
51do      DEST="${SRCPF}/`db2_name \"${HFILE}\"`.MBR"
52        if action_needed "${DEST}" "${HFILE}"
53        then    copy_hfile "${DEST}" "${HFILE}"
54        fi
55done
56
57
58#       Copy the ILE/RPG include file, setting-up version number.
59
60        versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR"
61
62
63#	Duplicate file H as CURL to support more include path forms.
64
65if action_needed "${LIBIFSNAME}/CURL.FILE"
66then	:
67else	system "DLTF FILE(${TARGETLIB}/CURL)"
68fi
69
70CMD="CRTDUPOBJ OBJ(H) FROMLIB(${TARGETLIB}) OBJTYPE(*FILE) TOLIB(*FROMLIB)"
71CMD="${CMD} NEWOBJ(CURL) DATA(*YES)"
72system "${CMD}"
73