From d5043133e63290e0abedc34ddd1889bbd4bb953e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 21 May 2003 08:08:48 +0000 Subject: Gisle Vanem made curl build with djgpp on DOS. --- CHANGES | 10 +++ Makefile.dist | 4 ++ docs/examples/Makefile.am | 2 +- docs/examples/makefile.dj | 31 +++++++++ lib/Makefile.am | 3 +- lib/config.dj | 92 +++++++++++++++++++++++++++ lib/getpass.c | 6 +- lib/makefile.dj | 157 ++++++++++++++++++++++++++++++++++++++++++++++ lib/setup.h | 17 ++++- lib/url.c | 27 ++++++++ lib/urldata.h | 2 + packages/DOS/Makefile.am | 1 + packages/DOS/README | 4 ++ packages/DOS/common.dj | 56 +++++++++++++++++ packages/Makefile.am | 2 +- src/Makefile.am | 2 +- src/main.c | 6 ++ src/makefile.dj | 48 ++++++++++++++ src/setup.h | 13 ++-- 19 files changed, 469 insertions(+), 14 deletions(-) create mode 100644 docs/examples/makefile.dj create mode 100644 lib/config.dj create mode 100644 lib/makefile.dj create mode 100644 packages/DOS/Makefile.am create mode 100644 packages/DOS/README create mode 100644 packages/DOS/common.dj create mode 100644 src/makefile.dj diff --git a/CHANGES b/CHANGES index c5bfa2355..c43d94a58 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,16 @@ Changelog +Daniel (21 May) +- Gisle Vanem made curl build with djgpp on DOS. + +- Gisle Vanem improved the mkhelp.pl script to make a nicer manual that is + shown with curl -M. + +Daniel (20 May) +- Gisle Vanem provided a fix that makes libcurl more conservative, not + expecting h_aliases of the hostent struct to always be non-NULL. + Daniel (19 May) - As requested by Martin Michlmayr in Debian bug report #193630, libcurl now supports user name and password in the proxy environment variables. Added diff --git a/Makefile.dist b/Makefile.dist index 03948ea24..31b843539 100644 --- a/Makefile.dist +++ b/Makefile.dist @@ -59,6 +59,10 @@ vc-ssl-dll: cd ..\src nmake -f Makefile.vc6 +djgpp: + make -C lib -f Makefile.dj + make -C src -f Makefile.dj + cygwin: ./configure make diff --git a/docs/examples/Makefile.am b/docs/examples/Makefile.am index b2ddad406..c21d00bdf 100644 --- a/docs/examples/Makefile.am +++ b/docs/examples/Makefile.am @@ -9,7 +9,7 @@ EXTRA_DIST = README curlgtk.c sepheaders.c simple.c postit2.c \ multithread.c getinmemory.c ftpupload.c httpput.c \ simplessl.c ftpgetresp.c http-post.c post-callback.c \ multi-app.c multi-double.c multi-single.c multi-post.c \ - fopen.c simplepost.c + fopen.c simplepost.c makefile.dj all: @echo "done" diff --git a/docs/examples/makefile.dj b/docs/examples/makefile.dj new file mode 100644 index 000000000..6b3cb9d39 --- /dev/null +++ b/docs/examples/makefile.dj @@ -0,0 +1,31 @@ +# +# Adapted for djgpp / Watt-32 / DOS by +# Gisle Vanem +# + +include ../../packages/DOS/common.dj + +CFLAGS += -I../../include + +LIBS = ../../lib/libcurl.a + +ifeq ($(USE_SSL),1) + LIBS += $(OPENSSL_ROOT)/lib/libssl.a $(OPENSSL_ROOT)/lib/libcrypt.a +endif + +LIBS += $(WATT32_ROOT)/lib/libwatt.a $(ZLIB_ROOT)/libz.a + +PROGRAMS = fopen.exe ftpget.exe ftpgetre.exe ftpuploa.exe getinmem.exe \ + http-pos.exe httpput.exe multi-ap.exe multi-do.exe \ + multi-po.exe multi-si.exe persista.exe post-cal.exe \ + postit2.exe sepheade.exe simple.exe simpless.exe + +all: $(PROGRAMS) + +.c.exe: + $(CC) $(CFLAGS) -o $@ $^ $(LIBS) + @echo + +clean: + rm -f $(PROGRAMS) + diff --git a/lib/Makefile.am b/lib/Makefile.am index 342a29c46..62c5c55d9 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -7,7 +7,8 @@ AUTOMAKE_OPTIONS = foreign nostdinc EXTRA_DIST = getdate.y Makefile.b32 Makefile.b32.resp Makefile.m32 \ Makefile.vc6 Makefile.riscos libcurl.def curllib.dsp \ curllib.dsw config-vms.h config-win32.h config-riscos.h config-mac.h \ - config.h.in ca-bundle.crt README.encoding README.memoryleak + config.h.in ca-bundle.crt README.encoding README.memoryleak \ + makefile.dj config.dj lib_LTLIBRARIES = libcurl.la diff --git a/lib/config.dj b/lib/config.dj new file mode 100644 index 000000000..6fd92a636 --- /dev/null +++ b/lib/config.dj @@ -0,0 +1,92 @@ +#ifndef _CURL_CONFIG_DJGPP_H +#define _CURL_CONFIG_DJGPP_H + +#define OS "djgpp" +#define PACKAGE "curl" + +#define CURL_CA_BUNDLE "/dev/env/CURL_CA_BUNDLE" + +#if (DJGPP_MINOR >= 4) +/* #define HAVE_DLOPEN 1 maybe not (DXE3) */ +#endif + +#if 1 /* use ioctlsocket() via fsext'ed fcntl() */ + #define HAVE_O_NONBLOCK 1 +#else + #define HAVE_IOCTLSOCKET 1 +#endif + +#define HAVE_ALARM 1 +#define HAVE_ARPA_INET_H 1 +#define HAVE_CLOSESOCKET 1 +#define HAVE_FCNTL_H 1 +#define HAVE_GETHOSTBYADDR 1 +#define HAVE_GETHOSTNAME 1 +#define HAVE_GETPASS 1 +#define HAVE_GETSERVBYNAME 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_INET_ADDR 1 +#define HAVE_INET_NTOA 1 +#define HAVE_IO_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_NETDB_H 1 +#define HAVE_NETINET_IN_H 1 +#define HAVE_NET_IF_H 1 +#define HAVE_PERROR 1 +#define HAVE_SELECT 1 +#define HAVE_SETJMP_H 1 +#define HAVE_SETVBUF 1 +#define HAVE_SIGNAL 1 +#define HAVE_SIGACTION 1 +#define HAVE_SIGSETJMP 1 +#define HAVE_SOCKET 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRDUP 1 +#define HAVE_STRFTIME 1 +#define HAVE_STRICMP 1 +#define HAVE_STRSTR 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_TERMIOS_H 1 +#define HAVE_TIME_H 1 +#define HAVE_UNAME 1 +#define HAVE_UNISTD_H 1 +#define HAVE_VPRINTF 1 + +#define RETSIGTYPE void +#define SIZEOF_LONG_DOUBLE 16 +#define SIZEOF_LONG_LONG 8 +#define STDC_HEADERS 1 +#define TIME_WITH_SYS_TIME 1 + +#define BSD +#define USE_ZLIB + +/* #define MALLOCDEBUG */ + +#ifdef HAVE_OPENSSL_ENGINE_H /* on cmd-line */ + #define HAVE_OPENSSL_X509_H 1 + #define HAVE_OPENSSL_SSL_H 1 + #define HAVE_OPENSSL_RSA_H 1 + #define HAVE_OPENSSL_PEM_H 1 + #define HAVE_OPENSSL_ERR_H 1 + #define HAVE_OPENSSL_CRYPTO_H 1 + #define HAVE_LIBSSL 1 + #define HAVE_LIBCRYPTO 1 + #define OPENSSL_NO_KRB5 1 +#endif + +#define in_addr_t u_long +#define socklen_t int +#define ssize_t int + +#include +#include +#include /* Watt-32 API */ + +#undef word + +#endif /* _CURL_CONFIG_DJGPP_H */ + diff --git a/lib/getpass.c b/lib/getpass.c index 118579e69..b6ea97805 100644 --- a/lib/getpass.c +++ b/lib/getpass.c @@ -99,7 +99,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen) char infp_fclose = 0; FILE *outfp; RETSIGTYPE (*sigint)(); -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__DJGPP__) RETSIGTYPE (*sigtstp)(); #endif size_t bytes_read; @@ -119,7 +119,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen) sigint = signal(SIGINT, SIG_IGN); /* 20000318 mgs * this is needed by the emx system, SIGTSTP is not a supported signal */ -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__DJGPP__) sigtstp = signal(SIGTSTP, SIG_IGN); #endif @@ -181,7 +181,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen) #endif signal(SIGINT, sigint); -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__DJGPP__) signal(SIGTSTP, sigtstp); #endif diff --git a/lib/makefile.dj b/lib/makefile.dj new file mode 100644 index 000000000..d3a9dc40c --- /dev/null +++ b/lib/makefile.dj @@ -0,0 +1,157 @@ +# +# Adapted for djgpp2 / Watt-32 / DOS by +# Gisle Vanem +# + +DEPEND_PREREQ = config.h getdate.c + +include ../packages/DOS/common.dj + +ifeq ($(USE_SSL),1) + CFLAGS += -I$(OPENSSL_ROOT) +endif + +SOURCES = base64.c connect.c content_.c cookie.c dict.c \ + easy.c escape.c file.c formdata.c ftp.c \ + getdate.c getenv.c getinfo.c getpass.c hash.c \ + hostip.c http.c http_chu.c if2ip.c krb4.c \ + ldap.c llist.c memdebug.c mprintf.c multi.c \ + netrc.c progress.c security.c sendf.c share.c \ + speedche.c ssluse.c strequal.c strtok.c telnet.c \ + timeval.c transfer.c url.c version.c + +OBJECTS = $(SOURCES:.c=.o) +CURL_LIB = libcurl.a + +all: config.h $(CURL_LIB) + +$(CURL_LIB): $(OBJECTS) + ar rs $@ $? + +config.h: config.dj + @echo '#include "./config.dj"' > $@ + +getdate.c: getdate.y + $(YACC) -o $@ $^ + +clean: + - rm -f $(OBJECTS) $(CURL_LIB) Makefile.bak config.h getdate.c + +# DO NOT DELETE THIS LINE +base64.o: base64.c setup.h config.h config.dj ../include/curl/mprintf.h \ + base64.h +connect.o: connect.c setup.h config.h config.dj urldata.h cookie.h \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \ + hash.h llist.h sendf.h if2ip.h +content_.o: content_.c setup.h config.h config.dj +cookie.o: cookie.c setup.h config.h config.dj cookie.h \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h getdate.h strequal.h strtok.h +dict.o: dict.c setup.h config.h config.dj urldata.h cookie.h \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \ + hash.h llist.h transfer.h sendf.h progress.h strequal.h \ + ../include/curl/mprintf.h +easy.o: easy.c setup.h config.h config.dj strequal.h urldata.h cookie.h \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \ + hash.h llist.h transfer.h ssluse.h url.h getinfo.h \ + ../include/curl/mprintf.h +escape.o: escape.c setup.h config.h config.dj ../include/curl/curl.h \ + ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h +file.o: file.c setup.h config.h config.dj urldata.h cookie.h \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \ + hash.h llist.h progress.h sendf.h escape.h ../include/curl/mprintf.h +formdata.o: formdata.c setup.h config.h config.dj ../include/curl/curl.h \ + ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \ + formdata.h strequal.h +ftp.o: ftp.c setup.h config.h config.dj ../include/curl/curl.h \ + ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \ + urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \ + llist.h sendf.h if2ip.h progress.h transfer.h escape.h http.h ftp.h \ + strequal.h ssluse.h connect.h ../include/curl/mprintf.h +getdate.o: getdate.c setup.h config.h config.dj getdate.h +getenv.o: getenv.c setup.h config.h config.dj +getinfo.o: getinfo.c setup.h config.h config.dj ../include/curl/curl.h \ + ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \ + urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \ + llist.h +getpass.o: getpass.c setup.h config.h config.dj +hash.o: hash.c setup.h config.h config.dj hash.h llist.h +hostip.o: hostip.c setup.h config.h config.dj urldata.h cookie.h \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \ + hash.h llist.h sendf.h share.h ../include/curl/mprintf.h +http.o: http.c setup.h config.h config.dj urldata.h cookie.h \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \ + hash.h llist.h transfer.h sendf.h progress.h base64.h strequal.h \ + ssluse.h ../include/curl/mprintf.h +http_chu.o: http_chu.c setup.h config.h config.dj urldata.h cookie.h \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \ + hash.h llist.h sendf.h content_encoding.h ../include/curl/mprintf.h +if2ip.o: if2ip.c setup.h config.h config.dj +krb4.o: krb4.c setup.h config.h config.dj +ldap.o: ldap.c setup.h config.h config.dj urldata.h cookie.h \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \ + hash.h llist.h sendf.h escape.h transfer.h ../include/curl/mprintf.h +llist.o: llist.c setup.h config.h config.dj llist.h +memdebug.o: memdebug.c +mprintf.o: mprintf.c setup.h config.h config.dj +multi.o: multi.c setup.h config.h config.dj ../include/curl/curl.h \ + ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \ + urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \ + llist.h transfer.h url.h connect.h progress.h +netrc.o: netrc.c setup.h config.h config.dj ../include/curl/curl.h \ + ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \ + strequal.h strtok.h +progress.o: progress.c setup.h config.h config.dj ../include/curl/curl.h \ + ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \ + urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \ + llist.h sendf.h progress.h ../include/curl/mprintf.h +security.o: security.c setup.h config.h config.dj +sendf.o: sendf.c setup.h config.h config.dj ../include/curl/curl.h \ + ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \ + urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \ + llist.h sendf.h connect.h ../include/curl/mprintf.h +share.o: share.c setup.h config.h config.dj ../include/curl/curl.h \ + ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \ + urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \ + llist.h share.h +speedche.o: speedche.c setup.h config.h config.dj ../include/curl/curl.h \ + ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \ + urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \ + llist.h sendf.h speedcheck.h +ssluse.o: ssluse.c setup.h config.h config.dj urldata.h cookie.h \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \ + hash.h llist.h sendf.h url.h +strequal.o: strequal.c setup.h config.h config.dj +strtok.o: strtok.c setup.h config.h config.dj +telnet.o: telnet.c setup.h config.h config.dj urldata.h cookie.h \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \ + hash.h llist.h transfer.h sendf.h ../include/curl/mprintf.h \ + arpa_telnet.h +timeval.o: timeval.c timeval.h setup.h config.h config.dj +transfer.o: transfer.c setup.h config.h config.dj strequal.h urldata.h \ + cookie.h ../include/curl/curl.h ../include/curl/types.h \ + ../include/curl/easy.h ../include/curl/multi.h formdata.h timeval.h \ + http_chunks.h hostip.h hash.h llist.h netrc.h content_encoding.h \ + transfer.h sendf.h speedcheck.h getpass.h progress.h getdate.h http.h \ + url.h getinfo.h ssluse.h ../include/curl/mprintf.h +url.o: url.c setup.h config.h config.dj urldata.h cookie.h \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h formdata.h timeval.h http_chunks.h hostip.h \ + hash.h llist.h netrc.h base64.h ssluse.h if2ip.h transfer.h sendf.h \ + getpass.h progress.h strequal.h escape.h strtok.h share.h \ + content_encoding.h ftp.h dict.h telnet.h http.h file.h ldap.h url.h \ + connect.h ca-bundle.h ../include/curl/mprintf.h +version.o: version.c setup.h config.h config.dj ../include/curl/curl.h \ + ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \ + urldata.h cookie.h formdata.h timeval.h http_chunks.h hostip.h hash.h \ + llist.h diff --git a/lib/setup.h b/lib/setup.h index a1eb9392f..0a109111f 100644 --- a/lib/setup.h +++ b/lib/setup.h @@ -135,20 +135,33 @@ defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO) #define HAVE_ALARM #endif -#define PATH_CHAR ";" #define DIR_CHAR "\\" #define DOT_CHAR "_" #else + +#ifdef DJGPP +#define sclose(x) close_s(x) +#define sread(x,y,z) read_s(x,y,z) +#define swrite(x,y,z) write_s(x,y,z) +#define select(n,r,w,x,t) select_s(n,r,w,x,t) +#else + #define sclose(x) close(x) #define sread(x,y,z) recv(x,y,z,0) #define swrite(x,y,z) send(x,y,z,0) #define HAVE_ALARM -#define PATH_CHAR ":" +#endif + #define DIR_CHAR "/" #define DOT_CHAR "." +#ifdef DJGPP +#undef DOT_CHAR +#define DOT_CHAR "_" +#endif + #ifdef HAVE_STRCASECMP /* this is for "-ansi -Wall -pedantic" to stop complaining! */ extern int (strcasecmp)(const char *s1, const char *s2); diff --git a/lib/url.c b/lib/url.c index 64d4c2a2d..cc6b64748 100644 --- a/lib/url.c +++ b/lib/url.c @@ -2149,6 +2149,33 @@ static CURLcode CreateConnection(struct SessionHandle *data, if(proxy && *proxy) { /* we have a proxy here to set */ + char *ptr; + char user[MAX_CURL_USER_LENGTH]; + char passwd[MAX_CURL_PASSWORD_LENGTH]; + + /* skip the possible protocol piece */ + ptr=strstr(proxy, "://"); + if(ptr) + ptr += 3; + else + ptr = proxy; + + /* check for an @-letter */ + ptr = strchr(ptr, '@'); + if(ptr && (2 == sscanf(proxy, "%" MAX_CURL_USER_LENGTH_TXT"[^:]:" + "%" MAX_CURL_PASSWORD_LENGTH_TXT "[^@]", + user, passwd))) { + /* found user and password, rip them out */ + strcpy(data->state.proxyuser, user); + strcpy(data->state.proxypasswd, passwd); + conn->bits.proxy_user_passwd = TRUE; /* enable it */ + + ptr = strdup(ptr+1); + free(proxy); /* free the former data */ + proxy = ptr; /* now use this instead */ + } + + data->change.proxy = proxy; data->change.proxy_alloc=TRUE; /* this needs to be freed later */ conn->bits.httpproxy = TRUE; diff --git a/lib/urldata.h b/lib/urldata.h index 293fee984..efd73b2cf 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -564,6 +564,8 @@ typedef enum { * Session-data MUST be put in the connectdata struct and here. */ #define MAX_CURL_USER_LENGTH 256 #define MAX_CURL_PASSWORD_LENGTH 256 +#define MAX_CURL_USER_LENGTH_TXT "255" +#define MAX_CURL_PASSWORD_LENGTH_TXT "255" struct UrlState { enum { diff --git a/packages/DOS/Makefile.am b/packages/DOS/Makefile.am new file mode 100644 index 000000000..70313cb00 --- /dev/null +++ b/packages/DOS/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = README common.dj diff --git a/packages/DOS/README b/packages/DOS/README new file mode 100644 index 000000000..403c0ddd2 --- /dev/null +++ b/packages/DOS/README @@ -0,0 +1,4 @@ +Gisle Vanem made curl build fine on DOS (and MingW) with djgpp, OpenSSL and his +Watt-32 stack. + +'make djgpp' in the root curl dir should build it fine. diff --git a/packages/DOS/common.dj b/packages/DOS/common.dj new file mode 100644 index 000000000..32208f62a --- /dev/null +++ b/packages/DOS/common.dj @@ -0,0 +1,56 @@ +# +# Common defines for curl (djgpp/Watt-32) +# +# Assumes you've unpacked cURL with short-file names +# I.e use "set LFN=n" before untaring on Win9x/XP. +# Requires sed, yacc, rm and the usual stuff. +# + +.SUFFIXES: .exe .y + +MAKEFILE = Makefile.dj + +# +# OpenSSL is available from www.openssl.org and builds okay +# with djgpp/Watt-32. Set to 0 if you don't need https URLs +# (reduces curl.exe with approx 700 kB) +# +USE_SSL = 1 + +default: all + +# +# Root directory for Waterloo tcp/ip. WATT_ROOT should be set +# during Watt-32 install. +# +WATT32_ROOT = $(subst \,/,$(WATT_ROOT)) +OPENSSL_ROOT = /net/openssl.098 +ZLIB_ROOT = $(DJDIR)/contrib/zlib + +CC = gcc +YACC = bison -y + +CFLAGS = -g -O2 -I. -I../include -Wall -DHAVE_CONFIG_H + +ifeq ($(USE_SSL),1) + CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H +endif + +# +# Generated dependencies; Due to some hacks in gcc 2.95+ and djgpp 2.03 +# we must prevent "$(DJDIR)/bin/../include/sys/version.h" from beeing +# included in dependency output (or else this makefile cannot be used on +# another machine). We therefore use a special 'specs' file during +# pre-processing. +# +MM_SPECS = $(TMPDIR)/specs + +depend: $(DEPEND_PREREQ) + @echo Generating dependencies.. + @copy $(MAKEFILE) Makefile.bak + @echo "*cpp: %(cpp_cpu) %{posix:-D_POSIX_SOURCE} -remap" > $(MM_SPECS) + sed -e "/^# DO NOT DELETE THIS LINE/,$$d" < Makefile.bak > $(MAKEFILE) + echo "# DO NOT DELETE THIS LINE" >> $(MAKEFILE) + $(CC) -MM -specs=$(MM_SPECS) $(CFLAGS) $(SOURCES) >> $(MAKEFILE) + rm -f $(MM_SPECS) + diff --git a/packages/Makefile.am b/packages/Makefile.am index 7cbfb6da4..44076a858 100644 --- a/packages/Makefile.am +++ b/packages/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS = Win32 Linux Solaris EPM +SUBDIRS = Win32 Linux Solaris EPM DOS EXTRA_DIST = README diff --git a/src/Makefile.am b/src/Makefile.am index 82433a659..00c51afd6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,7 +24,7 @@ BUILT_SOURCES = hugehelp.c CLEANFILES = hugehelp.c NROFF=@NROFF@ -EXTRA_DIST = mkhelp.pl curlmsg.msg \ +EXTRA_DIST = mkhelp.pl curlmsg.msg makefile.dj \ Makefile.vc6 Makefile.b32 Makefile.m32 Makefile.riscos config.h.in \ macos/curl.mcp.xml.sit.hqx \ macos/MACINSTALL.TXT \ diff --git a/src/main.c b/src/main.c index 62348df3e..7a56882e6 100644 --- a/src/main.c +++ b/src/main.c @@ -411,6 +411,9 @@ static void help(void) " Overrides -n and --netrc-optional\n" " -U/--proxy-user Specify Proxy authentication\n" " -v/--verbose Makes the operation more talkative\n" +#ifdef DJGPP + " Also enables Watt-32 debugging\n" +#endif " -V/--version Outputs version number then quits"); puts(" -w/--write-out [format] What to output after completion\n" " -x/--proxy Use proxy. (Default port is 1080)\n" @@ -1670,6 +1673,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ cleanarg(nextarg); break; case 'v': +#ifdef DJGPP + dbug_init(); +#endif config->conf ^= CONF_VERBOSE; /* talk a lot */ break; case 'V': diff --git a/src/makefile.dj b/src/makefile.dj new file mode 100644 index 000000000..e84ba0284 --- /dev/null +++ b/src/makefile.dj @@ -0,0 +1,48 @@ +# +# Adapted for djgpp2 / Watt-32 / DOS by +# Gisle Vanem +# + +DEPEND_PREREQ = config.h + +include ../packages/DOS/common.dj + +ifeq ($(USE_SSL),1) + EX_LIBS = $(OPENSSL_ROOT)/lib/libssl.a $(OPENSSL_ROOT)/lib/libcrypt.a +endif + +EX_LIBS += $(WATT32_ROOT)/lib/libwatt.a $(ZLIB_ROOT)/libz.a + +BIN = ../curl.exe +SOURCES = hugehelp.c main.c urlglob.c writeenv.c writeout.c +OBJECTS = $(SOURCES:.c=.o) + +all: config.h $(BIN) + +$(BIN): $(OBJECTS) ../lib/libcurl.a + $(CC) -o $@ $^ $(EX_LIBS) + +config.h: + @echo '#include "../lib/config.dj"' > $@ + +hugehelp.c: ../docs/curl.1 + groff -man $^ | perl mkhelp.pl ../readme > $@ + +clean: + - rm -f $(OBJECTS) Makefile.bak config.h + +vclean: clean + - rm -f $(BIN) hugehelp.c + +# DO NOT DELETE THIS LINE +hugehelp.o: hugehelp.c +main.o: main.c setup.h config.h ../lib/config.dj ../include/curl/curl.h \ + ../include/curl/types.h ../include/curl/easy.h ../include/curl/multi.h \ + ../include/curl/mprintf.h urlglob.h writeout.h version.h +urlglob.o: urlglob.c setup.h config.h ../lib/config.dj \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h urlglob.h +writeenv.o: writeenv.c setup.h config.h ../lib/config.dj +writeout.o: writeout.c setup.h config.h ../lib/config.dj \ + ../include/curl/curl.h ../include/curl/types.h ../include/curl/easy.h \ + ../include/curl/multi.h ../include/curl/mprintf.h writeout.h diff --git a/src/setup.h b/src/setup.h index 65eef4b4a..c5ab80ed9 100644 --- a/src/setup.h +++ b/src/setup.h @@ -66,7 +66,6 @@ int fileno( FILE *stream); #endif #ifdef WIN32 -#define PATH_CHAR ";" #define DIR_CHAR "\\" #define DOT_CHAR "_" #else @@ -74,17 +73,21 @@ int fileno( FILE *stream); /* 20000318 mgs * OS/2 supports leading dots in filenames if the volume is formatted * with JFS or HPFS. */ -#define PATH_CHAR ";" #define DIR_CHAR "\\" #define DOT_CHAR "." #else -#define PATH_CHAR ":" +#ifdef DJGPP +#define DIR_CHAR "/" +#define DOT_CHAR "_" +#else + #define DIR_CHAR "/" #define DOT_CHAR "." -#endif -#endif +#endif /* !DJGPP */ +#endif /* !__EMX__ */ +#endif /* !WIN32 */ #ifdef __riscos__ #define USE_ENVIRONMENT -- cgit v1.2.3