Try to guess an output filename

This commit is contained in:
Eric Andersen 2000-10-02 23:19:38 +00:00
parent ba1ff9b4eb
commit 25b669c144
2 changed files with 20 additions and 4 deletions

View File

@ -56,10 +56,18 @@ int wget_main(int argc, char **argv)
usage(wget_usage); usage(wget_usage);
} }
} }
if (do_continue && !fname_out)
fatalError("wget: cannot specify continue (-c) without a filename (-O)\n");
if (argc - optind != 1) if (argc - optind != 1)
usage(wget_usage); usage(wget_usage);
/* Guess an output filename */
if (!fname_out) {
fname_out = get_last_path_component(argv[optind]);
}
if (do_continue && !fname_out)
fatalError("wget: cannot specify continue (-c) without a filename (-O)\n");
/* /*
* Parse url into components. * Parse url into components.
*/ */

12
wget.c
View File

@ -56,10 +56,18 @@ int wget_main(int argc, char **argv)
usage(wget_usage); usage(wget_usage);
} }
} }
if (do_continue && !fname_out)
fatalError("wget: cannot specify continue (-c) without a filename (-O)\n");
if (argc - optind != 1) if (argc - optind != 1)
usage(wget_usage); usage(wget_usage);
/* Guess an output filename */
if (!fname_out) {
fname_out = get_last_path_component(argv[optind]);
}
if (do_continue && !fname_out)
fatalError("wget: cannot specify continue (-c) without a filename (-O)\n");
/* /*
* Parse url into components. * Parse url into components.
*/ */