1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Published my patch "main.c tweaks" published in

<sxspueyonjt.fsf@florida.arsdigita.de>.
This commit is contained in:
hniksic 2001-03-30 15:17:59 -08:00
parent 1a6058b1ec
commit e4d49f0b40
2 changed files with 89 additions and 72 deletions

View File

@ -1,3 +1,10 @@
2001-03-31 Hrvoje Niksic <hniksic@arsdigita.com>
* main.c (print_help): Use multiple fputs instead of a single ugly
printf().
(main): Consistently assign numbers >128 to options without a
corresponding character.
2001-03-09 Philipp Thomas <pthomas@suse.de> 2001-03-09 Philipp Thomas <pthomas@suse.de>
* safe-ctype.h: New file. Locale independent ctype.h * safe-ctype.h: New file. Locale independent ctype.h

View File

@ -130,16 +130,18 @@ print_help (void)
print_usage (); print_usage ();
/* Had to split this in parts, so the #@@#%# Ultrix compiler and cpp /* Had to split this in parts, so the #@@#%# Ultrix compiler and cpp
don't bitch. Also, it makes translation much easier. */ don't bitch. Also, it makes translation much easier. */
printf ("%s%s%s%s%s%s%s%s%s%s", _("\ fputs (_("\
\n\ \n\
Mandatory arguments to long options are mandatory for short options too.\n\ Mandatory arguments to long options are mandatory for short options too.\n\
\n"), _("\ \n"), stdout);
fputs (_("\
Startup:\n\ Startup:\n\
-V, --version display the version of Wget and exit.\n\ -V, --version display the version of Wget and exit.\n\
-h, --help print this help.\n\ -h, --help print this help.\n\
-b, --background go to background after startup.\n\ -b, --background go to background after startup.\n\
-e, --execute=COMMAND execute a `.wgetrc\'-style command.\n\ -e, --execute=COMMAND execute a `.wgetrc\'-style command.\n\
\n"), _("\ \n"), stdout);
fputs (_("\
Logging and input file:\n\ Logging and input file:\n\
-o, --output-file=FILE log messages to FILE.\n\ -o, --output-file=FILE log messages to FILE.\n\
-a, --append-output=FILE append messages to FILE.\n\ -a, --append-output=FILE append messages to FILE.\n\
@ -152,7 +154,8 @@ Logging and input file:\n\
-B, --base=URL prepends URL to relative links in -F -i file.\n\ -B, --base=URL prepends URL to relative links in -F -i file.\n\
--sslcertfile=FILE optional client certificate.\n\ --sslcertfile=FILE optional client certificate.\n\
--sslcertkey=KEYFILE optional keyfile for this certificate.\n\ --sslcertkey=KEYFILE optional keyfile for this certificate.\n\
\n"), _("\ \n"), stdout);
fputs (_("\
Download:\n\ Download:\n\
--bind-address=ADDRESS bind to ADDRESS (hostname or IP) on local host.\n\ --bind-address=ADDRESS bind to ADDRESS (hostname or IP) on local host.\n\
-t, --tries=NUMBER set number of retries to NUMBER (0 unlimits).\n\ -t, --tries=NUMBER set number of retries to NUMBER (0 unlimits).\n\
@ -168,14 +171,16 @@ Download:\n\
--waitretry=SECONDS wait 1...SECONDS between retries of a retrieval.\n\ --waitretry=SECONDS wait 1...SECONDS between retries of a retrieval.\n\
-Y, --proxy=on/off turn proxy on or off.\n\ -Y, --proxy=on/off turn proxy on or off.\n\
-Q, --quota=NUMBER set retrieval quota to NUMBER.\n\ -Q, --quota=NUMBER set retrieval quota to NUMBER.\n\
\n"), _("\ \n"), stdout);
fputs (_("\
Directories:\n\ Directories:\n\
-nd --no-directories don\'t create directories.\n\ -nd --no-directories don\'t create directories.\n\
-x, --force-directories force creation of directories.\n\ -x, --force-directories force creation of directories.\n\
-nH, --no-host-directories don\'t create host directories.\n\ -nH, --no-host-directories don\'t create host directories.\n\
-P, --directory-prefix=PREFIX save files to PREFIX/...\n\ -P, --directory-prefix=PREFIX save files to PREFIX/...\n\
--cut-dirs=NUMBER ignore NUMBER remote directory components.\n\ --cut-dirs=NUMBER ignore NUMBER remote directory components.\n\
\n"), _("\ \n"), stdout);
fputs (_("\
HTTP options:\n\ HTTP options:\n\
--http-user=USER set http user to USER.\n\ --http-user=USER set http user to USER.\n\
--http-passwd=PASS set http password to PASS.\n\ --http-passwd=PASS set http password to PASS.\n\
@ -188,13 +193,15 @@ HTTP options:\n\
--referer=URL include `Referer: URL\' header in HTTP request.\n\ --referer=URL include `Referer: URL\' header in HTTP request.\n\
-s, --save-headers save the HTTP headers to file.\n\ -s, --save-headers save the HTTP headers to file.\n\
-U, --user-agent=AGENT identify as AGENT instead of Wget/VERSION.\n\ -U, --user-agent=AGENT identify as AGENT instead of Wget/VERSION.\n\
\n"), _("\ \n"), stdout);
fputs (_("\
FTP options:\n\ FTP options:\n\
-nr, --dont-remove-listing don\'t remove `.listing\' files.\n\ -nr, --dont-remove-listing don\'t remove `.listing\' files.\n\
-g, --glob=on/off turn file name globbing on or off.\n\ -g, --glob=on/off turn file name globbing on or off.\n\
--passive-ftp use the \"passive\" transfer mode.\n\ --passive-ftp use the \"passive\" transfer mode.\n\
--retr-symlinks when recursing, get linked-to files (not dirs).\n\ --retr-symlinks when recursing, get linked-to files (not dirs).\n\
\n"), _("\ \n"), stdout);
fputs (_("\
Recursive retrieval:\n\ Recursive retrieval:\n\
-r, --recursive recursive web-suck -- use with care!\n\ -r, --recursive recursive web-suck -- use with care!\n\
-l, --level=NUMBER maximum recursion depth (inf or 0 for infinite).\n\ -l, --level=NUMBER maximum recursion depth (inf or 0 for infinite).\n\
@ -203,7 +210,8 @@ Recursive retrieval:\n\
-K, --backup-converted before converting file X, back up as X.orig.\n\ -K, --backup-converted before converting file X, back up as X.orig.\n\
-m, --mirror shortcut option equivalent to -r -N -l inf -nr.\n\ -m, --mirror shortcut option equivalent to -r -N -l inf -nr.\n\
-p, --page-requisites get all images, etc. needed to display HTML page.\n\ -p, --page-requisites get all images, etc. needed to display HTML page.\n\
\n"), _("\ \n"), stdout);
fputs (_("\
Recursive accept/reject:\n\ Recursive accept/reject:\n\
-A, --accept=LIST comma-separated list of accepted extensions.\n\ -A, --accept=LIST comma-separated list of accepted extensions.\n\
-R, --reject=LIST comma-separated list of rejected extensions.\n\ -R, --reject=LIST comma-separated list of rejected extensions.\n\
@ -218,7 +226,9 @@ Recursive accept/reject:\n\
-X, --exclude-directories=LIST list of excluded directories.\n\ -X, --exclude-directories=LIST list of excluded directories.\n\
-nh, --no-host-lookup don\'t DNS-lookup hosts.\n\ -nh, --no-host-lookup don\'t DNS-lookup hosts.\n\
-np, --no-parent don\'t ascend to the parent directory.\n\ -np, --no-parent don\'t ascend to the parent directory.\n\
\n"), _("Mail bug reports and suggestions to <bug-wget@gnu.org>.\n")); \n"), stdout);
fputs (_("Mail bug reports and suggestions to <bug-wget@gnu.org>.\n"),
stdout);
} }
int int
@ -236,33 +246,34 @@ main (int argc, char *const *argv)
{ "convert-links", no_argument, NULL, 'k' }, { "convert-links", no_argument, NULL, 'k' },
{ "backup-converted", no_argument, NULL, 'K' }, { "backup-converted", no_argument, NULL, 'K' },
{ "debug", no_argument, NULL, 'd' }, { "debug", no_argument, NULL, 'd' },
{ "dont-remove-listing", no_argument, NULL, 21 }, { "delete-after", no_argument, NULL, 136 },
{ "email-address", no_argument, NULL, 26 }, /* undocumented (debug) */ { "dont-remove-listing", no_argument, NULL, 149 },
{ "follow-ftp", no_argument, NULL, 14 }, { "email-address", no_argument, NULL, 154 }, /* undocumented (debug) */
{ "follow-ftp", no_argument, NULL, 142 },
{ "force-directories", no_argument, NULL, 'x' }, { "force-directories", no_argument, NULL, 'x' },
{ "force-hier", no_argument, NULL, 'x' }, /* obsolete */ { "force-hier", no_argument, NULL, 'x' }, /* obsolete */
{ "force-html", no_argument, NULL, 'F'}, { "force-html", no_argument, NULL, 'F'},
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "html-extension", no_argument, NULL, 'E' }, { "html-extension", no_argument, NULL, 'E' },
{ "ignore-length", no_argument, NULL, 10 }, { "ignore-length", no_argument, NULL, 138 },
{ "mirror", no_argument, NULL, 'm' }, { "mirror", no_argument, NULL, 'm' },
{ "no-clobber", no_argument, NULL, 13 }, { "no-clobber", no_argument, NULL, 141 },
{ "no-directories", no_argument, NULL, 19 }, { "no-directories", no_argument, NULL, 147 },
{ "no-host-directories", no_argument, NULL, 20 }, { "no-host-directories", no_argument, NULL, 148 },
{ "no-host-lookup", no_argument, NULL, 22 }, { "no-host-lookup", no_argument, NULL, 150 },
{ "no-http-keep-alive", no_argument, NULL, 28 }, { "no-http-keep-alive", no_argument, NULL, 156 },
{ "no-parent", no_argument, NULL, 5 }, { "no-parent", no_argument, NULL, 133 },
{ "non-verbose", no_argument, NULL, 18 }, { "non-verbose", no_argument, NULL, 146 },
{ "passive-ftp", no_argument, NULL, 11 }, { "passive-ftp", no_argument, NULL, 139 },
{ "page-requisites", no_argument, NULL, 'p' }, { "page-requisites", no_argument, NULL, 'p' },
{ "quiet", no_argument, NULL, 'q' }, { "quiet", no_argument, NULL, 'q' },
{ "recursive", no_argument, NULL, 'r' }, { "recursive", no_argument, NULL, 'r' },
{ "relative", no_argument, NULL, 'L' }, { "relative", no_argument, NULL, 'L' },
{ "retr-symlinks", no_argument, NULL, 9 }, { "retr-symlinks", no_argument, NULL, 137 },
{ "save-headers", no_argument, NULL, 's' }, { "save-headers", no_argument, NULL, 's' },
{ "server-response", no_argument, NULL, 'S' }, { "server-response", no_argument, NULL, 'S' },
{ "span-hosts", no_argument, NULL, 'H' }, { "span-hosts", no_argument, NULL, 'H' },
{ "spider", no_argument, NULL, 4 }, { "spider", no_argument, NULL, 132 },
{ "timestamping", no_argument, NULL, 'N' }, { "timestamping", no_argument, NULL, 'N' },
{ "verbose", no_argument, NULL, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'V' }, { "version", no_argument, NULL, 'V' },
@ -270,24 +281,23 @@ main (int argc, char *const *argv)
/* Options accepting an argument: */ /* Options accepting an argument: */
{ "accept", required_argument, NULL, 'A' }, { "accept", required_argument, NULL, 'A' },
{ "append-output", required_argument, NULL, 'a' }, { "append-output", required_argument, NULL, 'a' },
{ "backups", required_argument, NULL, 23 }, /* undocumented */ { "backups", required_argument, NULL, 151 }, /* undocumented */
{ "base", required_argument, NULL, 'B' }, { "base", required_argument, NULL, 'B' },
{ "bind-address", required_argument, NULL, 27 }, { "bind-address", required_argument, NULL, 155 },
{ "cache", required_argument, NULL, 'C' }, { "cache", required_argument, NULL, 'C' },
{ "cut-dirs", required_argument, NULL, 17 }, { "cut-dirs", required_argument, NULL, 145 },
{ "delete-after", no_argument, NULL, 8 },
{ "directory-prefix", required_argument, NULL, 'P' }, { "directory-prefix", required_argument, NULL, 'P' },
{ "domains", required_argument, NULL, 'D' }, { "domains", required_argument, NULL, 'D' },
{ "dot-style", required_argument, NULL, 6 }, { "dot-style", required_argument, NULL, 134 },
{ "execute", required_argument, NULL, 'e' }, { "execute", required_argument, NULL, 'e' },
{ "exclude-directories", required_argument, NULL, 'X' }, { "exclude-directories", required_argument, NULL, 'X' },
{ "exclude-domains", required_argument, NULL, 12 }, { "exclude-domains", required_argument, NULL, 140 },
{ "follow-tags", required_argument, NULL, 25 }, { "follow-tags", required_argument, NULL, 153 },
{ "glob", required_argument, NULL, 'g' }, { "glob", required_argument, NULL, 'g' },
{ "header", required_argument, NULL, 3 }, { "header", required_argument, NULL, 131 },
{ "htmlify", required_argument, NULL, 7 }, { "htmlify", required_argument, NULL, 135 },
{ "http-passwd", required_argument, NULL, 2 }, { "http-passwd", required_argument, NULL, 130 },
{ "http-user", required_argument, NULL, 1 }, { "http-user", required_argument, NULL, 129 },
{ "ignore-tags", required_argument, NULL, 'G' }, { "ignore-tags", required_argument, NULL, 'G' },
{ "include-directories", required_argument, NULL, 'I' }, { "include-directories", required_argument, NULL, 'I' },
{ "input-file", required_argument, NULL, 'i' }, { "input-file", required_argument, NULL, 'i' },
@ -296,21 +306,21 @@ main (int argc, char *const *argv)
{ "output-document", required_argument, NULL, 'O' }, { "output-document", required_argument, NULL, 'O' },
{ "output-file", required_argument, NULL, 'o' }, { "output-file", required_argument, NULL, 'o' },
{ "proxy", required_argument, NULL, 'Y' }, { "proxy", required_argument, NULL, 'Y' },
{ "proxy-passwd", required_argument, NULL, 16 }, { "proxy-passwd", required_argument, NULL, 144 },
{ "proxy-user", required_argument, NULL, 15 }, { "proxy-user", required_argument, NULL, 143 },
{ "quota", required_argument, NULL, 'Q' }, { "quota", required_argument, NULL, 'Q' },
{ "reject", required_argument, NULL, 'R' }, { "reject", required_argument, NULL, 'R' },
{ "timeout", required_argument, NULL, 'T' }, { "timeout", required_argument, NULL, 'T' },
{ "tries", required_argument, NULL, 't' }, { "tries", required_argument, NULL, 't' },
{ "user-agent", required_argument, NULL, 'U' }, { "user-agent", required_argument, NULL, 'U' },
{ "referer", required_argument, NULL, 129 }, { "referer", required_argument, NULL, 157 },
{ "use-proxy", required_argument, NULL, 'Y' }, { "use-proxy", required_argument, NULL, 'Y' },
#ifdef HAVE_SSL #ifdef HAVE_SSL
{ "sslcertfile", required_argument, NULL, 132}, { "sslcertfile", required_argument, NULL, 158 },
{ "sslcertkey", required_argument, NULL, 133}, { "sslcertkey", required_argument, NULL, 159 },
#endif /* HAVE_SSL */ #endif /* HAVE_SSL */
{ "wait", required_argument, NULL, 'w' }, { "wait", required_argument, NULL, 'w' },
{ "waitretry", required_argument, NULL, 24 }, { "waitretry", required_argument, NULL, 152 },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
@ -343,57 +353,57 @@ hpVqvdkKsxmNWrHSLcFbEY:G:g:T:U:O:l:n:i:o:a:t:D:A:R:P:B:e:Q:X:I:w:",
switch (c) switch (c)
{ {
/* Options without arguments: */ /* Options without arguments: */
case 4: case 132:
setval ("spider", "on"); setval ("spider", "on");
break; break;
case 5: case 133:
setval ("noparent", "on"); setval ("noparent", "on");
break; break;
case 8: case 136:
setval ("deleteafter", "on"); setval ("deleteafter", "on");
break; break;
case 9: case 137:
setval ("retrsymlinks", "on"); setval ("retrsymlinks", "on");
break; break;
case 10: case 138:
setval ("ignorelength", "on"); setval ("ignorelength", "on");
break; break;
case 11: case 139:
setval ("passiveftp", "on"); setval ("passiveftp", "on");
break; break;
case 13: case 141:
setval ("noclobber", "on"); setval ("noclobber", "on");
break; break;
case 14: case 142:
setval ("followftp", "on"); setval ("followftp", "on");
break; break;
case 17: case 145:
setval ("cutdirs", optarg); setval ("cutdirs", optarg);
break; break;
case 18: case 146:
setval ("verbose", "off"); setval ("verbose", "off");
break; break;
case 19: case 147:
setval ("dirstruct", "off"); setval ("dirstruct", "off");
break; break;
case 20: case 148:
setval ("addhostdir", "off"); setval ("addhostdir", "off");
break; break;
case 21: case 149:
setval ("removelisting", "off"); setval ("removelisting", "off");
break; break;
case 22: case 150:
setval ("simplehostcheck", "on"); setval ("simplehostcheck", "on");
break; break;
case 26: case 154:
/* For debugging purposes. */ /* For debugging purposes. */
printf ("%s\n", ftp_getaddress ()); printf ("%s\n", ftp_getaddress ());
exit (0); exit (0);
break; break;
case 27: case 155:
setval ("bindaddress", optarg); setval ("bindaddress", optarg);
break; break;
case 28: case 156:
setval ("httpkeepalive", "off"); setval ("httpkeepalive", "off");
break; break;
case 'b': case 'b':
@ -475,48 +485,48 @@ GNU General Public License for more details.\n"));
break; break;
/* Options accepting an argument: */ /* Options accepting an argument: */
case 1: case 129:
setval ("httpuser", optarg); setval ("httpuser", optarg);
break; break;
case 2: case 130:
setval ("httppasswd", optarg); setval ("httppasswd", optarg);
break; break;
case 3: case 131:
setval ("header", optarg); setval ("header", optarg);
break; break;
case 6: case 134:
setval ("dotstyle", optarg); setval ("dotstyle", optarg);
break; break;
case 7: case 135:
setval ("htmlify", optarg); setval ("htmlify", optarg);
break; break;
case 12: case 140:
setval ("excludedomains", optarg); setval ("excludedomains", optarg);
break; break;
case 15: case 143:
setval ("proxyuser", optarg); setval ("proxyuser", optarg);
break; break;
case 16: case 144:
setval ("proxypasswd", optarg); setval ("proxypasswd", optarg);
break; break;
case 23: case 151:
setval ("backups", optarg); setval ("backups", optarg);
break; break;
case 24: case 152:
setval ("waitretry", optarg); setval ("waitretry", optarg);
wr = 1; wr = 1;
break; break;
case 25: case 153:
setval ("followtags", optarg); setval ("followtags", optarg);
break; break;
case 129: case 157:
setval ("referer", optarg); setval ("referer", optarg);
break; break;
#ifdef HAVE_SSL #ifdef HAVE_SSL
case 132: case 158:
setval ("sslcertfile", optarg); setval ("sslcertfile", optarg);
break; break;
case 133: case 159:
setval ("sslcertkey", optarg); setval ("sslcertkey", optarg);
break; break;
#endif /* HAVE_SSL */ #endif /* HAVE_SSL */