Imported libcurl source code.
This commit is contained in:
@@ -0,0 +1,257 @@
|
||||
$Id: README.OS400,v 1.10 2008-10-17 13:17:41 patrickm Exp $
|
||||
|
||||
Implementation notes:
|
||||
|
||||
This is a true OS/400 implementation, not a PASE implementation (for PASE,
|
||||
use AIX implementation).
|
||||
|
||||
The biggest problem with OS/400 is EBCDIC. Libcurl implements an internal
|
||||
conversion mechanism, but it has been designed for computers that have a
|
||||
single native character set. OS/400 default native character set varies
|
||||
depending on the country for which it has been localized. And more, a job
|
||||
may dynamically alter its "native" character set.
|
||||
Several characters that do not have fixed code in EBCDIC variants are
|
||||
used in libcurl strings. As a consequence, using the existing conversion
|
||||
mechanism would have lead in a localized binary library - not portable across
|
||||
countries.
|
||||
For this reason, and because libcurl was originally designed for ASCII based
|
||||
operating systems, the current OS/400 implementation uses ASCII as internal
|
||||
character set. This has been accomplished using the QADRT library and
|
||||
include files, a C and system procedures ASCII wrapper library. See IBM QADRT
|
||||
description for more information.
|
||||
This then results in libcurl being an ASCII library: any function string
|
||||
argument is taken/returned in ASCII and a C/C++ calling program built around
|
||||
QADRT may use libcurl functions as on any other platform.
|
||||
QADRT does not define ASCII wrappers for all C/system procedures: the
|
||||
OS/400 configuration header file and an additional module (os400sys.c) define
|
||||
some more of them, that are used by libcurl and that QADRT left out.
|
||||
To support all the different variants of EBCDIC, non-standard wrapper
|
||||
procedures have been added to libcurl on OS/400: they provide an additional
|
||||
CCSID (numeric Coded Character Set ID specific to OS/400) parameter for each
|
||||
string argument. String values passed to callback procedures are NOT converted,
|
||||
so text gathered this way is (probably !) ASCII.
|
||||
|
||||
Another OS/400 problem comes from the fact that the last fixed argument of a
|
||||
vararg procedure may not be of type char, unsigned char, short or unsigned
|
||||
short. Enums that are internally implemented by the C compiler as one of these
|
||||
types are also forbidden. Libcurl uses enums as vararg procedure tagfields...
|
||||
Happily, there is a pragma forcing enums to type "int". The original libcurl
|
||||
header files are thus altered during build process to use this pragma, in
|
||||
order to force libcurl enums of being type int (the pragma disposition in use
|
||||
before inclusion is restored before resuming the including unit compilation).
|
||||
|
||||
Three SSL implementations were present in libcurl. Nevertheless, none of them
|
||||
is available on OS/400. To support SSL on OS/400, a fourth implementation has
|
||||
been added (qssl.[ch]). There is no way to have different certificate stores
|
||||
for CAs and for personal/application certificates/key. More, the SSL context
|
||||
may be defined as an application identifier in the main certificate store,
|
||||
or as a keyring file. As a consequence, the meaning of some fields have been
|
||||
slightly altered:
|
||||
_ The "certificate identifier" is taken from CURLOPT_SSLCERT if defined, else
|
||||
from CURLOPT_CAINFO.
|
||||
_ The certificate identifier is then used as an application identifier in the
|
||||
main certificate store. If successful, this context is used.
|
||||
_ If the previous step failed, the certificate identifier is used as the file
|
||||
name of a keyring. CURLOPT_KEYPASSWD is used here as the keyring password.
|
||||
_ The default ca-bundle (CURLOPT_CAINFO) is set to the main certificate store's
|
||||
keyring file name: this allows to use the system global CAs by default. (In that
|
||||
case, the keyring password is safely recovered from the system... IBM dixit!)
|
||||
|
||||
Non-standard EBCDIC wrapper prototypes are defined in an additional header
|
||||
file: ccsidcurl.h. These should be self-explanatory to an OS/400-aware
|
||||
designer. CCSID 0 can be used to select the current job's CCSID.
|
||||
Wrapper procedures with variable arguments are described below:
|
||||
|
||||
_ curl_easy_setopt_ccsid()
|
||||
Variable arguments are a string pointer and a CCSID (unsigned int) for
|
||||
options:
|
||||
CURLOPT_CAINFO
|
||||
CURLOPT_CAPATH
|
||||
CURLOPT_COOKIE
|
||||
CURLOPT_COOKIEFILE
|
||||
CURLOPT_COOKIEJAR
|
||||
CURLOPT_COOKIELIST
|
||||
CURLOPT_CUSTOMREQUEST
|
||||
CURLOPT_EGDSOCKET
|
||||
CURLOPT_ENCODING
|
||||
CURLOPT_FTPPORT
|
||||
CURLOPT_FTP_ACCOUNT
|
||||
CURLOPT_FTP_ALTERNATIVE_TO_USER
|
||||
CURLOPT_INTERFACE
|
||||
CURLOPT_KEYPASSWD
|
||||
CURLOPT_KRBLEVEL
|
||||
CURLOPT_NETRC_FILE
|
||||
CURLOPT_COPYPOSTFIELDS
|
||||
CURLOPT_PROXY
|
||||
CURLOPT_PROXYUSERPWD
|
||||
CURLOPT_RANDOM_FILE
|
||||
CURLOPT_RANGE
|
||||
CURLOPT_REFERER
|
||||
CURLOPT_SSH_PRIVATE_KEYFILE
|
||||
CURLOPT_SSH_PUBLIC_KEYFILE
|
||||
CURLOPT_SSLCERT
|
||||
CURLOPT_SSLCERTTYPE
|
||||
CURLOPT_SSLENGINE
|
||||
CURLOPT_SSLKEY
|
||||
CURLOPT_SSLKEYTYPE
|
||||
CURLOPT_SSL_CIPHER_LIST
|
||||
CURLOPT_URL
|
||||
CURLOPT_USERAGENT
|
||||
CURLOPT_USERPWD
|
||||
CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
|
||||
CURLOPT_CRLFILE
|
||||
CURLOPT_ISSUERCERT
|
||||
CURLOPT_USERNAME
|
||||
CURLOPT_PASSWORD
|
||||
CURLOPT_PROXYUSERNAME
|
||||
CURLOPT_PROXYPASSWORD
|
||||
Else it is the same as for curl_easy_setopt().
|
||||
Note that CURLOPT_ERRORBUFFER is not in the list above, since it gives the
|
||||
address of an (empty) character buffer, not the address of a string.
|
||||
CURLOPT_POSTFIELDS stores the address of static binary data (of type void *) and
|
||||
thus is not converted. If CURLOPT_COPYPOSTFIELDS is issued after
|
||||
CURLOPT_POSTFIELDSIZE != -1, the data size is adjusted according to the
|
||||
CCSID conversion result length.
|
||||
|
||||
_ curl_formadd_ccsid()
|
||||
In the variable argument list, string pointers should be followed by a (long)
|
||||
CCSID for the following options:
|
||||
CURLFORM_FILENAME
|
||||
CURLFORM_CONTENTTYPE
|
||||
CURLFORM_BUFFER
|
||||
CURLFORM_FILE
|
||||
CURLFORM_FILECONTENT
|
||||
CURLFORM_COPYCONTENTS
|
||||
CURLFORM_COPYNAME
|
||||
CURLFORM_PTRNAME
|
||||
If taken from an argument array, an additional array entry must follow each
|
||||
entry containing one of the above option. This additional entry holds the CCSID
|
||||
in its value field, and the option field is meaningless.
|
||||
It is not possible to have a string pointer and its CCSID across a function
|
||||
parameter/array boundary.
|
||||
Please note that CURLFORM_PTRCONTENTS and CURLFORM_BUFFERPTR are considered
|
||||
unconvertible strings and thus are NOT followed by a CCSID.
|
||||
|
||||
_ curl_easy_getinfo_ccsid
|
||||
The following options are followed by a 'char * *' and a CCSID. Unlike
|
||||
curl_easy_getinfo(), the value returned in the pointer should be freed after
|
||||
use:
|
||||
CURLINFO_EFFECTIVE_URL
|
||||
CURLINFO_CONTENT_TYPE
|
||||
CURLINFO_FTP_ENTRY_PATH
|
||||
Other options are processed like in curl_easy_getinfo().
|
||||
|
||||
Standard compilation environment does support neither autotools nor make;
|
||||
in fact, very few common utilities are available. As a consequence, the
|
||||
config-os400.h has been coded manually and the compilation scripts are
|
||||
a set of shell scripts stored in subdirectory packages/OS400.
|
||||
|
||||
The "curl" command and the test environment are currently not supported on
|
||||
OS/400.
|
||||
|
||||
|
||||
Protocols currently implemented on OS/400:
|
||||
_ HTTP
|
||||
_ HTTPS
|
||||
_ FTP
|
||||
_ FTPS
|
||||
_ FTP with secure transmission.
|
||||
_ LDAP
|
||||
_ DICT
|
||||
_ TELNET
|
||||
|
||||
|
||||
|
||||
Compiling on OS/400:
|
||||
|
||||
These instructions targets people who knows about OS/400, compiling, IFS and
|
||||
archive extraction. Do not ask questions about these subjects if you're not
|
||||
familiar with.
|
||||
|
||||
_ As a prerequisite, QADRT development environment must be installed.
|
||||
_ Install the curl source directory in IFS.
|
||||
_ Enter shell (QSH)
|
||||
_ Change current directory to the curl installation directory
|
||||
_ Change current directory to ./packages/OS400
|
||||
_ Edit file iniscript.sh. You may want to change tunable configuration
|
||||
parameters, like debug info generation, optimisation level, listing option,
|
||||
target library, etc.
|
||||
_ Copy any file in the current directory to makelog (i.e.:
|
||||
cp initscript.sh makelog): this is intended to create the makelog file with
|
||||
an ASCII CCSID!
|
||||
_ Enter the command "sh makefile.sh > makelog 2>&1'
|
||||
_ Examine the makelog file to check for compilation errors.
|
||||
|
||||
Leaving file initscript.sh unchanged, this will produce the following OS/400
|
||||
objects:
|
||||
_ Library CURL. All other objects will be stored in this library.
|
||||
_ Modules for all libcurl units.
|
||||
_ Binding directory CURL_A, to be used at calling program link time for
|
||||
statically binding the modules (specify BNDSRVPGM(QADRTTS QGLDCLNT QGLDBRDR)
|
||||
when creating a program using CURL_A).
|
||||
_ Service program CURL.<soname>, where <soname> is extracted from the
|
||||
lib/Makefile.am VERSION variable. To be used at calling program run-time
|
||||
when this program has dynamically bound curl at link time.
|
||||
_ Binding directory CURL. To be used to dynamically bind libcurl when linking a
|
||||
calling program.
|
||||
_ Source file H. It contains all the include members needed to compile a C/C++
|
||||
module using libcurl, and an ILE/RPG /copy member for support in this
|
||||
language.
|
||||
_ Standard C/C++ libcurl include members in file H.
|
||||
_ CCSIDCURL member in file H. This defines the non-standard EBCDIC wrappers for
|
||||
C and C++.
|
||||
_ CURL.INC member in file H. This defines everything needed by an ILE/RPG
|
||||
program using libcurl.
|
||||
_ LIBxxx modules and programs. Although the test environment is not supported
|
||||
on OS/400, the libcurl test programs are compiled for manual tests.
|
||||
|
||||
|
||||
|
||||
Special programming consideration:
|
||||
|
||||
QADRT being used, the following points must be considered:
|
||||
_ If static binding is used, service program QADRTTS must be linked too.
|
||||
_ The EBCDIC CCSID used by QADRT is 37 by default, NOT THE JOB'S CCSID. If
|
||||
another EBCDIC CCSID is required, it must be set via a locale through a call
|
||||
to setlocale_a (QADRT's setlocale() ASCII wrapper) with category LC_ALL or
|
||||
LC_CTYPE, or by setting environment variable QADRT_ENV_LOCALE to the locale
|
||||
object path before executing the program.
|
||||
_ Do not use original source include files unless you know what you are doing.
|
||||
Use the installed members instead (in /QSYS.LIB/CURL.LIB/H.FILE).
|
||||
|
||||
|
||||
|
||||
ILE/RPG support:
|
||||
|
||||
Since 95% of the OS/400 programmers use ILE/RPG exclusively, a definition
|
||||
/COPY member is provided for this language. To include all libcurl
|
||||
definitions in an ILE/RPG module, line
|
||||
|
||||
h bnddir('CURL/CURL')
|
||||
|
||||
must figure in the program header, and line
|
||||
|
||||
d/copy curl/h,curl.inc
|
||||
|
||||
in the global data section of the module's source code.
|
||||
|
||||
No vararg procedure support exists in ILE/RPG: for this reason, the following
|
||||
considerations apply:
|
||||
_ Procedures curl_easy_setopt_long(), curl_easy_setopt_object(),
|
||||
curl_easy_setopt_function() and curl_easy_setopt_offset() are all alias
|
||||
prototypes to curl_easy_setopt(), but with different parameter lists.
|
||||
_ Procedures curl_easy_getinfo_string(), curl_easy_getinfo_long(),
|
||||
curl_easy_getinfo_double() and curl_easy_getinfo_slist() are all alias
|
||||
prototypes to curl_easy_getinfo(), but with different parameter lists.
|
||||
_ Procedures curl_multi_setopt_long(), curl_multi_setopt_object(),
|
||||
curl_multi_setopt_function() and curl_multi_setopt_offset() are all alias
|
||||
prototypes to curl_multi_setopt(), but with different parameter lists.
|
||||
_ The prototype of procedure curl_formadd() allows specifying a pointer option
|
||||
and the CURLFORM_END option. This makes possible to use an option array
|
||||
without any additional definition. If some specific incompatible argument
|
||||
list is used in the ILE/RPG program, the latter must define a specialised
|
||||
alias. The same applies to curl_formadd_ccsid() too.
|
||||
|
||||
Since RPG cannot cast a long to a pointer, procedure curl_form_long_value()
|
||||
is provided for that purpose: this allows storing a long value in the curl_forms
|
||||
array.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2008, Daniel Stenberg, <[email protected]>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id: ccsidcurl.h,v 1.2 2008-01-16 16:04:47 patrickm Exp $
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __CURL_CCSIDCURL_H
|
||||
#define __CURL_CCSIDCURL_H
|
||||
|
||||
#include <curl.h>
|
||||
#include <easy.h>
|
||||
#include <multi.h>
|
||||
|
||||
|
||||
CURL_EXTERN char * curl_version_ccsid(unsigned int ccsid);
|
||||
CURL_EXTERN char * curl_easy_escape_ccsid(CURL * handle,
|
||||
const char * string, int length,
|
||||
unsigned int sccsid,
|
||||
unsigned int dccsid);
|
||||
CURL_EXTERN char * curl_easy_unescape_ccsid(CURL * handle, const char * string,
|
||||
int length, int * outlength,
|
||||
unsigned int sccsid,
|
||||
unsigned int dccsid);
|
||||
CURL_EXTERN struct curl_slist * curl_slist_append_ccsid(struct curl_slist * lst,
|
||||
const char * data,
|
||||
unsigned int ccsid);
|
||||
CURL_EXTERN time_t curl_getdate_ccsid(const char * p, const time_t * unused,
|
||||
unsigned int ccsid);
|
||||
CURL_EXTERN curl_version_info_data * curl_version_info_ccsid(CURLversion stamp,
|
||||
unsigned int csid);
|
||||
CURL_EXTERN const char * curl_easy_strerror_ccsid(CURLcode error,
|
||||
unsigned int ccsid);
|
||||
CURL_EXTERN const char * curl_share_strerror_ccsid(CURLSHcode error,
|
||||
unsigned int ccsid);
|
||||
CURL_EXTERN const char * curl_multi_strerror_ccsid(CURLMcode error,
|
||||
unsigned int ccsid);
|
||||
CURL_EXTERN CURLcode curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...);
|
||||
CURL_EXTERN CURLFORMcode curl_formadd_ccsid(struct curl_httppost * * httppost,
|
||||
struct curl_httppost * * last_post,
|
||||
...);
|
||||
CURL_EXTERN char * curl_form_long_value(long value);
|
||||
CURL_EXTERN int curl_formget_ccsid(struct curl_httppost * form, void * arg,
|
||||
curl_formget_callback append,
|
||||
unsigned int ccsid);
|
||||
CURL_EXTERN CURLcode curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,177 @@
|
||||
#!/bin/sh
|
||||
|
||||
# $Id: initscript.sh,v 1.6 2008-08-25 13:58:45 patrickm Exp $
|
||||
|
||||
case "${SCRIPTDIR}" in
|
||||
/*) ;;
|
||||
*) SCRIPTDIR="`pwd`/${SCRIPTDIR}"
|
||||
esac
|
||||
|
||||
while true
|
||||
do case "${SCRIPTDIR}" in
|
||||
*/.) SCRIPTDIR="${SCRIPTDIR%/.}";;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
|
||||
# The script directory is supposed to be in $TOPDIR/packages/os400.
|
||||
|
||||
TOPDIR=`dirname "${SCRIPTDIR}"`
|
||||
TOPDIR=`dirname "${TOPDIR}"`
|
||||
export SCRIPTDIR TOPDIR
|
||||
|
||||
# Extract the SONAME from the library makefile.
|
||||
|
||||
SONAME=`sed -e '/^VERSIONINFO=/!d' -e 's/^.* \([0-9]*\):.*$/\1/' -e 'q' \
|
||||
< "${TOPDIR}/lib/Makefile.am"`
|
||||
export SONAME
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Tunable configuration parameters.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
TARGETLIB='CURL' # Target OS/400 program library
|
||||
STATBNDDIR='CURL_A' # Static binding directory.
|
||||
DYNBNDDIR='CURL' # Dynamic binding directory.
|
||||
SRVPGM="CURL.${SONAME}" # Service program.
|
||||
TGTCCSID='500' # Target CCSID of objects
|
||||
DEBUG='*ALL' # Debug level
|
||||
OPTIMIZE='10' # Optimisation level
|
||||
OUTPUT='*NONE' # Compilation output option.
|
||||
TGTRLS='V5R2M0' # Target OS release
|
||||
|
||||
export TARGETLIB STATBNDDIR DYNBNDDIR SRVPGM TGTCCSID DEBUG OPTIMIZE OUTPUT
|
||||
export TGTRLS
|
||||
|
||||
|
||||
################################################################################
|
||||
|
||||
# Need to get the version definitions.
|
||||
|
||||
LIBCURL_VERSION=`grep '^#define *LIBCURL_VERSION ' \
|
||||
"${TOPDIR}/include/curl/curlver.h" |
|
||||
sed 's/.*"\(.*\)".*/\1/'`
|
||||
LIBCURL_VERSION_MAJOR=`grep '^#define *LIBCURL_VERSION_MAJOR ' \
|
||||
"${TOPDIR}/include/curl/curlver.h" |
|
||||
sed 's/^#define *LIBCURL_VERSION_MAJOR *\([^ ]*\).*/\1/'`
|
||||
LIBCURL_VERSION_MINOR=`grep '^#define *LIBCURL_VERSION_MINOR ' \
|
||||
"${TOPDIR}/include/curl/curlver.h" |
|
||||
sed 's/^#define *LIBCURL_VERSION_MINOR *\([^ ]*\).*/\1/'`
|
||||
LIBCURL_VERSION_PATCH=`grep '^#define *LIBCURL_VERSION_PATCH ' \
|
||||
"${TOPDIR}/include/curl/curlver.h" |
|
||||
sed 's/^#define *LIBCURL_VERSION_PATCH *\([^ ]*\).*/\1/'`
|
||||
LIBCURL_VERSION_NUM=`grep '^#define *LIBCURL_VERSION_NUM ' \
|
||||
"${TOPDIR}/include/curl/curlver.h" |
|
||||
sed 's/^#define *LIBCURL_VERSION_NUM *0x\([^ ]*\).*/\1/'`
|
||||
LIBCURL_TIMESTAMP=`grep '^#define *LIBCURL_TIMESTAMP ' \
|
||||
"${TOPDIR}/include/curl/curlver.h" |
|
||||
sed 's/.*"\(.*\)".*/\1/'`
|
||||
export LIBCURL_VERSION
|
||||
export LIBCURL_VERSION_MAJOR LIBCURL_VERSION_MINOR LIBCURL_VERSION_PATCH
|
||||
export LIBCURL_VERSION_NUM LIBCURL_TIMESTAMP
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# OS/400 specific definitions.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LIBIFSNAME="/QSYS.LIB/${TARGETLIB}.LIB"
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Procedures.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# action_needed dest [src]
|
||||
#
|
||||
# dest is an object to build
|
||||
# if specified, src is an object on which dest depends.
|
||||
#
|
||||
# exit 0 (succeeds) if some action has to be taken, else 1.
|
||||
|
||||
action_needed()
|
||||
|
||||
{
|
||||
[ ! -e "${1}" ] && return 0
|
||||
[ "${2}" ] || return 1
|
||||
[ "${1}" -ot "${2}" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
# make_module module_name source_name [additional_definitions]
|
||||
#
|
||||
# Compile source name into ASCII module if needed.
|
||||
# As side effect, append the module name to variable MODULES.
|
||||
# Set LINK to "YES" if the module has been compiled.
|
||||
|
||||
make_module()
|
||||
|
||||
{
|
||||
MODULES="${MODULES} ${1}"
|
||||
MODIFSNAME="${LIBIFSNAME}/${1}.MODULE"
|
||||
action_needed "${MODIFSNAME}" "${2}" || return 0;
|
||||
|
||||
# #pragma convert has to be in the source file itself, i.e.
|
||||
# putting it in an include file makes it only active
|
||||
# for that include file.
|
||||
# Thus we build a temporary file with the pragma prepended to
|
||||
# the source file and we compile that themporary file.
|
||||
|
||||
echo "#line 1 \"${2}\"" > __tmpsrcf.c
|
||||
echo "#pragma convert(819)" >> __tmpsrcf.c
|
||||
echo "#line 1" >> __tmpsrcf.c
|
||||
cat "${2}" >> __tmpsrcf.c
|
||||
CMD="CRTCMOD MODULE(${TARGETLIB}/${1}) SRCSTMF('__tmpsrcf.c')"
|
||||
# CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)"
|
||||
CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST)"
|
||||
CMD="${CMD} LOCALETYPE(*LOCALE)"
|
||||
CMD="${CMD} INCDIR('/qibm/proddata/qadrt/include'"
|
||||
CMD="${CMD} '${TOPDIR}/include/curl' '${TOPDIR}/include'"
|
||||
CMD="${CMD} '${TOPDIR}/packages/OS400' ${INCLUDES})"
|
||||
CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})"
|
||||
CMD="${CMD} OUTPUT(${OUTPUT})"
|
||||
CMD="${CMD} OPTIMIZE(${OPTIMIZE})"
|
||||
CMD="${CMD} DBGVIEW(${DEBUG})"
|
||||
|
||||
if [ "${3}" ]
|
||||
then CMD="${CMD} DEFINE(${3})"
|
||||
fi
|
||||
|
||||
system "${CMD}"
|
||||
rm -f __tmpsrcf.c
|
||||
LINK=YES
|
||||
}
|
||||
|
||||
|
||||
# Determine DB2 object name from IFS name.
|
||||
|
||||
db2_name()
|
||||
|
||||
{
|
||||
basename "${1}" |
|
||||
tr '[a-z-]' '[A-Z_]' |
|
||||
sed -e 's/\..*//' \
|
||||
-e 's/^\(..........\).*/\1/'
|
||||
}
|
||||
|
||||
|
||||
# Copy IFS file replacing version info.
|
||||
|
||||
versioned_copy()
|
||||
|
||||
{
|
||||
sed -e "s/@LIBCURL_VERSION@/${LIBCURL_VERSION}/g" \
|
||||
-e "s/@LIBCURL_VERSION_MAJOR@/${LIBCURL_VERSION_MAJOR}/g" \
|
||||
-e "s/@LIBCURL_VERSION_MINOR@/${LIBCURL_VERSION_MINOR}/g" \
|
||||
-e "s/@LIBCURL_VERSION_PATCH@/${LIBCURL_VERSION_PATCH}/g" \
|
||||
-e "s/@LIBCURL_VERSION_NUM@/${LIBCURL_VERSION_NUM}/g" \
|
||||
-e "s/@LIBCURL_TIMESTAMP@/${LIBCURL_TIMESTAMP}/g" \
|
||||
< "${1}" > "${2}"
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Installation of the include files in the OS/400 library.
|
||||
#
|
||||
# $Id: make-include.sh,v 1.3 2008-08-25 13:58:45 patrickm Exp $
|
||||
|
||||
SCRIPTDIR=`dirname "${0}"`
|
||||
. "${SCRIPTDIR}/initscript.sh"
|
||||
cd "${TOPDIR}/include"
|
||||
|
||||
|
||||
# Produce the curlbuild.h include file.
|
||||
|
||||
if action_needed curl/curlbuild.h curl/curlbuild.h.dist
|
||||
then cp -p curl/curlbuild.h.dist curl/curlbuild.h
|
||||
fi
|
||||
|
||||
|
||||
# Create the OS/400 source program file for the include files.
|
||||
|
||||
SRCPF="${LIBIFSNAME}/H.FILE"
|
||||
|
||||
if action_needed "${SRCPF}"
|
||||
then CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
|
||||
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('curl: Header files')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Enumeration values are used as va_arg tagfields, so they MUST be
|
||||
# integers.
|
||||
|
||||
copy_hfile()
|
||||
|
||||
{
|
||||
sed -e '1i\
|
||||
#pragma enum(int)\
|
||||
' -e '$a\
|
||||
#pragma enum(pop)\
|
||||
' < "${2}" > "${1}"
|
||||
}
|
||||
|
||||
# Copy the header files.
|
||||
|
||||
for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h
|
||||
do DEST="${SRCPF}/`db2_name \"${HFILE}\"`.MBR"
|
||||
if action_needed "${DEST}" "${HFILE}"
|
||||
then copy_hfile "${DEST}" "${HFILE}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Copy the ILE/RPG include file, setting-up version number.
|
||||
|
||||
versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR"
|
||||
@@ -0,0 +1,193 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# libcurl compilation script for the OS/400.
|
||||
#
|
||||
# $Id: make-lib.sh,v 1.4 2008-03-31 12:09:43 mmarek Exp $
|
||||
|
||||
SCRIPTDIR=`dirname "${0}"`
|
||||
. "${SCRIPTDIR}/initscript.sh"
|
||||
cd "${TOPDIR}/lib"
|
||||
|
||||
|
||||
# Create and compile the identification source file.
|
||||
|
||||
echo '#pragma comment(user, "libcurl version '"${LIBCURL_VERSION}"'")' > os400.c
|
||||
echo '#pragma comment(date)' >> os400.c
|
||||
echo '#pragma comment(copyright, "Copyright (C) 1998-2008 Daniel Stenberg et al. OS/400 version by P. Monnerat")' >> os400.c
|
||||
make_module OS400 os400.c
|
||||
LINK= # No need to rebuild service program yet.
|
||||
MODULES=
|
||||
|
||||
|
||||
# Get source list.
|
||||
|
||||
CSOURCES()
|
||||
|
||||
{
|
||||
shift # Drop the equal sign.
|
||||
CSOURCES="$*" # Get the file names.
|
||||
}
|
||||
|
||||
HHEADERS()
|
||||
|
||||
{
|
||||
shift # Drop the equal sign.
|
||||
HHEADERS="$*" # Get the file names.
|
||||
}
|
||||
|
||||
. Makefile.inc
|
||||
|
||||
|
||||
# Compile the sources into modules.
|
||||
|
||||
INCLUDES="'`pwd`'"
|
||||
|
||||
make_module OS400SYS "${SCRIPTDIR}/os400sys.c"
|
||||
make_module CCSIDCURL "${SCRIPTDIR}/ccsidcurl.c"
|
||||
|
||||
for SRC in ${CSOURCES}
|
||||
do MODULE=`basename "${SRC}" .c |
|
||||
tr '[a-z]' '[A-Z]' |
|
||||
sed -e 's/^\(..........\).*/\1/'`
|
||||
make_module "${MODULE}" "${SRC}"
|
||||
done
|
||||
|
||||
|
||||
# If needed, (re)create the static binding directory.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ "${LINK}" ]
|
||||
then rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
|
||||
CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
||||
CMD="${CMD} TEXT('LibCurl API static binding directory')"
|
||||
system "${CMD}"
|
||||
|
||||
for MODULE in ${MODULES}
|
||||
do CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
||||
CMD="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))"
|
||||
system "${CMD}"
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# The exportation file for service program creation must be in a DB2
|
||||
# source file, so make sure it exists.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/TOOLS.FILE"
|
||||
then CMD="CRTSRCPF FILE(${TARGETLIB}/TOOLS) RCDLEN(112)"
|
||||
CMD="${CMD} TEXT('curl: build tools')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Gather the list of symbols to export.
|
||||
|
||||
EXPORTS=`grep '^CURL_EXTERN[ ]' \
|
||||
"${TOPDIR}"/include/curl/*.h \
|
||||
"${SCRIPTDIR}/ccsidcurl.h" |
|
||||
sed -e 's/^.*CURL_EXTERN[ ]\(.*\)(.*$/\1/' \
|
||||
-e 's/[ ]*$//' \
|
||||
-e 's/^.*[ ][ ]*//' \
|
||||
-e 's/^\*//' \
|
||||
-e 's/(\(.*\))/\1/'`
|
||||
|
||||
# Create the service program exportation file in DB2 member if needed.
|
||||
|
||||
BSF="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR"
|
||||
|
||||
if action_needed "${BSF}" Makefile.am
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ "${LINK}" ]
|
||||
then echo " STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('LIBCURL_${SONAME}')" \
|
||||
> "${BSF}"
|
||||
for EXPORT in ${EXPORTS}
|
||||
do echo ' EXPORT SYMBOL("'"${EXPORT}"'")' >> "${BSF}"
|
||||
done
|
||||
|
||||
echo ' ENDPGMEXP' >> "${BSF}"
|
||||
fi
|
||||
|
||||
|
||||
# Build the service program if needed.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/${SRVPGM}.SRVPGM"
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ "${LINK}" ]
|
||||
then CMD="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})"
|
||||
CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)"
|
||||
CMD="${CMD} MODULE(${TARGETLIB}/OS400)"
|
||||
CMD="${CMD} BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
||||
CMD="${CMD} BNDSRVPGM(QADRTTS QGLDCLNT QGLDBRDR)"
|
||||
CMD="${CMD} TEXT('curl API library')"
|
||||
CMD="${CMD} TGTRLS(${TGTRLS})"
|
||||
system "${CMD}"
|
||||
LINK=YES
|
||||
fi
|
||||
|
||||
|
||||
# If needed, (re)create the dynamic binding directory.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ "${LINK}" ]
|
||||
then rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
|
||||
CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
|
||||
CMD="${CMD} TEXT('LibCurl API dynamic binding directory')"
|
||||
system "${CMD}"
|
||||
CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
|
||||
CMD="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Rebuild the formdata test if needed.
|
||||
|
||||
if [ "${TEST_FORMDATA}" ]
|
||||
then MODULES=
|
||||
make_module TFORMDATA formdata.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
||||
make_module TSTREQUAL strequal.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
||||
make_module TMEMDEBUG memdebug.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
||||
make_module TMPRINTF mprintf.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
||||
make_module TSTRERROR strerror.c "'_FORM_DEBUG' 'CURLDEBUG'"
|
||||
# The following modules should not be needed (see comment in
|
||||
# formdata.c. However, there are some unsatisfied
|
||||
# external references leading in the following
|
||||
# modules to be (recursively) needed.
|
||||
MODULES="${MODULES} EASY STRDUP SSLGEN QSSL HOSTIP HOSTIP4 HOSTIP6"
|
||||
MODULES="${MODULES} URL HASH TRANSFER GETINFO COOKIE SENDF SELECT"
|
||||
MODULES="${MODULES} INET_NTOP SHARE HOSTTHRE MULTI LLIST FTP HTTP"
|
||||
MODULES="${MODULES} HTTP_DIGES HTTP_CHUNK HTTP_NEGOT TIMEVAL HOSTSYN"
|
||||
MODULES="${MODULES} CONNECT SOCKS PROGRESS ESCAPE INET_PTON GETENV"
|
||||
MODULES="${MODULES} DICT LDAP TELNET FILE TFTP NETRC PARSEDATE"
|
||||
MODULES="${MODULES} SPEEDCHECK SPLAY BASE64 SECURITY IF2IP MD5"
|
||||
MODULES="${MODULES} KRB5 OS400SYS"
|
||||
|
||||
PGMIFSNAME="${LIBIFSNAME}/TFORMDATA.PGM"
|
||||
|
||||
if action_needed "${PGMIFSNAME}"
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ "${LINK}" ]
|
||||
then CMD="CRTPGM PGM(${TARGETLIB}/TFORMDATA)"
|
||||
CMD="${CMD} ENTMOD(QADRT/QADRTMAIN2)"
|
||||
CMD="${CMD} MODULE("
|
||||
|
||||
for MODULE in ${MODULES}
|
||||
do CMD="${CMD} ${TARGETLIB}/${MODULE}"
|
||||
done
|
||||
|
||||
CMD="${CMD} ) BNDSRVPGM(QADRTTS)"
|
||||
CMD="${CMD} TGTRLS(${TGTRLS})"
|
||||
system "${CMD}"
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $Id: make-src.sh,v 1.1 2007-08-23 14:30:24 patrickm Exp $
|
||||
#
|
||||
# Not implemented yet on OS/400.
|
||||
@@ -0,0 +1,102 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# tests compilation script for the OS/400.
|
||||
#
|
||||
# $Id: make-tests.sh,v 1.1 2007-08-23 14:30:24 patrickm Exp $
|
||||
|
||||
|
||||
SCRIPTDIR=`dirname "${0}"`
|
||||
. "${SCRIPTDIR}/initscript.sh"
|
||||
cd "${TOPDIR}/tests"
|
||||
|
||||
|
||||
# tests directory not implemented yet.
|
||||
|
||||
|
||||
# Process the libtest subdirectory.
|
||||
|
||||
cd libtest
|
||||
|
||||
# Get definitions from the Makefile.am file.
|
||||
# The `sed' statement works as follows:
|
||||
# _ Join \nl-separated lines.
|
||||
# _ Retain only lines that begins with "identifier =".
|
||||
# _ Turn these lines into shell variable assignments.
|
||||
|
||||
eval "`sed -e ': begin' \
|
||||
-e '/\\\\$/{' \
|
||||
-e 'N' \
|
||||
-e 's/\\\\\\n/ /' \
|
||||
-e 'b begin' \
|
||||
-e '}' \
|
||||
-e '/^[A-Za-z_][A-Za-z0-9_]*[ ]*[=]/b keep' \
|
||||
-e 'd' \
|
||||
-e ': keep' \
|
||||
-e 's/[ ]*=[ ]*/=/' \
|
||||
-e 's/=\\(.*[^ ]\\)[ ]*$/=\\"\\1\\"/' \
|
||||
-e 's/\\$(\\([^)]*\\))/${\\1}/g' \
|
||||
< Makefile.am`"
|
||||
|
||||
# Compile all programs.
|
||||
# The list is found in variable "noinst_PROGRAMS"
|
||||
|
||||
INCLUDES="'${TOPDIR}/tests/libtest' '${TOPDIR}/lib'"
|
||||
|
||||
for PGM in ${noinst_PROGRAMS}
|
||||
do DB2PGM=`db2_name "${PGM}"`
|
||||
PGMIFSNAME="${LIBIFSNAME}/${DB2PGM}.PGM"
|
||||
|
||||
# Extract preprocessor symbol definitions from compilation
|
||||
# options for the program.
|
||||
|
||||
PGMCFLAGS="`eval echo \"\\${${PGM}_CFLAGS}\"`"
|
||||
PGMDEFINES=
|
||||
|
||||
for FLAG in ${PGMCFLAGS}
|
||||
do case "${FLAG}" in
|
||||
-D?*) DEFINE="`echo \"${FLAG}\" | sed 's/^..//'`"
|
||||
PGMDEFINES="${PGMDEFINES} '${DEFINE}'"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Compile all C sources for the program into modules.
|
||||
|
||||
PGMSOURCES="`eval echo \"\\${${PGM}_SOURCES}\"`"
|
||||
LINK=
|
||||
MODULES=
|
||||
|
||||
for SOURCE in ${PGMSOURCES}
|
||||
do case "${SOURCE}" in
|
||||
*.c) # Special processing for libxxx.c files: their
|
||||
# module name is determined by the target
|
||||
# PROGRAM name.
|
||||
|
||||
case "${SOURCE}" in
|
||||
lib*.c) MODULE="${DB2PGM}"
|
||||
;;
|
||||
*) MODULE=`db2_name "${SOURCE}"`
|
||||
;;
|
||||
esac
|
||||
|
||||
make_module "${MODULE}" "${SOURCE}" "${PGMDEFINES}"
|
||||
if action_needed "${PGMIFSNAME}" "${MODIFSNAME}"
|
||||
then LINK=yes
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Link program if needed.
|
||||
|
||||
if [ "${LINK}" ]
|
||||
then MODULES="`echo \"${MODULES}\" |
|
||||
sed \"s/[^ ][^ ]*/${TARGETLIB}\/&/g\"`"
|
||||
CMD="CRTPGM PGM(${TARGETLIB}/${DB2PGM})"
|
||||
CMD="${CMD} ENTMOD(QADRT/QADRTMAIN2)"
|
||||
CMD="${CMD} MODULE(${MODULES})"
|
||||
CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)"
|
||||
CMD="${CMD} TGTRLS(${TGTRLS})"
|
||||
system "${CMD}"
|
||||
fi
|
||||
done
|
||||
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# curl compilation script for the OS/400.
|
||||
#
|
||||
# $Id: makefile.sh,v 1.2 2007-08-24 15:56:59 patrickm Exp $
|
||||
#
|
||||
# This is a shell script since make is not a standard component of OS/400.
|
||||
|
||||
SCRIPTDIR=`dirname "${0}"`
|
||||
. "${SCRIPTDIR}/initscript.sh"
|
||||
cd "${TOPDIR}"
|
||||
|
||||
|
||||
# Create the OS/400 library if it does not exist.
|
||||
|
||||
if action_needed "${LIBIFSNAME}"
|
||||
then CMD="CRTLIB LIB(${TARGETLIB}) TEXT('curl: multiprotocol support API')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Create the DOCS source file if it does not exist.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/DOCS.FILE"
|
||||
then CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(112)"
|
||||
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Copy some documentation files if needed.
|
||||
|
||||
for TEXT in "${TOPDIR}/COPYING" "${SCRIPTDIR}/README.OS400" \
|
||||
"${TOPDIR}/CHANGES" "${TOPDIR}/docs/THANKS" "${TOPDIR}/docs/FAQ" \
|
||||
"${TOPDIR}/docs/FEATURES" "${TOPDIR}/docs/SSLCERTS" \
|
||||
"${TOPDIR}/docs/RESOURCES" "${TOPDIR}/docs/VERSIONS" \
|
||||
"${TOPDIR}/docs/HISTORY"
|
||||
do MEMBER="`basename \"${TEXT}\" .OS400`"
|
||||
MEMBER="${LIBIFSNAME}/DOCS.FILE/`db2_name \"${MEMBER}\"`.MBR"
|
||||
|
||||
if action_needed "${MEMBER}" "${TEXT}"
|
||||
then CMD="CPY OBJ('${TEXT}') TOOBJ('${MEMBER}') TOCCSID(${TGTCCSID})"
|
||||
CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
|
||||
system "${CMD}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Build in each directory.
|
||||
|
||||
for SUBDIR in include lib src tests
|
||||
do "${SCRIPTDIR}/make-${SUBDIR}.sh"
|
||||
done
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,53 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2008, Daniel Stenberg, <[email protected]>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id: os400sys.h,v 1.2 2008-01-16 16:04:47 patrickm Exp $
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* OS/400 additional definitions. */
|
||||
|
||||
#ifndef __OS400_SYS_
|
||||
#define __OS400_SYS_
|
||||
|
||||
|
||||
/* Per-thread item identifiers. */
|
||||
|
||||
typedef enum {
|
||||
LK_SSL_ERROR,
|
||||
LK_LDAP_ERROR,
|
||||
LK_CURL_VERSION,
|
||||
LK_VERSION_INFO,
|
||||
LK_VERSION_INFO_DATA,
|
||||
LK_EASY_STRERROR,
|
||||
LK_SHARE_STRERROR,
|
||||
LK_MULTI_STRERROR,
|
||||
LK_LAST
|
||||
} localkey_t;
|
||||
|
||||
|
||||
extern char * (* Curl_thread_buffer)(localkey_t key, long size);
|
||||
|
||||
|
||||
/* Maximum string expansion factor due to character code conversion. */
|
||||
|
||||
#define MAX_CONV_EXPANSION 4 /* Can deal with UTF-8. */
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user