From 96556303b85181257758e18b057ec27f2399be00 Mon Sep 17 00:00:00 2001 From: andersen Date: Mon, 2 Oct 2000 23:19:38 +0000 Subject: Try to guess an output filename git-svn-id: svn://busybox.net/trunk/busybox@1143 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- wget.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'wget.c') 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. */ -- cgit v1.2.3-55-g6feb