Add new -O option

This commit is contained in:
Mario Fetka 2010-09-01 07:52:27 +02:00
parent 327a9a50ec
commit dcbf78a9a1
2 changed files with 19 additions and 2 deletions

View File

@ -31,6 +31,10 @@ Increase the amount of information sent to stdout
.TP
\-\-no\-curses
Don't use the Curses interface, but the traditional plain text interface
.SH "Filess:"
.TP
\-P, \-\-output\-document=FILE
write documents to FILE
.SH "Directories:"
.TP
\-P, \-\-directory\-prefix=DIR

View File

@ -59,6 +59,7 @@ struct option long_opts[] = {
{"tries", required_argument, NULL, 't'},
{"force", no_argument, NULL, 'f'},
{"version", no_argument, NULL, 'v'},
{"output-document", required_argument, NULL, 'O'},
{"directory-prefix", required_argument, NULL, 'P'},
{"use-port", no_argument, NULL, 129},
{"retry-delay", required_argument, NULL, 130},
@ -133,6 +134,9 @@ help (void)
" -v,--verbose Increase the amount of information sent to stdout\n"
" --no-curses Don't use Curses, plain text to stdout\n"
"\n"
"Files:\n"
" -O, --output-document=FILE write documents to FILE\n"
"\n"
"Directories:\n"
" -P, --directory-prefix=DIR save the generated file to DIR/\n"
"\n"
@ -216,12 +220,13 @@ main (int argc, char **argv)
{
int c;
int ret;
char *opt_file = NULL;
proz_init (argc, argv); //init libprozilla
set_defaults (); //set some reasonable defaults
load_prefs (); //load values from the config file
while ((c =
getopt_long (argc, argv, "?hvrfk:1Lt:VgsP:", long_opts,
getopt_long (argc, argv, "?hvrfk:1Lt:VgsP:O:", long_opts,
NULL)) != EOF)
{
switch (c)
@ -274,7 +279,12 @@ main (int argc, char **argv)
*/
rt.use_netrc = FALSE;
break;
case 'O':
/*
* Output file name
*/
opt_file = kstrdup(optarg);
break;
case 'P':
/*
* Save the downloaded file to DIR
@ -503,6 +513,9 @@ main (int argc, char **argv)
exit (0);
}
if (opt_file)
url_data->file=opt_file;
PrintMessage("Starting.....");
//In to %s\n",url_data->host);
// start the download