From f3e634a8b280d1da57e7403bd275fe2b075f7676 Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Sat, 5 Sep 2009 11:27:52 -0700 Subject: [PATCH] Adjustments for MSDOS. --- msdos/ChangeLog | 12 +++++++ msdos/Makefile.DJ | 35 ++++++++++++------ msdos/Makefile.WC | 92 ++++++++++++++++++++++++++++++++++------------- msdos/config.h | 6 ++++ src/ChangeLog | 6 ++++ src/connect.c | 2 +- src/init.c | 2 +- src/main.c | 6 ++-- src/openssl.c | 2 +- src/options.h | 2 +- 10 files changed, 123 insertions(+), 42 deletions(-) diff --git a/msdos/ChangeLog b/msdos/ChangeLog index 77715cbf..b07b359b 100644 --- a/msdos/ChangeLog +++ b/msdos/ChangeLog @@ -1,3 +1,15 @@ +2009-09-05 Gisle Vanem + + * config.h: Added 'HAVE_ALLOCA_H' for Watcom 1.5+. Added + 'USE_WATT32' since all DOS-targets use the Watt-32 tcp/ip stack. + Added meaningless dummy LOCALEDIR. + + * Makefile.wc: A much needed update. Added rules for many files + in ./lib, css.c and version.c. + + * Makefile.dj: A much needed update. Added rules for css.c and + version.c. + 2008-01-25 Micah Cowan * config.h: Updated copyright year. diff --git a/msdos/Makefile.DJ b/msdos/Makefile.DJ index 9b25ae52..ef42f45f 100644 --- a/msdos/Makefile.DJ +++ b/msdos/Makefile.DJ @@ -1,13 +1,17 @@ # # GNU Makefile for wget / djgpp / MSDOS. -# By Gisle Vanem 2007. +# By Gisle Vanem 2009. # # `cd' to `./src' and issue the command: -# make -f ../msdos/Makefile.dj +# make -f ../msdos/Makefile.dj depend +# followed by: +# make -f ../msdos/Makefile.dj # +VERSION = 1.12 (djgpp/DOS) + .SUFFIXES: .exe -VPATH = ../lib +VPATH = ../lib ../md5 USE_OPENSSL = 0 USE_IPV6 = 1 @@ -20,8 +24,9 @@ ZLIB_ROOT = e:/djgpp/contrib/zlib OBJ_DIR = djgpp.obj CC = gcc -CFLAGS = -O2 -g -Wall -Wcast-align -I. -I../msdos -I../lib -I/dev/env/WATT_ROOT/inc \ - -DHAVE_CONFIG_H -DENABLE_DEBUG +CFLAGS = -O2 -g -Wall -Wcast-align -I. -I../msdos -I../lib -I../md5 \ + -I/dev/env/WATT_ROOT/inc -DHAVE_CONFIG_H -DENABLE_DEBUG \ + -DUSE_WATT32 # LDFLAGS = -s @@ -38,11 +43,13 @@ endif EX_LIBS += /dev/env/WATT_ROOT/lib/libwatt.a -SOURCES += cmpt.c connect.c cookies.c ftp.c ftp-basic.c ftp-ls.c \ +SOURCES += cmpt.c connect.c cookies.c exits.c ftp.c ftp-basic.c ftp-ls.c \ ftp-opie.c hash.c host.c html-parse.c html-url.c http.c \ init.c log.c main.c gen-md5.c netrc.c progress.c recur.c \ - res.c retr.c snprintf.c url.c utils.c version.c convert.c xmalloc.c \ - ptimer.c spider.c ../lib/getopt.c ../lib/getopt1.c ../lib/md5.c + res.c retr.c snprintf.c url.c utils.c version.c convert.c \ + ptimer.c spider.c css.c css-url.c build_info.c ../md5/md5.c \ + $(addprefix ../lib/, error.c exitfail.c quote.c \ + quotearg.c getopt.c getopt1.c xalloc-die.c xmalloc.c) OBJECTS = $(addprefix $(OBJ_DIR)/, $(notdir $(SOURCES:.c=.o))) @@ -55,18 +62,26 @@ $(OBJ_DIR): wget.exe: $(OBJECTS) $(CC) $(LDFLAGS) -o $@ $^ $(EX_LIBS) +css.c: css.l + flex -8 -o$@ $^ + clean: rm -f $(OBJ_DIR)/*.o $(MAPFILE) vclean realclean: clean - rm -f wget.exe depend.dj + rm -f wget.exe depend.dj version.c - rmdir $(OBJ_DIR) $(OBJ_DIR)/%.o: %.c $(CC) $(CFLAGS) -o $@ -c $< @echo -depend: +version.c: ../msdos/Makefile.DJ + @echo 'char *version_string = "$(VERSION)";' > $@ + @echo 'char *compilation_string = "$(CC) $(CFLAGS)";' >> $@ + @echo 'char *link_string = "$(CC) $(LDFLAGS) -o wget.exe $$(OBJECTS) $(EX_LIBS)";' >> $@ + +depend: version.c $(CC) -MM $(CFLAGS) $(SOURCES) | \ sed -e 's/^\([a-zA-Z0-9_-]*\.o:\)/$$(OBJ_DIR)\/\1/' > depend.dj diff --git a/msdos/Makefile.WC b/msdos/Makefile.WC index d20988ce..5341511a 100644 --- a/msdos/Makefile.WC +++ b/msdos/Makefile.WC @@ -1,33 +1,40 @@ # # Makefile for Wget / DOS32A / OpenWatcom -# by G. Vanem 2007 +# by G. Vanem 2009 # -COMPILE = *wcc386 -mf -3r -w6 -d2 -zq -zm -of -I. -I$(%watt_root)\inc & - -I..\msdos -I..\lib -fr=nul -bt=dos -s -dHAVE_CONFIG_H & - -dENABLE_DEBUG -dSIZEOF_INT=4 +VERSION = 1.12 (Watcom/DOS) + +COMPILE = *wcc386 -mf -3r -w3 -d2 -zq -zm -of -I. -I$(%watt_root)\inc & + -I..\msdos -I..\lib -I..\md5 -fr=nul -bt=dos -s -dHAVE_CONFIG_H & + -dENABLE_DEBUG -dSIZEOF_INT=4 -dUSE_WATT32 LINK = *wlink option quiet, map, verbose, eliminate, caseexact, stack=100k & debug all system dos32a -OBJ_DIR = Watcom.obj - -OBJECTS = $(OBJ_DIR)\cmpt.obj $(OBJ_DIR)\connect.obj & - $(OBJ_DIR)\convert.obj $(OBJ_DIR)\cookies.obj & - $(OBJ_DIR)\c-ctype.obj $(OBJ_DIR)\ftp-basic.obj & - $(OBJ_DIR)\ftp-ls.obj $(OBJ_DIR)\ftp-opie.obj & - $(OBJ_DIR)\ftp.obj $(OBJ_DIR)\gen-md5.obj & - $(OBJ_DIR)\getopt.obj $(OBJ_DIR)\getopt1.obj & - $(OBJ_DIR)\hash.obj $(OBJ_DIR)\host.obj & - $(OBJ_DIR)\html-parse.obj $(OBJ_DIR)\html-url.obj & - $(OBJ_DIR)\http.obj $(OBJ_DIR)\init.obj & - $(OBJ_DIR)\log.obj $(OBJ_DIR)\main.obj & - $(OBJ_DIR)\md5.obj $(OBJ_DIR)\netrc.obj & - $(OBJ_DIR)\progress.obj $(OBJ_DIR)\ptimer.obj & - $(OBJ_DIR)\recur.obj $(OBJ_DIR)\res.obj & - $(OBJ_DIR)\retr.obj $(OBJ_DIR)\spider.obj & - $(OBJ_DIR)\url.obj $(OBJ_DIR)\utils.obj & - $(OBJ_DIR)\version.obj $(OBJ_DIR)\xmalloc.obj +OBJ_DIR = WC_DOS.obj + +OBJECTS = $(OBJ_DIR)\cmpt.obj $(OBJ_DIR)\build_info.obj & + $(OBJ_DIR)\c-ctype.obj $(OBJ_DIR)\cookies.obj & + $(OBJ_DIR)\connect.obj $(OBJ_DIR)\convert.obj & + $(OBJ_DIR)\css.obj $(OBJ_DIR)\css-url.obj & + $(OBJ_DIR)\error.obj $(OBJ_DIR)\exits.obj & + $(OBJ_DIR)\exitfail.obj $(OBJ_DIR)\ftp-basic.obj & + $(OBJ_DIR)\ftp-ls.obj $(OBJ_DIR)\ftp-opie.obj & + $(OBJ_DIR)\ftp.obj $(OBJ_DIR)\gen-md5.obj & + $(OBJ_DIR)\getopt.obj $(OBJ_DIR)\getopt1.obj & + $(OBJ_DIR)\getpass.obj $(OBJ_DIR)\hash.obj & + $(OBJ_DIR)\host.obj $(OBJ_DIR)\html-parse.obj & + $(OBJ_DIR)\html-url.obj $(OBJ_DIR)\http.obj & + $(OBJ_DIR)\init.obj $(OBJ_DIR)\log.obj & + $(OBJ_DIR)\main.obj $(OBJ_DIR)\md5.obj & + $(OBJ_DIR)\netrc.obj $(OBJ_DIR)\progress.obj & + $(OBJ_DIR)\ptimer.obj $(OBJ_DIR)\recur.obj & + $(OBJ_DIR)\res.obj $(OBJ_DIR)\retr.obj & + $(OBJ_DIR)\spider.obj $(OBJ_DIR)\url.obj & + $(OBJ_DIR)\utils.obj $(OBJ_DIR)\version.obj & + $(OBJ_DIR)\xalloc-die.obj $(OBJ_DIR)\xmalloc.obj & + $(OBJ_DIR)\quote.obj $(OBJ_DIR)\quotearg.obj all: $(OBJ_DIR) wget.exe .SYMBOLIC @echo 'Welcome to Wget / Watcom' @@ -44,7 +51,11 @@ $(OBJ_DIR)\c-ctype.obj: ..\lib\c-ctype.c *$(COMPILE) -fo=$@ $[@ .ERASE -$(OBJ_DIR)\md5.obj: ..\lib\md5.c +$(OBJ_DIR)\exitfail.obj: ..\lib\exitfail.c + *$(COMPILE) -fo=$@ $[@ + +.ERASE +$(OBJ_DIR)\error.obj: ..\lib\error.c *$(COMPILE) -fo=$@ $[@ .ERASE @@ -55,11 +66,42 @@ $(OBJ_DIR)\getopt.obj: ..\lib\getopt.c $(OBJ_DIR)\getopt1.obj: ..\lib\getopt1.c *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@ +.ERASE +$(OBJ_DIR)\getpass.obj: ..\lib\getpass.c + *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@ + +.ERASE +$(OBJ_DIR)\md5.obj: ..\md5\md5.c + *$(COMPILE) -fo=$@ $[@ + +.ERASE +$(OBJ_DIR)\xmalloc.obj: ..\lib\xmalloc.c + *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@ + +.ERASE +$(OBJ_DIR)\xalloc-die.obj: ..\lib\xalloc-die.c + *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@ + +.ERASE +$(OBJ_DIR)\quote.obj: ..\lib\quote.c + *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@ + +.ERASE +$(OBJ_DIR)\quotearg.obj: ..\lib\quotearg.c + *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@ + +css.c: css.l + flex -8 -o$@ $[@ + wget.exe: $(OBJECTS) - $(LINK) name $@ file { $(OBJECTS) } library $(%watt_root)\lib\wattcpwf.lib + $(LINK) name $@ file { $(OBJECTS) } library $(%watt_root)\lib\wattcpwf.lib +version.c: ..\msdos\Makefile.WC + @echo char *version_string = "$(VERSION)"; > $@ + @echo char *compilation_string = "$(COMPILE)"; >> $@ + @echo char *link_string = "$(LINK) name wget.exe file { $$(OBJECTS) }"; >> $@ clean: .SYMBOLIC - - rm $(OBJ_DIR)\*.obj wget.exe wget.map + - rm $(OBJ_DIR)\*.obj wget.exe wget.map version.c css.c - rmdir $(OBJ_DIR) diff --git a/msdos/config.h b/msdos/config.h index 4567f81a..a463b120 100644 --- a/msdos/config.h +++ b/msdos/config.h @@ -91,6 +91,7 @@ #endif #ifdef OPENWATCOM_15 + #define HAVE_ALLOCA_H 1 #define HAVE_INT64_T 1 #define HAVE_SNPRINTF 1 #define HAVE_STRCASECMP 1 @@ -129,6 +130,11 @@ #define MSDOS #endif +#if !defined(USE_WATT32) + #define USE_WATT32 +#endif + +#define LOCALEDIR "" #define OS_TYPE "DOS" #endif /* CONFIG_DOS_H */ diff --git a/src/ChangeLog b/src/ChangeLog index c5f20190..a5beaa2e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-09-05 Gisle Vanem + + * connect.c, init.c, main.c, openssl.c, options.h: Replace + "ifdef MSDOS" with "ifdef USE_WATT32" since DOS-targets in fact + use the Watt-32 tcp/ip stack. + 2009-09-04 Micah Cowan * Makefile.am: Move build_info.c to wget_SOURCES from diff --git a/src/connect.c b/src/connect.c index aad6db18..854eebbc 100644 --- a/src/connect.c +++ b/src/connect.c @@ -701,7 +701,7 @@ test_socket_open (int sock) /* Basic socket operations, mostly EINTR wrappers. */ -#if defined(WINDOWS) || defined(MSDOS) +#if defined(WINDOWS) || defined(USE_WATT32) # define read(fd, buf, cnt) recv (fd, buf, cnt, 0) # define write(fd, buf, cnt) send (fd, buf, cnt, 0) # define close(fd) closesocket (fd) diff --git a/src/init.c b/src/init.c index 4e16d1fe..7708e275 100644 --- a/src/init.c +++ b/src/init.c @@ -249,7 +249,7 @@ static const struct { { "verbose", NULL, cmd_spec_verbose }, { "wait", &opt.wait, cmd_time }, { "waitretry", &opt.waitretry, cmd_time }, -#ifdef MSDOS +#ifdef USE_WATT32 { "wdebug", &opt.wdebug, cmd_boolean }, #endif }; diff --git a/src/main.c b/src/main.c index 0f059f76..d45465e7 100644 --- a/src/main.c +++ b/src/main.c @@ -273,7 +273,7 @@ static struct cmdline_option option_data[] = { "version", 'V', OPT_FUNCALL, (void *) print_version, no_argument }, { "wait", 'w', OPT_VALUE, "wait", -1 }, { "waitretry", 0, OPT_VALUE, "waitretry", -1 }, -#ifdef MSDOS +#ifdef USE_WATT32 { "wdebug", 0, OPT_BOOLEAN, "wdebug", -1 }, #endif }; @@ -419,7 +419,7 @@ Logging and input file:\n"), N_("\ -d, --debug print lots of debugging information.\n"), #endif -#ifdef MSDOS +#ifdef USE_WATT32 N_("\ --wdebug print Watt-32 debug output.\n"), #endif @@ -1127,7 +1127,7 @@ for details.\n\n")); exit (1); } -#ifdef MSDOS +#ifdef USE_WATT32 if (opt.wdebug) dbug_init(); sock_init(); diff --git a/src/openssl.c b/src/openssl.c index b6240f6f..6f591f3f 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -364,7 +364,7 @@ openssl_close (int fd, void *arg) xfree_null (ctx->last_error); xfree (ctx); -#if defined(WINDOWS) || defined(MSDOS) +#if defined(WINDOWS) || defined(USE_WATT32) closesocket (fd); #else close (fd); diff --git a/src/options.h b/src/options.h index bf039dd6..caa7a9cb 100644 --- a/src/options.h +++ b/src/options.h @@ -132,7 +132,7 @@ struct options bool debug; /* Debugging on/off */ #endif -#ifdef MSDOS +#ifdef USE_WATT32 bool wdebug; /* Watt-32 tcp/ip debugging on/off */ #endif -- 2.39.2