diff -Naur curl.orig/CHANGES curl/CHANGES
--- curl.orig/CHANGES	2007-06-12 18:18:00.584576000 +0200
+++ curl/CHANGES	2007-06-12 18:23:09.924736200 +0200
@@ -6,6 +6,12 @@
 
                                   Changelog
 
+Patrick Monnerat (12 june 2007)
+- Porting library to OS/400:
+-   Renamed structure fields fread, fwrite & ioctl to avoid name clash.
+-   New files lib/(config-os400.h,makefile-os400.sh,os400sys.c),
+              tests/libtest/makefile-os400.sh.
+
 Daniel S (12 June 2007)
 - James Housley brought his revamped SSH code that is state-machine driven to
   really take advantage of the now totally non-blocking libssh2 (in CVS).
diff -Naur curl.orig/include/curl/curl.h curl/include/curl/curl.h
--- curl.orig/include/curl/curl.h	2007-05-08 13:34:31.000000000 +0200
+++ curl/include/curl/curl.h	2007-06-12 12:37:56.342761400 +0200
@@ -517,7 +517,8 @@
  */
 #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
   defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
-  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__)
+  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
+  defined(__ILEC400__)
   /* This compiler is believed to have an ISO compatible preprocessor */
 #define CURL_ISOCPP
 #else
diff -Naur curl.orig/include/curl/mprintf.h curl/include/curl/mprintf.h
--- curl.orig/include/curl/mprintf.h	2006-10-30 17:26:24.000000000 +0100
+++ curl/include/curl/mprintf.h	2007-06-12 12:39:30.902906400 +0200
@@ -44,6 +44,16 @@
 CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
 
 #ifdef _MPRINTF_REPLACE
+# undef printf
+# undef fprintf
+# undef sprintf
+# undef vsprintf
+# undef snprintf
+# undef vprintf
+# undef vfprintf
+# undef vsnprintf
+# undef aprintf
+# undef vaprintf
 # define printf curl_mprintf
 # define fprintf curl_mfprintf
 #ifdef CURLDEBUG
diff -Naur curl.orig/lib/config-os400.h curl/lib/config-os400.h
--- curl.orig/lib/config-os400.h	1970-01-01 01:00:00.000000000 +0100
+++ curl/lib/config-os400.h	2007-06-12 12:42:17.334006400 +0200
@@ -0,0 +1,489 @@
+/* ================================================================ */
+/*    lib/config-os400.h - Hand crafted config file for OS/400      */
+/* ================================================================ */
+
+#pragma enum(int)
+
+#undef PACKAGE
+
+/* Version number of this archive. */
+#undef VERSION
+
+/* Define if you have the getpass function.  */
+#undef HAVE_GETPASS
+
+/* Define cpu-machine-OS */
+#define OS "OS/400"
+
+/* Define if you have the gethostbyaddr_r() function with 5 arguments */
+#define HAVE_GETHOSTBYADDR_R_5
+
+/* Define if you have the gethostbyaddr_r() function with 7 arguments */
+#undef HAVE_GETHOSTBYADDR_R_7
+
+/* Define if you have the gethostbyaddr_r() function with 8 arguments */
+#undef HAVE_GETHOSTBYADDR_R_8
+
+/* Define if you have the gethostbyname_r() function with 3 arguments */
+#define HAVE_GETHOSTBYNAME_R_3
+
+/* Define if you have the gethostbyname_r() function with 5 arguments */
+#undef HAVE_GETHOSTBYNAME_R_5
+
+/* Define if you have the gethostbyname_r() function with 6 arguments */
+#undef HAVE_GETHOSTBYNAME_R_6
+
+/* Define if you have the inet_ntoa_r function declared. */
+#define HAVE_INET_NTOA_R_DECL
+
+/* Define if the inet_ntoa_r function returns an int. */
+#define HAVE_INT_INET_NTOA_R
+
+/* Define if you need the _REENTRANT define for some functions */
+#undef NEED_REENTRANT
+
+/* Define if you have the Kerberos4 libraries (including -ldes) */
+#undef HAVE_KRB4
+
+/* Define if you want to enable IPv6 support */
+#define ENABLE_IPV6
+
+/* Define this to 'int' if ssize_t is not an available typedefed type */
+#undef ssize_t
+
+/* Define this to 'int' if socklen_t is not an available typedefed type */
+#undef socklen_t
+
+/* Define this as a suitable file to read random data from */
+#undef RANDOM_FILE
+
+/* Define this to your Entropy Gathering Daemon socket pathname */
+#undef EGD_SOCKET
+
+/* Set to explicitly specify we don't want to use thread-safe functions */
+#undef DISABLED_THREADSAFE
+
+/* Define if you have the <alloca.h> header file. */
+#undef HAVE_ALLOCA_H
+
+/* Define if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H
+
+/* Define if you have the `closesocket' function. */
+#undef HAVE_CLOSESOCKET
+
+/* Define if you have the <crypto.h> header file. */
+#undef HAVE_CRYPTO_H
+
+/* Define if you have the <des.h> header file. */
+#undef HAVE_DES_H
+
+/* Define if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define if you have the `dlopen' function. */
+#undef HAVE_DLOPEN
+
+/* Define if you have the <err.h> header file. */
+#undef HAVE_ERR_H
+
+/* Define if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H
+
+/* Define if getaddrinfo exists and works */
+/* OS400 has no ASCII version of this procedure. */
+#undef HAVE_GETADDRINFO
+
+/* Define if you have the `geteuid' function. */
+#define HAVE_GETEUID
+
+/* Define if you have the `gethostbyaddr' function. */
+#define HAVE_GETHOSTBYADDR
+
+/* Define if you have the `gethostbyaddr_r' function. */
+#define HAVE_GETHOSTBYADDR_R
+
+/* Define if you have the `gethostbyname_r' function. */
+#define HAVE_GETHOSTBYNAME_R
+
+/* Define if you have the `gethostname' function. */
+#define HAVE_GETHOSTNAME
+
+/* Define if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define if you have the `getpass_r' function. */
+#undef HAVE_GETPASS_R
+
+/* Define if you have the `getpwuid' function. */
+#define HAVE_GETPWUID
+
+/* Define if you have the `getservbyname' function. */
+#define HAVE_GETSERVBYNAME
+
+/* Define if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY
+
+/* Define if you have the `timeval' struct. */
+#define HAVE_STRUCT_TIMEVAL
+
+/* Define if you have the `inet_addr' function. */
+#define HAVE_INET_ADDR
+
+/* Define if you have the `inet_ntoa' function. */
+#define HAVE_INET_NTOA
+
+/* Define if you have the `inet_ntoa_r' function. */
+#define HAVE_INET_NTOA_R
+
+/* Define if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H
+
+/* Define if you have the <io.h> header file. */
+#undef HAVE_IO_H
+
+/* Define if you have the `krb_get_our_ip_for_realm' function. */
+#undef HAVE_KRB_GET_OUR_IP_FOR_REALM
+
+/* Define if you have the <krb.h> header file. */
+#undef HAVE_KRB_H
+
+/* Define if you have the `crypto' library (-lcrypto). */
+#undef HAVE_LIBCRYPTO
+
+/* Define if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Define if you have the `nsl' library (-lnsl). */
+#undef HAVE_LIBNSL
+
+/* Define if you have the `resolv' library (-lresolv). */
+#undef HAVE_LIBRESOLV
+
+/* Define if you have the `resolve' library (-lresolve). */
+#undef HAVE_LIBRESOLVE
+
+/* Define if you have the `socket' library (-lsocket). */
+#undef HAVE_LIBSOCKET
+
+/* Define if you have the `ssl' library (-lssl). */
+#undef HAVE_LIBSSL
+
+/* Define if you have the `ucb' library (-lucb). */
+#undef HAVE_LIBUCB
+
+/* Define if you have the `localtime_r' function. */
+#define HAVE_LOCALTIME_R
+
+/* Define if you have the <malloc.h> header file. */
+#define HAVE_MALLOC_H
+
+/* Define if you need the malloc.h header file even with stdlib.h  */
+/* #define NEED_MALLOC_H 1 */
+
+/* Define if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define if you have the <netdb.h> header file. */
+#define HAVE_NETDB_H
+
+/* Define if you have the <netinet/if_ether.h> header file. */
+#undef HAVE_NETINET_IF_ETHER_H
+
+/* Define if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H
+
+/* Define if you have the <net/if.h> header file. */
+#define HAVE_NET_IF_H
+
+/* Define if you have the <openssl/crypto.h> header file. */
+#undef HAVE_OPENSSL_CRYPTO_H
+
+/* Define if you have the <openssl/err.h> header file. */
+#undef HAVE_OPENSSL_ERR_H
+
+/* Define if you have the <openssl/pem.h> header file. */
+#undef HAVE_OPENSSL_PEM_H
+
+/* Define if you have the <openssl/rsa.h> header file. */
+#undef HAVE_OPENSSL_RSA_H
+
+/* Define if you have the <openssl/ssl.h> header file. */
+#undef HAVE_OPENSSL_SSL_H
+
+/* Define if you have the <openssl/x509.h> header file. */
+#undef HAVE_OPENSSL_X509_H
+
+/* Define if you have the <pem.h> header file. */
+#undef HAVE_PEM_H
+
+/* Define if you have the `perror' function. */
+#define HAVE_PERROR
+
+/* Define if you have the <pwd.h> header file. */
+#define HAVE_PWD_H
+
+/* Define if you have the `RAND_egd' function. */
+#undef HAVE_RAND_EGD
+
+/* Define if you have the `RAND_screen' function. */
+#undef HAVE_RAND_SCREEN
+
+/* Define if you have the `RAND_status' function. */
+#undef HAVE_RAND_STATUS
+
+/* Define if you have the <rsa.h> header file. */
+#undef HAVE_RSA_H
+
+/* Define if you have the `select' function. */
+#define HAVE_SELECT
+
+/* Define if you have the `setvbuf' function. */
+#define HAVE_SETVBUF
+
+/* Define if you have the <sgtty.h> header file. */
+#undef HAVE_SGTTY_H
+
+/* Define if you have the `sigaction' function. */
+#define HAVE_SIGACTION
+
+/* Define if you have the `signal' function. */
+#undef HAVE_SIGNAL
+
+/* Define if you have the <signal.h> header file. */
+#define HAVE_SIGNAL_H
+
+/* Define if sig_atomic_t is an available typedef. */
+#define HAVE_SIG_ATOMIC_T
+
+/* Define if sig_atomic_t is already defined as volatile. */
+#undef HAVE_SIG_ATOMIC_T_VOLATILE
+
+/* Define if you have the `socket' function. */
+#define HAVE_SOCKET
+
+/* Define if you have the <ssl.h> header file. */
+#undef HAVE_SSL_H
+
+/* Define if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H
+
+/* Define if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define if you have the `strcmpi' function. */
+#undef HAVE_STRCMPI
+
+/* Define if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define if you have the `strftime' function. */
+#define HAVE_STRFTIME
+
+/* Define if you have the `stricmp' function. */
+#undef HAVE_STRICMP
+
+/* Define if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H
+
+/* Define if you have the <string.h> header file. */
+#define HAVE_STRING_H
+
+/* Define if you have the `strlcat' function. */
+#undef HAVE_STRLCAT
+
+/* Define if you have the `strlcpy' function. */
+#undef HAVE_STRLCPY
+
+/* Define if you have the `strstr' function. */
+#define HAVE_STRSTR
+
+/* Define if you have the `strtok_r' function. */
+#define HAVE_STRTOK_R
+
+/* Define if you have the `strtoll' function. */
+#define HAVE_STRTOLL
+
+/* Define if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H
+
+/* Define if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H
+
+/* Define if you have the <sys/sockio.h> header file. */
+#undef HAVE_SYS_SOCKIO_H
+
+/* Define if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H
+
+/* Define if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H
+
+/* Define if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H
+
+/* Define if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H
+
+/* Define if you have the `tcgetattr' function. */
+#undef HAVE_TCGETATTR
+
+/* Define if you have the `tcsetattr' function. */
+#undef HAVE_TCSETATTR
+
+/* Define if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
+/* Define if you have the <termio.h> header file. */
+#undef HAVE_TERMIO_H
+
+/* Define if you have the <time.h> header file. */
+#define HAVE_TIME_H
+
+/* Define if you have the `uname' function. */
+#undef HAVE_UNAME
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H
+
+/* Define if you have the <winsock.h> header file. */
+#undef HAVE_WINSOCK_H
+
+/* Define if you have the <x509.h> header file. */
+#undef HAVE_X509_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* The size of a `long double', as computed by sizeof. */
+#define SIZEOF_LONG_DOUBLE      8
+
+/* The size of a `long long', as computed by sizeof. */
+#define SIZEOF_LONG_LONG        8
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* type to use in place of in_addr_t if not defined */
+#define in_addr_t       unsigned long
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
+
+#define IOCTL_3_ARGS
+
+#define HAVE_FIONBIO
+
+/* to disable LDAP */
+#undef CURL_DISABLE_LDAP
+
+/* Define if you have the getnameinfo function. */
+/* OS400 has no ASCII version of this procedure. */
+#undef HAVE_GETNAMEINFO
+
+/* Define to the type qualifier of arg 1 for getnameinfo. */
+#define GETNAMEINFO_QUAL_ARG1 const
+
+/* Define to the type of arg 1 for getnameinfo. */
+#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
+
+/* Define to the type of arg 2 for getnameinfo. */
+#define GETNAMEINFO_TYPE_ARG2 socklen_t
+
+/* Define to the type of args 4 and 6 for getnameinfo. */
+#define GETNAMEINFO_TYPE_ARG46 socklen_t
+
+/* Define to the type of arg 7 for getnameinfo. */
+#define GETNAMEINFO_TYPE_ARG7 int
+
+/* Define if you have the recv function. */
+#define HAVE_RECV
+
+/* Define to the type of arg 1 for recv. */
+#define RECV_TYPE_ARG1 int
+
+/* Define to the type of arg 2 for recv. */
+#define RECV_TYPE_ARG2 char *
+
+/* Define to the type of arg 3 for recv. */
+#define RECV_TYPE_ARG3 int
+
+/* Define to the type of arg 4 for recv. */
+#define RECV_TYPE_ARG4 int
+
+/* Define to the function return type for recv. */
+#define RECV_TYPE_RETV int
+
+/* Define if you have the send function. */
+#define HAVE_SEND
+
+/* Define to the type of arg 1 for send. */
+#define SEND_TYPE_ARG1 int
+
+/* Define to the type qualifier of arg 2 for send. */
+#define SEND_QUAL_ARG2
+
+/* Define to the type of arg 2 for send. */
+#define SEND_TYPE_ARG2 char *
+
+/* Define to the type of arg 3 for send. */
+#define SEND_TYPE_ARG3 int
+
+/* Define to the type of arg 4 for send. */
+#define SEND_TYPE_ARG4 int
+
+/* Define to the function return type for send. */
+#define SEND_TYPE_RETV int
+
+
+/* OS/400 netdb.h does not define NI_MAXHOST. */
+#define NI_MAXHOST      1025
+
+/* OS/400 netdb.h does not define NI_MAXSERV. */
+#define NI_MAXSERV      32
+
+/* OS/400 does not define the ifr_dstaddr union member. */
+#define ifr_dstaddr     ifr_addr
+
+
+/* Additional support for OS/400. */
+
+#define qadrt_use_fread_inline
+#define qadrt_use_fwrite_inline
+
+#include <sys/socket.h>
+#include <netdb.h>
+
+extern int      curl_getaddrinfo_a(const char * nodename, const char * servname,
+                              const struct addrinfo * hints,
+                              struct addrinfo * * res);
+extern int      curl_getnameinfo_a(const struct sockaddr * sa, socklen_t salen,
+                              char * nodename, socklen_t nodenamelen,
+                              char * servname, socklen_t servnamelen,
+                              int flags);
+#define getaddrinfo     curl_getaddrinfo_a
+#define getnameinfo     curl_getnameinfo_a
diff -Naur curl.orig/lib/easy.c curl/lib/easy.c
--- curl.orig/lib/easy.c	2007-05-31 13:34:32.000000000 +0200
+++ curl/lib/easy.c	2007-06-12 12:45:17.690852700 +0200
@@ -690,10 +690,10 @@
   data->set.err  = stderr;  /* default stderr to stderr */
 
   /* use fwrite as default function to store output */
-  data->set.fwrite = (curl_write_callback)fwrite;
+  data->set.fwrite_func = (curl_write_callback)fwrite;
 
   /* use fread as default function to read input */
-  data->set.fread = (curl_read_callback)fread;
+  data->set.fread_func = (curl_read_callback)fread;
 
   data->set.infilesize = -1; /* we don't know any size */
   data->set.postfieldsize = -1;
diff -Naur curl.orig/lib/file.c curl/lib/file.c
--- curl.orig/lib/file.c	2007-06-08 00:24:53.000000000 +0200
+++ curl/lib/file.c	2007-06-12 12:46:06.398341500 +0200
@@ -205,7 +205,7 @@
    * Since FILE: doesn't do the full init, we need to provide some extra
    * assignments here.
    */
-  conn->fread = data->set.fread;
+  conn->fread_func = data->set.fread_func;
   conn->fread_in = data->set.in;
   conn->data->reqdata.upload_fromhere = buf;
 
diff -Naur curl.orig/lib/ftp.c curl/lib/ftp.c
--- curl.orig/lib/ftp.c	2007-04-25 22:54:02.000000000 +0200
+++ curl/lib/ftp.c	2007-06-12 12:48:12.394004700 +0200
@@ -1453,7 +1453,7 @@
         readthisamountnow = BUFSIZE;
 
       actuallyread = (curl_off_t)
-        conn->fread(data->state.buffer, 1, (size_t)readthisamountnow,
+        conn->fread_func(data->state.buffer, 1, (size_t)readthisamountnow,
                     conn->fread_in);
 
       passed += actuallyread;
diff -Naur curl.orig/lib/http.c curl/lib/http.c
--- curl.orig/lib/http.c	2007-04-11 00:52:50.000000000 +0200
+++ curl/lib/http.c	2007-06-12 12:51:43.698722300 +0200
@@ -790,7 +790,7 @@
       /* move backup data into focus and continue on that */
       http->postdata = http->backup.postdata;
       http->postsize = http->backup.postsize;
-      conn->fread =    http->backup.fread;
+      conn->fread_func = http->backup.fread_func;
       conn->fread_in = http->backup.fread_in;
 
       http->sending++; /* move one step up */
@@ -940,13 +940,13 @@
         ptr = in->buffer + amount;
 
         /* backup the currently set pointers */
-        http->backup.fread = conn->fread;
+        http->backup.fread_func = conn->fread_func;
         http->backup.fread_in = conn->fread_in;
         http->backup.postdata = http->postdata;
         http->backup.postsize = http->postsize;
 
         /* set the new pointers for the request-sending */
-        conn->fread = (curl_read_callback)readmoredata;
+        conn->fread_func = (curl_read_callback)readmoredata;
         conn->fread_in = (void *)conn;
         http->postdata = ptr;
         http->postsize = (curl_off_t)size;
@@ -1603,7 +1603,7 @@
   (void)premature; /* not used */
 
   /* set the proper values (possibly modified on POST) */
-  conn->fread = data->set.fread; /* restore */
+  conn->fread_func = data->set.fread_func; /* restore */
   conn->fread_in = data->set.in; /* restore */
 
   if (http == NULL)
@@ -1988,7 +1988,7 @@
           readthisamountnow = BUFSIZE;
 
         actuallyread =
-          data->set.fread(data->state.buffer, 1, (size_t)readthisamountnow,
+          data->set.fread_func(data->state.buffer, 1, (size_t)readthisamountnow,
                           data->set.in);
 
         passed += actuallyread;
@@ -2243,7 +2243,7 @@
       }
 
       /* set the read function to read from the generated form data */
-      conn->fread = (curl_read_callback)Curl_FormReader;
+      conn->fread_func = (curl_read_callback)Curl_FormReader;
       conn->fread_in = &http->form;
 
       http->sending = HTTPSEND_BODY;
@@ -2443,7 +2443,7 @@
 
           http->sending = HTTPSEND_BODY;
 
-          conn->fread = (curl_read_callback)readmoredata;
+          conn->fread_func = (curl_read_callback)readmoredata;
           conn->fread_in = (void *)conn;
 
           /* set the upload size to the progress meter */
diff -Naur curl.orig/lib/inet_ntop.c curl/lib/inet_ntop.c
--- curl.orig/lib/inet_ntop.c	2007-02-26 05:24:26.000000000 +0100
+++ curl/lib/inet_ntop.c	2007-06-12 16:51:16.543945200 +0200
@@ -69,7 +69,12 @@
   return (char *)memmove(dst, ptr, strlen(ptr)+1);
 
 #elif defined(HAVE_INET_NTOA_R)
+
+#if defined(HAVE_INT_INET_NTOA_R)
+  return inet_ntoa_r(*(struct in_addr*)src, dst, size)? NULL: dst;
+#else
   return inet_ntoa_r(*(struct in_addr*)src, dst, size);
+#endif
 
 #else
   const char *addr = inet_ntoa(*(struct in_addr*)src);
diff -Naur curl.orig/lib/makefile-os400.sh curl/lib/makefile-os400.sh
--- curl.orig/lib/makefile-os400.sh	1970-01-01 01:00:00.000000000 +0100
+++ curl/lib/makefile-os400.sh	2007-06-12 17:04:37.672894600 +0200
@@ -0,0 +1,211 @@
+#!/bin/sh
+#
+#       libcurl compilation script for the OS/400.
+#
+#       This is a shell script since make is not a standard component of OS/400.
+
+#       Define your environment.
+
+TARGETLIB=CURL                  # Target OS/400 program library
+STATBNDDIR=CURL_A               # Static binding directory.
+DYNBNDDIR=CURL                  # Dynamic binding directory.
+SRVPGM=CURL                     # Service program.
+TGTCCSID=500                    # Target CCSID of objects
+DEBUG=*ALL                      # Debug level
+OPTIMIZE=10                     # Optimisation level
+OUTPUTC=*NONE                   # Compilation output option.
+TGTRLS=V5R1M0                   # Target OS release
+
+LIBIFSNAME="/QSYS.LIB/${TARGETLIB}.LIB"
+
+
+action_needed()
+
+{
+        [ ! -e "${1}" ] && return 0
+        [ "${2}" ] || return 1
+        [ "${1}" -ot "${2}" ] && return 0
+        return 1
+}
+
+
+make_module()
+
+{
+        #       Compile an IFS C source file into an object 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 '#pragma convert(819)' > __tmpsrcf.c
+        cat "${2}" >> __tmpsrcf.c
+        CMD="CRTCMOD MODULE(${TARGETLIB}/${1}) SRCSTMF('__tmpsrcf.c')"
+#       CMD="${CMD} SYSIFCOPT(*IFSIO) OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)"
+        CMD="${CMD} SYSIFCOPT(*IFSIO) OPTION(*INCDIRFIRST)"
+        CMD="${CMD} INCDIR('/qibm/proddata/qadrt/include' '../include' '.')"
+        CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})"
+        CMD="${CMD} OUTPUT(${OUTPUTC})"
+        CMD="${CMD} OPTIMIZE(${OPTIMIZE})"
+        CMD="${CMD} DBGVIEW(${DEBUG})"
+        system "${CMD}"
+        rm -f __tmpsrcf.c
+        LINK=YES
+}
+
+
+#       Create the OS/400 library if it does not exist.
+
+if action_needed "${LIBIFSNAME}"
+then    system "CRTLIB LIB($TARGETLIB) TEXT('Multiprotocol support API')"
+fi
+
+
+#       No ca-bundle yet.
+
+if action_needed "ca-bundle.h"
+then    echo "/* This file is generated automatically */" > ca-bundle.h
+        echo "#ifndef CURL_CA_BUNDLE" >> ca-bundle.h
+
+        if [ "${CABUNDLE}" ]
+        then    echo '#define CURL_CA_BUNDLE @CURL_CA_BUNDLE@' >> ca-bundle.h
+        else    echo '#undef CURL_CA_BUNDLE /* unknown */' >> ca-bundle.h
+        fi
+
+        echo "#endif" >> ca-bundle.h
+fi
+
+
+#      Create and compile the identification source file.
+
+echo '#pragma comment(user, "libcurl version 7.16.3-CVS")' > os400.c
+echo '#pragma comment(date)' >> os400.c
+echo '#pragma comment(copyright, "Copyright (C) 1998-2007 Daniel Stenberg et al.")' >> 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.
+
+make_module     OS400SYS        os400sys.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('Build tools')"
+        system "${CMD}"
+fi
+
+
+#       Create the service program exportation file in DB2 member if needed.
+
+BSF="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR"
+
+if action_needed "${BSF}"
+then    LINK=YES
+fi
+
+if [ "${LINK}" ]
+then    echo " STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('LIBCURL')" > "${BSF}"
+        while read EXPORT
+        do      EXPORT=`echo "${EXPORT}" | sed -e 's/#.*//' -e 's/[ 	,]//'`
+
+                if [ "${EXPORT}" ]
+                then    echo ' EXPORT    SYMBOL("'"${EXPORT}"'")' >> "${BSF}"
+                fi
+        done < libcurl.imp
+
+        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)"
+        CMD="${CMD} TEXT('LibCurl 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
diff -Naur curl.orig/lib/os400sys.c curl/lib/os400sys.c
--- curl.orig/lib/os400sys.c	1970-01-01 01:00:00.000000000 +0100
+++ curl/lib/os400sys.c	2007-06-12 12:57:07.392635100 +0200
@@ -0,0 +1,136 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, 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.
+ *
+ ***************************************************************************/
+
+/* OS/400 additional support. */
+
+#include <sys/socket.h>
+
+#include <stdlib.h>
+#include <netdb.h>
+#include <qadrt.h>
+
+
+/**
+***     OS/400 defines procedures getaddrinfo() and getnameinfo(), but
+***             these are not implemented in the ASCII runtime. We provide
+***             here wrappers for these.
+**/
+
+
+int
+curl_getnameinfo_a(const struct sockaddr * sa, socklen_t salen,
+              char * nodename, socklen_t nodenamelen, 
+              char * servname, socklen_t servnamelen, 
+              int flags)
+
+{
+  char * enodename;
+  char * eservname;
+  int status;
+  int i;
+
+  enodename = (char *) NULL;
+  eservname = (char *) NULL;
+
+  if (nodename && nodenamelen)
+    if (!(enodename = malloc(nodenamelen)))
+      return EAI_MEMORY;
+
+  if (servname && servnamelen)
+    if (!(eservname = malloc(servnamelen))) {
+      if (enodename)
+        free(enodename);
+
+      return EAI_MEMORY;
+      }
+
+  status = getnameinfo(sa, salen, enodename, nodenamelen,
+                       eservname, servnamelen, flags);
+
+  if (!status) {
+    if (enodename) {
+      i = strlen(enodename) + 1;
+      QadrtConvertE2A(nodename, enodename, nodenamelen, i);
+      }
+
+    if (eservname) {
+      i = strlen(eservname) + 1;
+      QadrtConvertE2A(servname, eservname, servnamelen, i);
+      }
+    }
+
+  if (enodename)
+    free(enodename);
+
+  if (eservname)
+    free(eservname);
+
+  return status;
+}
+
+
+int
+curl_getaddrinfo_a(const char * nodename, const char * servname, 
+            const struct addrinfo * hints,
+            struct addrinfo * * res)
+
+{
+  char * enodename;
+  char * eservname;
+  int status;
+  int i;
+
+  enodename = (char *) NULL;
+  eservname = (char *) NULL;
+
+  if (nodename) {
+    i = strlen(nodename) + 1;
+
+    if (!(enodename = malloc(i)))
+      return EAI_MEMORY;
+
+    QadrtConvertA2E(enodename, nodename, i, i);
+    }
+
+  if (servname) {
+    i = strlen(servname) + 1;
+
+    if (!(eservname = malloc(i))) {
+      if (enodename)
+        free(enodename);
+
+      return EAI_MEMORY;
+      }
+
+    QadrtConvertA2E(eservname, servname, i, i);
+    }
+
+  status = getaddrinfo(enodename, eservname, hints, res);
+
+  if (enodename)
+    free(enodename);
+
+  if (eservname)
+    free(eservname);
+
+  return status;
+}
diff -Naur curl.orig/lib/sendf.c curl/lib/sendf.c
--- curl.orig/lib/sendf.c	2007-05-02 13:14:55.000000000 +0200
+++ curl/lib/sendf.c	2007-06-12 12:58:09.311339700 +0200
@@ -416,7 +416,7 @@
     /* If the previous block of data ended with CR and this block of data is
        just a NL, then the length might be zero */
     if (len) {
-      wrote = data->set.fwrite(ptr, 1, len, data->set.out);
+      wrote = data->set.fwrite_func(ptr, 1, len, data->set.out);
     }
     else {
       wrote = len;
@@ -435,7 +435,7 @@
      * header callback function (added after version 7.7.1).
      */
     curl_write_callback writeit=
-      data->set.fwrite_header?data->set.fwrite_header:data->set.fwrite;
+      data->set.fwrite_header?data->set.fwrite_header:data->set.fwrite_func;
 
     /* Note: The header is in the host encoding
        regardless of the ftp transfer mode (ASCII/Image) */
diff -Naur curl.orig/lib/setup.h curl/lib/setup.h
--- curl.orig/lib/setup.h	2007-05-17 08:04:44.000000000 +0200
+++ curl/lib/setup.h	2007-06-12 12:59:02.027390500 +0200
@@ -67,6 +67,10 @@
 #include "amigaos.h"
 #endif
 
+#ifdef __OS400__
+#include "config-os400.h"
+#endif
+
 #ifdef TPF
 #include "config-tpf.h" /* hand-modified TPF config.h */
 /* change which select is used for libcurl */
diff -Naur curl.orig/lib/transfer.c curl/lib/transfer.c
--- curl.orig/lib/transfer.c	2007-05-24 23:11:00.000000000 +0200
+++ curl/lib/transfer.c	2007-06-12 13:01:09.114161400 +0200
@@ -127,7 +127,7 @@
 
   /* this function returns a size_t, so we typecast to int to prevent warnings
      with picky compilers */
-  nread = (int)conn->fread(data->reqdata.upload_fromhere, 1,
+  nread = (int)conn->fread_func(data->reqdata.upload_fromhere, 1,
                            buffersize, conn->fread_in);
 
   if(nread == CURL_READFUNC_ABORT) {
@@ -237,10 +237,10 @@
      (data->set.httpreq == HTTPREQ_POST_FORM))
     ; /* do nothing */
   else {
-    if(data->set.ioctl) {
+    if(data->set.ioctl_func) {
       curlioerr err;
 
-      err = (data->set.ioctl) (data, CURLIOCMD_RESTARTREAD,
+      err = (data->set.ioctl_func) (data, CURLIOCMD_RESTARTREAD,
                             data->set.ioctl_client);
       infof(data, "the ioctl callback returned %d\n", (int)err);
 
@@ -254,7 +254,7 @@
       /* If no CURLOPT_READFUNCTION is used, we know that we operate on a
          given FILE * stream and we can actually attempt to rewind that
          ourself with fseek() */
-      if(data->set.fread == (curl_read_callback)fread) {
+      if(data->set.fread_func == (curl_read_callback)fread) {
         if(-1 != fseek(data->set.in, 0, SEEK_SET))
           /* successful rewind */
           return CURLE_OK;
diff -Naur curl.orig/lib/url.c curl/lib/url.c
--- curl.orig/lib/url.c	2007-06-05 15:41:50.000000000 +0200
+++ curl/lib/url.c	2007-06-12 16:49:26.717226000 +0200
@@ -60,7 +60,7 @@
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
-#if HAVE_SIGNAL_H
+#ifdef HAVE_SIGNAL_H
 #include <signal.h>
 #endif
 
@@ -546,10 +546,10 @@
     data->set.err  = stderr;  /* default stderr to stderr */
 
     /* use fwrite as default function to store output */
-    data->set.fwrite = (curl_write_callback)fwrite;
+    data->set.fwrite_func = (curl_write_callback)fwrite;
 
     /* use fread as default function to read input */
-    data->set.fread = (curl_read_callback)fread;
+    data->set.fread_func = (curl_read_callback)fread;
 
     /* conversion callbacks for non-ASCII hosts */
     data->set.convfromnetwork = (curl_conv_callback)ZERO_NULL;
@@ -1378,19 +1378,19 @@
     /*
      * Set data write callback
      */
-    data->set.fwrite = va_arg(param, curl_write_callback);
-    if(!data->set.fwrite)
+    data->set.fwrite_func = va_arg(param, curl_write_callback);
+    if(!data->set.fwrite_func)
       /* When set to NULL, reset to our internal default function */
-      data->set.fwrite = (curl_write_callback)fwrite;
+      data->set.fwrite_func = (curl_write_callback)fwrite;
     break;
   case CURLOPT_READFUNCTION:
     /*
      * Read data callback
      */
-    data->set.fread = va_arg(param, curl_read_callback);
-    if(!data->set.fread)
+    data->set.fread_func = va_arg(param, curl_read_callback);
+    if(!data->set.fread_func)
       /* When set to NULL, reset to our internal default function */
-      data->set.fread = (curl_read_callback)fread;
+      data->set.fread_func = (curl_read_callback)fread;
     break;
   case CURLOPT_CONV_FROM_NETWORK_FUNCTION:
     /*
@@ -1414,7 +1414,7 @@
     /*
      * I/O control callback. Might be NULL.
      */
-    data->set.ioctl = va_arg(param, curl_ioctl_callback);
+    data->set.ioctl_func = va_arg(param, curl_ioctl_callback);
     break;
   case CURLOPT_IOCTLDATA:
     /*
@@ -3840,7 +3840,7 @@
    *
    * Inherit the proper values from the urldata struct AFTER we have arranged
    * the persistent connection stuff */
-  conn->fread = data->set.fread;
+  conn->fread_func = data->set.fread_func;
   conn->fread_in = data->set.in;
 
   if ((conn->protocol&PROT_HTTP) &&
diff -Naur curl.orig/lib/urldata.h curl/lib/urldata.h
--- curl.orig/lib/urldata.h	2007-06-12 14:44:37.727979300 +0200
+++ curl/lib/urldata.h	2007-06-12 14:44:55.039825500 +0200
@@ -287,7 +287,7 @@
   struct Curl_chunker chunk;
 
   struct back {
-    curl_read_callback fread; /* backup storage for fread pointer */
+    curl_read_callback fread_func; /* backup storage for fread pointer */
     void *fread_in;           /* backup storage for fread_in pointer */
     char *postdata;
     curl_off_t postsize;
@@ -911,7 +911,7 @@
   /*************** Request - specific items ************/
 
   /* previously this was in the urldata struct */
-  curl_read_callback fread; /* function that reads the input */
+  curl_read_callback fread_func; /* function that reads the input */
   void *fread_in;           /* pointer to pass to the fread() above */
 
   struct ntlmdata ntlm;     /* NTLM differs from other authentication schemes
@@ -1214,12 +1214,12 @@
   unsigned short localport; /* local port number to bind to */
   int localportrange; /* number of additional port numbers to test in case the
                          'localport' one can't be bind()ed */
-  curl_write_callback fwrite;        /* function that stores the output */
+  curl_write_callback fwrite_func;   /* function that stores the output */
   curl_write_callback fwrite_header; /* function that stores headers */
-  curl_read_callback fread;          /* function that reads the input */
+  curl_read_callback fread_func;     /* function that reads the input */
   curl_progress_callback fprogress;  /* function for progress information */
   curl_debug_callback fdebug;      /* function that write informational data */
-  curl_ioctl_callback ioctl;       /* function for I/O control */
+  curl_ioctl_callback ioctl_func;  /* function for I/O control */
   curl_sockopt_callback fsockopt;  /* function for setting socket options */
   void *sockopt_client; /* pointer to pass to the socket options callback */
 
diff -Naur curl.orig/tests/libtest/makefile-os400.sh curl/tests/libtest/makefile-os400.sh
--- curl.orig/tests/libtest/makefile-os400.sh	1970-01-01 01:00:00.000000000 +0100
+++ curl/tests/libtest/makefile-os400.sh	2007-06-12 14:43:55.790747700 +0200
@@ -0,0 +1,123 @@
+#!/bin/sh
+#
+#       libtest compilation script for the OS/400.
+#
+#       This is a shell script since make is not a standard component of OS/400.
+
+#       Define your environment.
+
+TARGETLIB=CURL                  # Target OS/400 program library
+STATBNDDIR=CURL_A               # Static binding directory.
+DYNBNDDIR=CURL                  # Dynamic binding directory.
+SRVPGM=CURL                     # Service program.
+TGTCCSID=500                    # Target CCSID of objects
+DEBUG=*ALL                      # Debug level
+OPTIMIZE=10                     # Optimisation level
+OUTPUTC=*NONE                   # Compilation output option.
+TGTRLS=V5R1M0                   # Target OS release
+
+
+LIBIFSNAME="/QSYS.LIB/${TARGETLIB}.LIB"
+
+
+action_needed()
+
+{
+        [ ! -e "${1}" ] && return 0
+        [ "${2}" ] || return 1
+        [ "${1}" -ot "${2}" ] && return 0
+        return 1
+}
+
+
+make_module()
+
+{
+        #       Compile an IFS C source file into an object module.
+
+        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 '#pragma convert(819)' > __tmpsrcf.c
+	cat "${2}" >> __tmpsrcf.c
+        CMD="CRTCMOD MODULE(${TARGETLIB}/${1}) SRCSTMF('__tmpsrcf.c')"
+#       CMD="${CMD} SYSIFCOPT(*IFSIO) OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)"
+        CMD="${CMD} SYSIFCOPT(*IFSIO) OPTION(*INCDIRFIRST)"
+        CMD="${CMD} INCDIR('/qibm/proddata/qadrt/include' '../../include/curl'"
+        CMD="${CMD} '.' '../../lib')"
+        CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})"
+        CMD="${CMD} OUTPUT(${OUTPUTC})"
+        CMD="${CMD} OPTIMIZE(${OPTIMIZE})"
+        CMD="${CMD} DBGVIEW(${DEBUG})"
+
+	if [ "${4}" ]
+	then	CMD="${CMD} DEFINE(${4})"
+	fi
+
+        system "${CMD}"
+	rm -f __tmpsrcf.c
+        LINK=YES
+}
+
+
+make_program()
+
+{
+	make_module "${1}" "${2}" "${4}"
+        MODIFSNAME="${LIBIFSNAME}/${1}.MODULE"
+        PGMIFSNAME="${LIBIFSNAME}/${1}.PGM"
+	action_needed "${PGMIFSNAME}" "${MODIFSNAME}" || return 0
+	CMD="CRTPGM PGM(${TARGETLIB}/${1}) ENTMOD(QADRT/QADRTMAIN2)"
+	CMD="${CMD} MODULE(${TARGETLIB}/${1} ${TARGETLIB}/FIRST ${3})"
+	CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)"
+	CMD="${CMD} TGTRLS(${TGTRLS})"
+	system "${CMD}"
+}
+
+
+#       Compile the multi-usage modules.
+
+make_module     FIRST           first.c
+make_module     TESTUTIL        testutil.c
+
+#	Build the test programs.
+
+make_program    LIB500	lib500.c
+make_program    LIB501  lib501.c
+make_program    LIB502  lib502.c	"${TARGETLIB}/TESTUTIL"
+make_program    LIB503  lib503.c	"${TARGETLIB}/TESTUTIL"
+make_program    LIB504  lib504.c	"${TARGETLIB}/TESTUTIL"
+make_program    LIB505  lib505.c
+make_program    LIB506  lib506.c
+make_program    LIB507  lib507.c	"${TARGETLIB}/TESTUTIL"
+make_program    LIB508  lib508.c
+make_program    LIB509  lib509.c	"${TARGETLIB}/TESTUTIL"
+make_program    LIB510  lib510.c
+make_program    LIB511  lib511.c
+make_program    LIB512  lib512.c
+make_program    LIB513  lib513.c
+make_program    LIB514  lib514.c
+make_program    LIB515  lib515.c
+make_program    LIB516  lib516.c
+make_program    LIB517  lib517.c
+make_program    LIB518  lib518.c
+make_program    LIB519  lib519.c
+make_program    LIB520  lib520.c
+make_program    LIB521  lib521.c
+make_program    LIB523  lib523.c
+make_program    LIB524  lib524.c
+make_program    LIB525  lib525.c	"${TARGETLIB}/TESTUTIL"
+make_program    LIB526  lib526.c	"${TARGETLIB}/TESTUTIL"		LIB526
+make_program    LIB527  lib526.c	"${TARGETLIB}/TESTUTIL"		LIB527
+make_program    LIB529  lib525.c	"${TARGETLIB}/TESTUTIL"		LIB529
+make_program    LIB530  lib530.c	"${TARGETLIB}/TESTUTIL"		LIB530
+make_program    LIB532  lib526.c	"${TARGETLIB}/TESTUTIL"		LIB532
+make_program    LIB533  lib533.c	"${TARGETLIB}/TESTUTIL"
+make_program    LIB536  lib536.c	"${TARGETLIB}/TESTUTIL"
+make_program    LIB537  lib537.c
