From aa85e6cb4653bf6bac7ff7569fa6d0fe8f9e59f3 Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Tue, 8 Sep 2009 09:33:28 -0700 Subject: [PATCH] More MS-DOS fixes. --- msdos/ChangeLog | 14 +++++- msdos/Makefile.DJ | 3 +- msdos/Makefile.WC | 51 +++------------------- msdos/msdos.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+), 48 deletions(-) create mode 100644 msdos/msdos.c diff --git a/msdos/ChangeLog b/msdos/ChangeLog index b07b359b..d4e74144 100644 --- a/msdos/ChangeLog +++ b/msdos/ChangeLog @@ -1,13 +1,23 @@ +2009-09-06 Gisle Vanem + + * Makefile.WC: Added compilation of new file msdos.c. + Simplified; no need to have explicit rules for files in ./lib and + ./md5. Just use the suffix search path mechanism in wmake. + +2009-09-06 Gisle Vanem + + * Makefile.DJ: Added compilation of new file msdos.c. + 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 + * 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 + * Makefile.DJ: A much needed update. Added rules for css.c and version.c. 2008-01-25 Micah Cowan diff --git a/msdos/Makefile.DJ b/msdos/Makefile.DJ index ef42f45f..b37a4c28 100644 --- a/msdos/Makefile.DJ +++ b/msdos/Makefile.DJ @@ -11,7 +11,7 @@ VERSION = 1.12 (djgpp/DOS) .SUFFIXES: .exe -VPATH = ../lib ../md5 +VPATH = ../lib ../md5 ../msdos USE_OPENSSL = 0 USE_IPV6 = 1 @@ -48,6 +48,7 @@ SOURCES += cmpt.c connect.c cookies.c exits.c ftp.c ftp-basic.c ftp-ls.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 \ ptimer.c spider.c css.c css-url.c build_info.c ../md5/md5.c \ + ../msdos/msdos.c \ $(addprefix ../lib/, error.c exitfail.c quote.c \ quotearg.c getopt.c getopt1.c xalloc-die.c xmalloc.c) diff --git a/msdos/Makefile.WC b/msdos/Makefile.WC index 5341511a..e11a162b 100644 --- a/msdos/Makefile.WC +++ b/msdos/Makefile.WC @@ -12,6 +12,11 @@ COMPILE = *wcc386 -mf -3r -w3 -d2 -zq -zm -of -I. -I$(%watt_root)\inc & LINK = *wlink option quiet, map, verbose, eliminate, caseexact, stack=100k & debug all system dos32a +.c: ..\lib +.c: ..\md5 +.c: ..\msdos + + OBJ_DIR = WC_DOS.obj OBJECTS = $(OBJ_DIR)\cmpt.obj $(OBJ_DIR)\build_info.obj & @@ -23,7 +28,7 @@ OBJECTS = $(OBJ_DIR)\cmpt.obj $(OBJ_DIR)\build_info.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)\hash.obj $(OBJ_DIR)\msdos.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 & @@ -46,50 +51,6 @@ $(OBJ_DIR): .c{$(OBJ_DIR)}.obj: .AUTODEPEND *$(COMPILE) -fo=$@ $[@ -.ERASE -$(OBJ_DIR)\c-ctype.obj: ..\lib\c-ctype.c - *$(COMPILE) -fo=$@ $[@ - -.ERASE -$(OBJ_DIR)\exitfail.obj: ..\lib\exitfail.c - *$(COMPILE) -fo=$@ $[@ - -.ERASE -$(OBJ_DIR)\error.obj: ..\lib\error.c - *$(COMPILE) -fo=$@ $[@ - -.ERASE -$(OBJ_DIR)\getopt.obj: ..\lib\getopt.c - *$(COMPILE) -d_UNISTD_H_INCLUDED -fo=$@ $[@ - -.ERASE -$(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$@ $[@ diff --git a/msdos/msdos.c b/msdos/msdos.c new file mode 100644 index 00000000..f5b7e1c5 --- /dev/null +++ b/msdos/msdos.c @@ -0,0 +1,109 @@ +
/* MSDOS utility functions. + Copyright (C) 2009 Free Software Foundation, Inc. + +This file is part of GNU Wget. + +GNU Wget is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. + +GNU Wget is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Wget. If not, see . + +Additional permission under GNU GPL version 3 section 7 + +If you modify this program, or any covered work, by linking or +combining it with the OpenSSL project's OpenSSL library (or a +modified version of that library), containing parts covered by the +terms of the OpenSSL or SSLeay licenses, the Free Software Foundation +grants you additional permission to convey the resulting work. +Corresponding Source for a non-source form of such a combination +shall include the source code for the parts of OpenSSL used as well +as that of the covered work. */ + +#include "wget.h" + +#include +#include +#include +#include + +/* This variable (i.e. MB_CUR_MAX) is set here so that we force a unibyte + locale in ../lib/quotearg.c. */ +#ifdef __DJGPP__ +int __dj_mb_cur_max = 1; +#endif + +#ifndef __WATCOMC__ +/* These is just a dummy function to make Wget link. These are never called + because 'unibyte_locale == 1' in ../lib/quotearg.c. */ +int mbsinit (void) +{ + return 0; +} + +int mbrtowc (void) +{ + return 0; +} + +int iswprint (void) +{ + return 0; +} +#endif /* __WATCOMC__ */ + + +#define PASS_MAX 512 + +/* Get a user string with echo off. Handy for entering passwords. The prompt + optional. */ +char * +getpass (const char *prompt) +{ + char getpassbuf[PASS_MAX + 1]; + size_t i = 0; + int c; + + if (prompt) + { + fputs (prompt, stderr); + fflush (stderr); + } + + for (;;) + { + c = getch (); + if (c == '\r') + { + getpassbuf[i] = '\0'; + break; + } + else if (i < PASS_MAX) + { + getpassbuf[i++] = c; + } + + if (i >= PASS_MAX) + { + getpassbuf[i] = '\0'; + break; + } + } + + if (prompt) + { + fputs ("\r\n", stderr); + fflush (stderr); + } + + return strdup (getpassbuf); +} + +
\ No newline at end of file -- 2.39.2