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