mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Make errors in command-line options fatal.
This commit is contained in:
parent
7870937036
commit
37183b0208
@ -1,3 +1,18 @@
|
|||||||
|
2003-09-21 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
|
* main.c (main): Use setoptval() for setting the options. Use
|
||||||
|
run_command for `-e'.
|
||||||
|
|
||||||
|
* init.c (parse_line): Rewritten to return COMIND right away.
|
||||||
|
Changed linkage to static.
|
||||||
|
(run_wgetrc): Use the available comind when calling setval, so it
|
||||||
|
doesn't have to be computed twice.
|
||||||
|
(setval_internal): New function, runs the command's action without
|
||||||
|
any error checking.
|
||||||
|
(setoptval): New function, does what setval used to do, but exits
|
||||||
|
in case of error.
|
||||||
|
(run_command): New function.
|
||||||
|
|
||||||
2003-09-21 Hrvoje Niksic <hniksic@xemacs.org>
|
2003-09-21 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* connect.c (select_fd): Change MAXTIME's type to double. Handle
|
* connect.c (select_fd): Change MAXTIME's type to double. Handle
|
||||||
|
197
src/init.c
197
src/init.c
@ -54,8 +54,9 @@ so, delete this exception statement from your version. */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_PWD_H
|
#ifdef HAVE_PWD_H
|
||||||
#include <pwd.h>
|
# include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
@ -105,7 +106,7 @@ CMD_DECLARE (cmd_spec_useragent);
|
|||||||
|
|
||||||
/* List of recognized commands, each consisting of name, closure and function.
|
/* List of recognized commands, each consisting of name, closure and function.
|
||||||
When adding a new command, simply add it to the list, but be sure to keep the
|
When adding a new command, simply add it to the list, but be sure to keep the
|
||||||
list sorted alphabetically, as comind() depends on it. Also, be sure to add
|
list sorted alphabetically, as findcmd() depends on it. Also, be sure to add
|
||||||
any entries that allocate memory (e.g. cmd_string and cmd_vector guys) to the
|
any entries that allocate memory (e.g. cmd_string and cmd_vector guys) to the
|
||||||
cleanup() function below. */
|
cleanup() function below. */
|
||||||
static struct {
|
static struct {
|
||||||
@ -222,7 +223,7 @@ static struct {
|
|||||||
is not found, -1 is returned. This function uses binary search. */
|
is not found, -1 is returned. This function uses binary search. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
comind (const char *com)
|
findcmd (const char *com)
|
||||||
{
|
{
|
||||||
int lo = 0, hi = countof (commands) - 1;
|
int lo = 0, hi = countof (commands) - 1;
|
||||||
|
|
||||||
@ -376,7 +377,11 @@ wgetrc_file_name (void)
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize variables from a wgetrc file */
|
static int parse_line PARAMS ((const char *, char **, char **, int *));
|
||||||
|
static int setval_internal PARAMS ((int, const char *, const char *));
|
||||||
|
|
||||||
|
/* Initialize variables from a wgetrc file. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
run_wgetrc (const char *file)
|
run_wgetrc (const char *file)
|
||||||
{
|
{
|
||||||
@ -396,15 +401,15 @@ run_wgetrc (const char *file)
|
|||||||
while ((line = read_whole_line (fp)))
|
while ((line = read_whole_line (fp)))
|
||||||
{
|
{
|
||||||
char *com, *val;
|
char *com, *val;
|
||||||
int status;
|
int comind, status;
|
||||||
|
|
||||||
/* Parse the line. */
|
/* Parse the line. */
|
||||||
status = parse_line (line, &com, &val);
|
status = parse_line (line, &com, &val, &comind);
|
||||||
xfree (line);
|
xfree (line);
|
||||||
/* If everything is OK, set the value. */
|
/* If everything is OK, set the value. */
|
||||||
if (status == 1)
|
if (status == 1)
|
||||||
{
|
{
|
||||||
if (!setval (com, val))
|
if (!setval_internal (comind, com, val))
|
||||||
fprintf (stderr, _("%s: Error in %s at line %d.\n"), exec_name,
|
fprintf (stderr, _("%s: Error in %s at line %d.\n"), exec_name,
|
||||||
file, ln);
|
file, ln);
|
||||||
xfree (com);
|
xfree (com);
|
||||||
@ -438,8 +443,8 @@ initialize (void)
|
|||||||
file = wgetrc_file_name ();
|
file = wgetrc_file_name ();
|
||||||
if (!file)
|
if (!file)
|
||||||
return;
|
return;
|
||||||
/* #### We should somehow canonicalize `file' and SYSTEM_WGETRC,
|
/* #### We should canonicalize `file' and SYSTEM_WGETRC with
|
||||||
really. */
|
something like realpath() before comparing them with `strcmp' */
|
||||||
#ifdef SYSTEM_WGETRC
|
#ifdef SYSTEM_WGETRC
|
||||||
if (!strcmp (file, SYSTEM_WGETRC))
|
if (!strcmp (file, SYSTEM_WGETRC))
|
||||||
{
|
{
|
||||||
@ -454,6 +459,22 @@ initialize (void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Remove dashes and underscores from S, modifying S in the
|
||||||
|
process. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
dehyphen (char *s)
|
||||||
|
{
|
||||||
|
char *t = s; /* t - tortoise */
|
||||||
|
char *h = s; /* h - hare */
|
||||||
|
while (*h)
|
||||||
|
if (*h == '_' || *h == '-')
|
||||||
|
++h;
|
||||||
|
else
|
||||||
|
*t++ = *h++;
|
||||||
|
*t = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
/* Parse the line pointed by line, with the syntax:
|
/* Parse the line pointed by line, with the syntax:
|
||||||
<sp>* command <sp>* = <sp>* value <newline>
|
<sp>* command <sp>* = <sp>* value <newline>
|
||||||
Uses malloc to allocate space for command and value.
|
Uses malloc to allocate space for command and value.
|
||||||
@ -463,84 +484,107 @@ initialize (void)
|
|||||||
1 - success
|
1 - success
|
||||||
0 - failure
|
0 - failure
|
||||||
-1 - empty */
|
-1 - empty */
|
||||||
int
|
|
||||||
parse_line (const char *line, char **com, char **val)
|
static int
|
||||||
|
parse_line (const char *line, char **com, char **val, int *comind)
|
||||||
{
|
{
|
||||||
const char *p = line;
|
const char *p;
|
||||||
const char *orig_comptr, *end;
|
const char *end = line + strlen (line);
|
||||||
char *new_comptr;
|
const char *cmdstart, *cmdend;
|
||||||
|
const char *valstart, *valend;
|
||||||
|
|
||||||
/* Skip whitespace. */
|
char *cmdcopy;
|
||||||
while (*p && ISSPACE (*p))
|
int ind;
|
||||||
++p;
|
|
||||||
|
|
||||||
/* Don't process empty lines. */
|
/* Skip leading and trailing whitespace. */
|
||||||
if (!*p || *p == '#')
|
while (*line && ISSPACE (*line))
|
||||||
|
++line;
|
||||||
|
while (end > line && ISSPACE (end[-1]))
|
||||||
|
--end;
|
||||||
|
|
||||||
|
/* Skip empty lines and comments. */
|
||||||
|
if (!*line || *line == '#')
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (orig_comptr = p; ISALPHA (*p) || *p == '_' || *p == '-'; p++)
|
p = line;
|
||||||
;
|
|
||||||
/* The next char should be space or '='. */
|
|
||||||
if (!ISSPACE (*p) && (*p != '='))
|
|
||||||
return 0;
|
|
||||||
/* Here we cannot use strdupdelim() as we normally would because we
|
|
||||||
want to skip the `-' and `_' characters in the input string. */
|
|
||||||
*com = (char *)xmalloc (p - orig_comptr + 1);
|
|
||||||
for (new_comptr = *com; orig_comptr < p; orig_comptr++)
|
|
||||||
{
|
|
||||||
if (*orig_comptr == '_' || *orig_comptr == '-')
|
|
||||||
continue;
|
|
||||||
*new_comptr++ = *orig_comptr;
|
|
||||||
}
|
|
||||||
*new_comptr = '\0';
|
|
||||||
/* If the command is invalid, exit now. */
|
|
||||||
if (comind (*com) == -1)
|
|
||||||
{
|
|
||||||
xfree (*com);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Skip spaces before '='. */
|
cmdstart = p;
|
||||||
for (; ISSPACE (*p); p++);
|
while (p < end && (ISALPHA (*p) || *p == '_' || *p == '-'))
|
||||||
/* If '=' not found, bail out. */
|
++p;
|
||||||
if (*p != '=')
|
cmdend = p;
|
||||||
{
|
|
||||||
xfree (*com);
|
/* Skip '=', as well as any space before or after it. */
|
||||||
return 0;
|
while (p < end && ISSPACE (*p))
|
||||||
}
|
++p;
|
||||||
/* Skip spaces after '='. */
|
if (p == end || *p != '=')
|
||||||
for (++p; ISSPACE (*p); p++);
|
return 0;
|
||||||
/* Get the ending position for VAL by starting with the end of the
|
++p;
|
||||||
line and skipping whitespace. */
|
while (p < end && ISSPACE (*p))
|
||||||
end = line + strlen (line) - 1;
|
++p;
|
||||||
while (end > p && ISSPACE (*end))
|
|
||||||
--end;
|
valstart = p;
|
||||||
*val = strdupdelim (p, end + 1);
|
valend = end;
|
||||||
|
|
||||||
|
/* The line now known to be syntactically correct. Check whether
|
||||||
|
the command is valid. */
|
||||||
|
BOUNDED_TO_ALLOCA (cmdstart, cmdend, cmdcopy);
|
||||||
|
dehyphen (cmdcopy);
|
||||||
|
ind = findcmd (cmdcopy);
|
||||||
|
if (ind == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* The command is valid. Now fill in the values and report success
|
||||||
|
to the caller. */
|
||||||
|
*comind = ind;
|
||||||
|
*com = strdupdelim (cmdstart, cmdend);
|
||||||
|
*val = strdupdelim (valstart, valend);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set COM to VAL. This is the meat behind processing `.wgetrc'. No
|
/* Run commands[comind].action. */
|
||||||
fatals -- error signal prints a warning and resets to default
|
|
||||||
value. All error messages are printed to stderr, *not* to
|
|
||||||
opt.lfile, since opt.lfile wasn't even generated yet. */
|
|
||||||
int
|
|
||||||
setval (const char *com, const char *val)
|
|
||||||
{
|
|
||||||
int ind;
|
|
||||||
|
|
||||||
if (!com || !val)
|
static int
|
||||||
return 0;
|
setval_internal (int comind, const char *com, const char *val)
|
||||||
ind = comind (com);
|
{
|
||||||
if (ind == -1)
|
assert (0 <= comind && comind < countof (commands));
|
||||||
|
return ((*commands[comind].action) (com, val, commands[comind].closure));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Run command COM with value VAL. If running the command produces an
|
||||||
|
error, report the error and exit.
|
||||||
|
|
||||||
|
This is intended to be called from main() with commands not
|
||||||
|
provided by the user, therefore it aborts when an unknown command
|
||||||
|
is encountered. Once the COMIND's are exported to init.h, this
|
||||||
|
function will be changed to accept COMIND directly. */
|
||||||
|
|
||||||
|
void
|
||||||
|
setoptval (const char *com, const char *val)
|
||||||
|
{
|
||||||
|
int comind = findcmd (com);
|
||||||
|
assert (comind != -1);
|
||||||
|
if (!setval_internal (comind, com, val))
|
||||||
|
exit (2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
run_command (const char *opt)
|
||||||
|
{
|
||||||
|
char *com, *val;
|
||||||
|
int comind;
|
||||||
|
int status = parse_line (opt, &com, &val, &comind);
|
||||||
|
if (status == 1)
|
||||||
{
|
{
|
||||||
/* #### Should I just abort()? */
|
if (!setval_internal (comind, com, val))
|
||||||
#ifdef DEBUG
|
exit (2);
|
||||||
fprintf (stderr, _("%s: BUG: unknown command `%s', value `%s'.\n"),
|
xfree (com);
|
||||||
exec_name, com, val);
|
xfree (val);
|
||||||
#endif
|
}
|
||||||
return 0;
|
else if (status == 0)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "Invalid command `%s'\n", opt);
|
||||||
|
exit (2);
|
||||||
}
|
}
|
||||||
return ((*commands[ind].action) (com, val, commands[ind].closure));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generic helper functions, for use with `commands'. */
|
/* Generic helper functions, for use with `commands'. */
|
||||||
@ -857,7 +901,8 @@ cmd_bytes (const char *com, const char *val, void *closure)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Store the value of VAL to *OUT. The value is a time period, by
|
/* Store the value of VAL to *OUT. The value is a time period, by
|
||||||
default expressed in seconds. */
|
default expressed in seconds, but also accepting suffixes "m", "h",
|
||||||
|
"d", and "w" for minutes, hours, days, and weeks respectively. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd_time (const char *com, const char *val, void *closure)
|
cmd_time (const char *com, const char *val, void *closure)
|
||||||
|
@ -31,8 +31,8 @@ so, delete this exception statement from your version. */
|
|||||||
#define INIT_H
|
#define INIT_H
|
||||||
|
|
||||||
void initialize PARAMS ((void));
|
void initialize PARAMS ((void));
|
||||||
int parse_line PARAMS ((const char *, char **, char **));
|
void run_command PARAMS ((const char *));
|
||||||
int setval PARAMS ((const char *, const char *));
|
void setoptval PARAMS ((const char *, const char *));
|
||||||
char *home_dir PARAMS ((void));
|
char *home_dir PARAMS ((void));
|
||||||
void cleanup PARAMS ((void));
|
void cleanup PARAMS ((void));
|
||||||
|
|
||||||
|
203
src/main.c
203
src/main.c
@ -398,75 +398,75 @@ hpVqvdkKsxmNWrHSLcFbEY:G:g:T:U:O:l:n:i:o:a:t:D:A:R:P:B:e:Q:X:I:w:C:",
|
|||||||
{
|
{
|
||||||
/* Options without arguments: */
|
/* Options without arguments: */
|
||||||
case 132:
|
case 132:
|
||||||
setval ("spider", "on");
|
setoptval ("spider", "on");
|
||||||
break;
|
break;
|
||||||
case 133:
|
case 133:
|
||||||
setval ("noparent", "on");
|
setoptval ("noparent", "on");
|
||||||
break;
|
break;
|
||||||
case 136:
|
case 136:
|
||||||
setval ("deleteafter", "on");
|
setoptval ("deleteafter", "on");
|
||||||
break;
|
break;
|
||||||
case 137:
|
case 137:
|
||||||
setval ("retrsymlinks", "on");
|
setoptval ("retrsymlinks", "on");
|
||||||
break;
|
break;
|
||||||
case 138:
|
case 138:
|
||||||
setval ("ignorelength", "on");
|
setoptval ("ignorelength", "on");
|
||||||
break;
|
break;
|
||||||
case 139:
|
case 139:
|
||||||
setval ("passiveftp", "on");
|
setoptval ("passiveftp", "on");
|
||||||
break;
|
break;
|
||||||
case 141:
|
case 141:
|
||||||
setval ("noclobber", "on");
|
setoptval ("noclobber", "on");
|
||||||
break;
|
break;
|
||||||
case 142:
|
case 142:
|
||||||
setval ("followftp", "on");
|
setoptval ("followftp", "on");
|
||||||
break;
|
break;
|
||||||
case 145:
|
case 145:
|
||||||
setval ("cutdirs", optarg);
|
setoptval ("cutdirs", optarg);
|
||||||
break;
|
break;
|
||||||
case 146:
|
case 146:
|
||||||
setval ("verbose", "off");
|
setoptval ("verbose", "off");
|
||||||
break;
|
break;
|
||||||
case 147:
|
case 147:
|
||||||
setval ("dirstruct", "off");
|
setoptval ("dirstruct", "off");
|
||||||
break;
|
break;
|
||||||
case 148:
|
case 148:
|
||||||
setval ("addhostdir", "off");
|
setoptval ("addhostdir", "off");
|
||||||
break;
|
break;
|
||||||
case 149:
|
case 149:
|
||||||
setval ("removelisting", "off");
|
setoptval ("removelisting", "off");
|
||||||
break;
|
break;
|
||||||
case 155:
|
case 155:
|
||||||
setval ("bindaddress", optarg);
|
setoptval ("bindaddress", optarg);
|
||||||
break;
|
break;
|
||||||
case 156:
|
case 156:
|
||||||
setval ("httpkeepalive", "off");
|
setoptval ("httpkeepalive", "off");
|
||||||
break;
|
break;
|
||||||
case 165:
|
case 165:
|
||||||
setval ("randomwait", "on");
|
setoptval ("randomwait", "on");
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
setval ("background", "on");
|
setoptval ("background", "on");
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
setval ("continue", "on");
|
setoptval ("continue", "on");
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
setval ("debug", "on");
|
setoptval ("debug", "on");
|
||||||
#else /* not DEBUG */
|
#else /* not DEBUG */
|
||||||
fprintf (stderr, _("%s: debug support not compiled in.\n"),
|
fprintf (stderr, _("%s: debug support not compiled in.\n"),
|
||||||
exec_name);
|
exec_name);
|
||||||
#endif /* not DEBUG */
|
#endif /* not DEBUG */
|
||||||
break;
|
break;
|
||||||
case 'E':
|
case 'E':
|
||||||
setval ("htmlextension", "on");
|
setoptval ("htmlextension", "on");
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
setval ("forcehtml", "on");
|
setoptval ("forcehtml", "on");
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
setval ("spanhosts", "on");
|
setoptval ("spanhosts", "on");
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
print_help ();
|
print_help ();
|
||||||
@ -476,34 +476,34 @@ hpVqvdkKsxmNWrHSLcFbEY:G:g:T:U:O:l:n:i:o:a:t:D:A:R:P:B:e:Q:X:I:w:C:",
|
|||||||
exit (0);
|
exit (0);
|
||||||
break;
|
break;
|
||||||
case 'K':
|
case 'K':
|
||||||
setval ("backupconverted", "on");
|
setoptval ("backupconverted", "on");
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
setval ("convertlinks", "on");
|
setoptval ("convertlinks", "on");
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
setval ("relativeonly", "on");
|
setoptval ("relativeonly", "on");
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
setval ("mirror", "on");
|
setoptval ("mirror", "on");
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
setval ("timestamping", "on");
|
setoptval ("timestamping", "on");
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
setval ("pagerequisites", "on");
|
setoptval ("pagerequisites", "on");
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
setval ("serverresponse", "on");
|
setoptval ("serverresponse", "on");
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
setval ("saveheaders", "on");
|
setoptval ("saveheaders", "on");
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
setval ("quiet", "on");
|
setoptval ("quiet", "on");
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
setval ("recursive", "on");
|
setoptval ("recursive", "on");
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
printf ("GNU Wget %s\n\n", version_string);
|
printf ("GNU Wget %s\n\n", version_string);
|
||||||
@ -518,156 +518,141 @@ GNU General Public License for more details.\n"));
|
|||||||
exit (0);
|
exit (0);
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
setval ("verbose", "on");
|
setoptval ("verbose", "on");
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
setval ("dirstruct", "on");
|
setoptval ("dirstruct", "on");
|
||||||
break;
|
break;
|
||||||
case 174:
|
case 174:
|
||||||
setval ("retryconnrefused", "on");
|
setoptval ("retryconnrefused", "on");
|
||||||
break;
|
break;
|
||||||
case 177:
|
case 177:
|
||||||
setval ("strictcomments", "on");
|
setoptval ("strictcomments", "on");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Options accepting an argument: */
|
/* Options accepting an argument: */
|
||||||
case 129:
|
case 129:
|
||||||
setval ("httpuser", optarg);
|
setoptval ("httpuser", optarg);
|
||||||
break;
|
break;
|
||||||
case 130:
|
case 130:
|
||||||
setval ("httppasswd", optarg);
|
setoptval ("httppasswd", optarg);
|
||||||
break;
|
break;
|
||||||
case 131:
|
case 131:
|
||||||
setval ("header", optarg);
|
setoptval ("header", optarg);
|
||||||
break;
|
break;
|
||||||
case 134:
|
case 134:
|
||||||
setval ("dotstyle", optarg);
|
setoptval ("dotstyle", optarg);
|
||||||
break;
|
break;
|
||||||
case 135:
|
case 135:
|
||||||
setval ("htmlify", optarg);
|
setoptval ("htmlify", optarg);
|
||||||
break;
|
break;
|
||||||
case 140:
|
case 140:
|
||||||
setval ("excludedomains", optarg);
|
setoptval ("excludedomains", optarg);
|
||||||
break;
|
break;
|
||||||
case 143:
|
case 143:
|
||||||
setval ("proxyuser", optarg);
|
setoptval ("proxyuser", optarg);
|
||||||
break;
|
break;
|
||||||
case 144:
|
case 144:
|
||||||
setval ("proxypasswd", optarg);
|
setoptval ("proxypasswd", optarg);
|
||||||
break;
|
break;
|
||||||
case 151:
|
case 151:
|
||||||
setval ("backups", optarg);
|
setoptval ("backups", optarg);
|
||||||
break;
|
break;
|
||||||
case 152:
|
case 152:
|
||||||
setval ("waitretry", optarg);
|
setoptval ("waitretry", optarg);
|
||||||
break;
|
break;
|
||||||
case 153:
|
case 153:
|
||||||
setval ("followtags", optarg);
|
setoptval ("followtags", optarg);
|
||||||
break;
|
break;
|
||||||
case 160:
|
case 160:
|
||||||
setval ("cookies", optarg);
|
setoptval ("cookies", optarg);
|
||||||
break;
|
break;
|
||||||
case 161:
|
case 161:
|
||||||
setval ("loadcookies", optarg);
|
setoptval ("loadcookies", optarg);
|
||||||
break;
|
break;
|
||||||
case 162:
|
case 162:
|
||||||
setval ("savecookies", optarg);
|
setoptval ("savecookies", optarg);
|
||||||
break;
|
break;
|
||||||
case 163:
|
case 163:
|
||||||
setval ("progress", optarg);
|
setoptval ("progress", optarg);
|
||||||
break;
|
break;
|
||||||
case 164:
|
case 164:
|
||||||
setval ("limitrate", optarg);
|
setoptval ("limitrate", optarg);
|
||||||
break;
|
break;
|
||||||
case 157:
|
case 157:
|
||||||
setval ("referer", optarg);
|
setoptval ("referer", optarg);
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_SSL
|
#ifdef HAVE_SSL
|
||||||
case 158:
|
case 158:
|
||||||
setval ("sslcertfile", optarg);
|
setoptval ("sslcertfile", optarg);
|
||||||
break;
|
break;
|
||||||
case 159:
|
case 159:
|
||||||
setval ("sslcertkey", optarg);
|
setoptval ("sslcertkey", optarg);
|
||||||
break;
|
break;
|
||||||
case 166:
|
case 166:
|
||||||
setval ("egdfile", optarg);
|
setoptval ("egdfile", optarg);
|
||||||
break;
|
break;
|
||||||
case 169:
|
case 169:
|
||||||
setval ("sslcadir", optarg);
|
setoptval ("sslcadir", optarg);
|
||||||
break;
|
break;
|
||||||
case 170:
|
case 170:
|
||||||
setval ("sslcafile", optarg);
|
setoptval ("sslcafile", optarg);
|
||||||
break;
|
break;
|
||||||
case 171:
|
case 171:
|
||||||
setval ("sslcerttype", optarg);
|
setoptval ("sslcerttype", optarg);
|
||||||
break;
|
break;
|
||||||
case 172:
|
case 172:
|
||||||
setval ("sslcheckcert", optarg);
|
setoptval ("sslcheckcert", optarg);
|
||||||
break;
|
break;
|
||||||
case 173:
|
case 173:
|
||||||
setval ("sslprotocol", optarg);
|
setoptval ("sslprotocol", optarg);
|
||||||
break;
|
break;
|
||||||
#endif /* HAVE_SSL */
|
#endif /* HAVE_SSL */
|
||||||
case 167:
|
case 167:
|
||||||
setval ("postdata", optarg);
|
setoptval ("postdata", optarg);
|
||||||
break;
|
break;
|
||||||
case 168:
|
case 168:
|
||||||
setval ("postfile", optarg);
|
setoptval ("postfile", optarg);
|
||||||
break;
|
break;
|
||||||
case 175:
|
case 175:
|
||||||
setval ("dnscache", optarg);
|
setoptval ("dnscache", optarg);
|
||||||
break;
|
break;
|
||||||
case 176:
|
case 176:
|
||||||
setval ("restrictfilenames", optarg);
|
setoptval ("restrictfilenames", optarg);
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
setval ("accept", optarg);
|
setoptval ("accept", optarg);
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
setval ("logfile", optarg);
|
setoptval ("logfile", optarg);
|
||||||
append_to_log = 1;
|
append_to_log = 1;
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
setval ("base", optarg);
|
setoptval ("base", optarg);
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
setval ("cache", optarg);
|
setoptval ("cache", optarg);
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
setval ("domains", optarg);
|
setoptval ("domains", optarg);
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
{
|
run_command (optarg);
|
||||||
char *com, *val;
|
|
||||||
if (parse_line (optarg, &com, &val))
|
|
||||||
{
|
|
||||||
if (!setval (com, val))
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf (stderr, _("%s: %s: invalid command\n"), exec_name,
|
|
||||||
optarg);
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
xfree (com);
|
|
||||||
xfree (val);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'G':
|
case 'G':
|
||||||
setval ("ignoretags", optarg);
|
setoptval ("ignoretags", optarg);
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
setval ("glob", optarg);
|
setoptval ("glob", optarg);
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
setval ("includedirectories", optarg);
|
setoptval ("includedirectories", optarg);
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
setval ("input", optarg);
|
setoptval ("input", optarg);
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
setval ("reclevel", optarg);
|
setoptval ("reclevel", optarg);
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
{
|
{
|
||||||
@ -678,25 +663,25 @@ GNU General Public License for more details.\n"));
|
|||||||
switch (*p)
|
switch (*p)
|
||||||
{
|
{
|
||||||
case 'v':
|
case 'v':
|
||||||
setval ("verbose", "off");
|
setoptval ("verbose", "off");
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
setval ("addhostdir", "off");
|
setoptval ("addhostdir", "off");
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
setval ("dirstruct", "off");
|
setoptval ("dirstruct", "off");
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
setval ("noclobber", "on");
|
setoptval ("noclobber", "on");
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
setval ("removelisting", "off");
|
setoptval ("removelisting", "off");
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
setval ("noparent", "on");
|
setoptval ("noparent", "on");
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
setval ("httpkeepalive", "off");
|
setoptval ("httpkeepalive", "off");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf (_("%s: illegal option -- `-n%c'\n"), exec_name, *p);
|
printf (_("%s: illegal option -- `-n%c'\n"), exec_name, *p);
|
||||||
@ -708,37 +693,37 @@ GNU General Public License for more details.\n"));
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'O':
|
case 'O':
|
||||||
setval ("outputdocument", optarg);
|
setoptval ("outputdocument", optarg);
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
setval ("logfile", optarg);
|
setoptval ("logfile", optarg);
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
setval ("dirprefix", optarg);
|
setoptval ("dirprefix", optarg);
|
||||||
break;
|
break;
|
||||||
case 'Q':
|
case 'Q':
|
||||||
setval ("quota", optarg);
|
setoptval ("quota", optarg);
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
setval ("reject", optarg);
|
setoptval ("reject", optarg);
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
setval ("timeout", optarg);
|
setoptval ("timeout", optarg);
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
setval ("tries", optarg);
|
setoptval ("tries", optarg);
|
||||||
break;
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
setval ("useragent", optarg);
|
setoptval ("useragent", optarg);
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
setval ("wait", optarg);
|
setoptval ("wait", optarg);
|
||||||
break;
|
break;
|
||||||
case 'X':
|
case 'X':
|
||||||
setval ("excludedirectories", optarg);
|
setoptval ("excludedirectories", optarg);
|
||||||
break;
|
break;
|
||||||
case 'Y':
|
case 'Y':
|
||||||
setval ("useproxy", optarg);
|
setoptval ("useproxy", optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
|
Loading…
Reference in New Issue
Block a user