From afdfa4bed24c9f937bc49807c6d547ac3a158525 Mon Sep 17 00:00:00 2001 From: Gunter Knauf Date: Sat, 30 Jun 2007 20:08:13 +0000 Subject: [PATCH] minor patches to enable building for NetWare CLIB. sent by Dmitry Mityugov. --- lib/connect.c | 7 +++++-- lib/hostip.h | 4 ++-- lib/hostip4.c | 5 +++++ lib/inet_ntop.c | 4 ++++ lib/timeval.c | 3 +++ src/curlutil.c | 3 +++ src/getpass.c | 20 ++++++++++++++++++++ src/main.c | 7 ++++++- 8 files changed, 48 insertions(+), 5 deletions(-) diff --git a/lib/connect.c b/lib/connect.c index 0aeaf79..8fbdd86 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -59,10 +59,13 @@ #include /* required for free() prototype, without it, this crashes */ #endif /* on macos 68K */ -#if (defined(HAVE_FIONBIO) && defined(__NOVELL_LIBC__)) +#if (defined(HAVE_FIONBIO) && defined(NETWARE)) #include #endif -#if (defined(NETWARE) && defined(__NOVELL_LIBC__)) +#ifdef NETWARE +#ifndef __NOVELL_LIBC__ +NETDB_DEFINE_CONTEXT +#endif #undef in_addr_t #define in_addr_t unsigned long #endif diff --git a/lib/hostip.h b/lib/hostip.h index e6d63ca..199c666 100644 --- a/lib/hostip.h +++ b/lib/hostip.h @@ -26,9 +26,9 @@ #include "setup.h" #include "hash.h" -#if (defined(NETWARE) && defined(__NOVELL_LIBC__)) +#ifdef NETWARE #undef in_addr_t -#define in_addr_t uint32_t +#define in_addr_t unsigned long #endif /* diff --git a/lib/hostip4.c b/lib/hostip4.c index d092d27..43b7c69 100644 --- a/lib/hostip4.c +++ b/lib/hostip4.c @@ -284,7 +284,12 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, * which the gethostbyname() is the preferred() function. */ else { +#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) + NETDB_DEFINE_CONTEXT + h = gethostbyname((char*)hostname); +#else h = gethostbyname(hostname); +#endif if (!h) infof(conn->data, "gethostbyname(2) failed for %s\n", hostname); #endif /*HAVE_GETHOSTBYNAME_R */ diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c index a05689a..e81cb5c 100644 --- a/lib/inet_ntop.c +++ b/lib/inet_ntop.c @@ -42,6 +42,10 @@ #include "inet_ntop.h" +#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) +NETINET_DEFINE_CONTEXT +#endif + #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL) /* this platform has a inet_ntoa_r() function, but no proto declared anywhere so we include our own proto to make compilers happy */ diff --git a/lib/timeval.c b/lib/timeval.c index bb9c0a1..a2e9665 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -68,6 +68,9 @@ static int gettimeofday(struct timeval *tp, void *nothing) } #else /* WIN32 */ /* non-win32 version of Curl_gettimeofday() */ +#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) +#include +#endif static int gettimeofday(struct timeval *tp, void *nothing) { (void)nothing; /* we don't support specific time-zones */ diff --git a/src/curlutil.c b/src/curlutil.c index 0394d80..2bb3f8e 100644 --- a/src/curlutil.c +++ b/src/curlutil.c @@ -70,6 +70,9 @@ static int gettimeofday(struct timeval *tp, void *nothing) } #else /* WIN32 */ /* non-win32 version of Curl_gettimeofday() */ +#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) +#include +#endif static int gettimeofday(struct timeval *tp, void *nothing) { (void)nothing; /* we don't support specific time-zones */ diff --git a/src/getpass.c b/src/getpass.c index 93b061f..244b29b 100644 --- a/src/getpass.c +++ b/src/getpass.c @@ -126,11 +126,31 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen) #ifdef NETWARE /* NetWare implementation */ +#ifdef __NOVELL_LIBC__ #include char *getpass_r(const char *prompt, char *buffer, size_t buflen) { return getpassword(prompt, buffer, buflen); } +#else +#include +char *getpass_r(const char *prompt, char *buffer, size_t buflen) +{ + int i = 0; + int c; + + printf("%s", prompt); + do { + c = getch(); + if (c != 13) { + buffer[i] = c; + i++; + printf("%s", "*"); + } + } while ((c != 13) && (i < buflen)); + return buffer; +} +#endif /* __NOVELL_LIBC__ */ #define DONE #endif /* NETWARE */ diff --git a/src/main.c b/src/main.c index 7161621..1869ce1 100644 --- a/src/main.c +++ b/src/main.c @@ -47,8 +47,13 @@ #define CURLseparator "--_curl_--" +#ifdef NETWARE #ifdef __NOVELL_LIBC__ #include +#else +#include +#define mkdir mkdir_510 +#endif #endif #include "version.h" @@ -731,7 +736,7 @@ static void help(void) }; for(i=0; helptext[i]; i++) { puts(helptext[i]); -#ifdef __NOVELL_LIBC__ +#ifdef NETWARE if (i && ((i % 23) == 0)) pressanykey(); #endif -- 2.7.4