/* Command line parsing.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Wget.
OPT__NO,
OPT__PARENT,
} type;
- void *data; /* for standard options */
+ const void *data; /* for standard options */
int argtype; /* for non-standard options */
};
{ "follow-tags", 0, OPT_VALUE, "followtags", -1 },
{ "force-directories", 'x', OPT_BOOLEAN, "dirstruct", -1 },
{ "force-html", 'F', OPT_BOOLEAN, "forcehtml", -1 },
+ { "ftp-passwd", 0, OPT_VALUE, "ftppasswd", -1 },
{ "glob", 0, OPT_BOOLEAN, "glob", -1 },
{ "header", 0, OPT_VALUE, "header", -1 },
{ "help", 'h', OPT_FUNCALL, (void *)print_help, no_argument },
{ "post-file", 0, OPT_VALUE, "postfile", -1 },
{ "preserve-permissions", 0, OPT_BOOLEAN, "preservepermissions", -1 },
{ "progress", 0, OPT_VALUE, "progress", -1 },
+ { "protocol-directories", 0, OPT_BOOLEAN, "protocoldirectories", -1 },
{ "proxy", 'Y', OPT_BOOLEAN, "useproxy", -1 },
{ "proxy-passwd", 0, OPT_VALUE, "proxypasswd", -1 },
{ "proxy-user", 0, OPT_VALUE, "proxyuser", -1 },
-x, --force-directories force creation of directories.\n"),
N_("\
-nH, --no-host-directories don't create host directories.\n"),
+ N_("\
+ --protocol-directories use protocol name in directories.\n"),
N_("\
-P, --directory-prefix=PREFIX save files to PREFIX/...\n"),
N_("\
for (i = 0; i < countof (help); i++)
fputs (_(help[i]), stdout);
-#ifdef WINDOWS
- ws_help (exec_name);
-#endif
exit (0);
}
{
printf ("GNU Wget %s\n\n", version_string);
fputs (_("\
-Copyright (C) 2003 Free Software Foundation, Inc.\n"), stdout);
+Copyright (C) 2005 Free Software Foundation, Inc.\n"), stdout);
fputs (_("\
This program is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
++exec_name;
#ifdef WINDOWS
- windows_main_junk (&argc, (char **) argv, (char **) &exec_name);
+ /* Drop extension (typically .EXE) from executable filename. */
+ windows_main (&argc, (char **) argv, (char **) &exec_name);
#endif
/* Set option defaults; read the system wgetrc and ~/.wgetrc. */
{
int val;
struct cmdline_option *opt;
- if (ret == '?')
- {
- print_usage ();
- printf ("\n");
- printf (_("Try `%s --help' for more options.\n"), exec_name);
- exit (2);
- }
/* If LONGINDEX is unchanged, it means RET is referring a short
- option. Look it up in the mapping table. */
+ option. */
if (longindex == -1)
- longindex = optmap[ret - 32];
+ {
+ if (ret == '?')
+ {
+ print_usage ();
+ printf ("\n");
+ printf (_("Try `%s --help' for more options.\n"), exec_name);
+ exit (2);
+ }
+ /* Find the short option character in the mapping. */
+ longindex = optmap[ret - 32];
+ }
val = long_options[longindex].val;
/* Use the retrieved value to locate the option in the
break;
case OPT_FUNCALL:
{
- void (*func) PARAMS ((void)) = opt->data;
+ void (*func) PARAMS ((void)) = (void (*) PARAMS ((void))) opt->data;
func ();
}
break;
}
url[i] = NULL;
- /* Change the title of console window on Windows. #### I think this
- statement should belong to retrieve_url(). --hniksic. */
-#ifdef WINDOWS
- ws_changetitle (*url, nurl);
-#endif
-
/* Initialize logging. */
log_init (opt.lfilename, append_to_log);
/* Open the output filename if necessary. */
if (opt.output_document)
{
+ extern FILE *output_stream;
+ extern int output_stream_regular;
+
if (HYPHENP (opt.output_document))
- opt.dfp = stdout;
+ output_stream = stdout;
else
{
- struct stat st;
- opt.dfp = fopen (opt.output_document, opt.always_rest ? "ab" : "wb");
- if (opt.dfp == NULL)
+ struct_stat st;
+ output_stream = fopen (opt.output_document,
+ opt.always_rest ? "ab" : "wb");
+ if (output_stream == NULL)
{
perror (opt.output_document);
exit (1);
}
- if (fstat (fileno (opt.dfp), &st) == 0 && S_ISREG (st.st_mode))
- opt.od_known_regular = 1;
+ if (fstat (fileno (output_stream), &st) == 0 && S_ISREG (st.st_mode))
+ output_stream_regular = 1;
}
}
static RETSIGTYPE
redirect_output_signal (int sig)
{
- char *signal_name = (sig == SIGHUP ? "SIGHUP" :
- (sig == SIGUSR1 ? "SIGUSR1" :
- "WTF?!"));
+ const char *signal_name = (sig == SIGHUP ? "SIGHUP" :
+ (sig == SIGUSR1 ? "SIGUSR1" :
+ "WTF?!"));
log_request_redirect_output (signal_name);
progress_schedule_redirect ();
signal (sig, redirect_output_signal);