aboutsummaryrefslogtreecommitdiff
path: root/wget.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-10-02 23:19:38 +0000
committerEric Andersen <andersen@codepoet.org>2000-10-02 23:19:38 +0000
commit25b669c144949816d3c9726c79dbd6e93d53ee8b (patch)
tree74f90fad907796eb599aeb495e223703f2cd741c /wget.c
parentba1ff9b4eb4085b656a65df870865eeeb565fe5e (diff)
downloadbusybox-25b669c144949816d3c9726c79dbd6e93d53ee8b.tar.gz
Try to guess an output filename
Diffstat (limited to 'wget.c')
-rw-r--r--wget.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/wget.c b/wget.c
index 58801ee47..c95271b0d 100644
--- a/wget.c
+++ b/wget.c
@@ -56,10 +56,18 @@ int wget_main(int argc, char **argv)
usage(wget_usage);
}
}
- if (do_continue && !fname_out)
- fatalError("wget: cannot specify continue (-c) without a filename (-O)\n");
+
if (argc - optind != 1)
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.
*/