diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2007-04-05 10:31:47 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2007-04-05 10:31:47 +0000 |
commit | 2e75dcc80d6dd2ad8858d6c343d25e6a8c5e4812 (patch) | |
tree | 51e6afadebbdb032855e86f69476daa71734fac7 | |
parent | 6d79dd66cbeca350366103c8300c0335259e86a3 (diff) | |
download | busybox-w32-2e75dcc80d6dd2ad8858d6c343d25e6a8c5e4812.tar.gz busybox-w32-2e75dcc80d6dd2ad8858d6c343d25e6a8c5e4812.tar.bz2 busybox-w32-2e75dcc80d6dd2ad8858d6c343d25e6a8c5e4812.zip |
- add -s|--spider which only checks if the file exists but does not download it's content.
Closes #1291
-rw-r--r-- | include/usage.h | 7 | ||||
-rw-r--r-- | networking/wget.c | 25 |
2 files changed, 20 insertions, 12 deletions
diff --git a/include/usage.h b/include/usage.h index 1889010dd..f4edf0556 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -3056,7 +3056,7 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Prints names of all matching files even when | |||
3056 | " %i File System ID in hex\n" \ | 3056 | " %i File System ID in hex\n" \ |
3057 | " %l Maximum length of filenames\n" \ | 3057 | " %l Maximum length of filenames\n" \ |
3058 | " %n File name\n" \ | 3058 | " %n File name\n" \ |
3059 | " %s Block size (for faster transfers)\n" \ | 3059 | " %s Block size (for faster transfer)\n" \ |
3060 | " %S Fundamental block size (for block counts)\n" \ | 3060 | " %S Fundamental block size (for block counts)\n" \ |
3061 | " %t Type in hex\n" \ | 3061 | " %t Type in hex\n" \ |
3062 | " %T Type in human readable form" \ | 3062 | " %T Type in human readable form" \ |
@@ -3686,13 +3686,14 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Prints names of all matching files even when | |||
3686 | " 31 46 1365 /etc/passwd\n" | 3686 | " 31 46 1365 /etc/passwd\n" |
3687 | 3687 | ||
3688 | #define wget_trivial_usage \ | 3688 | #define wget_trivial_usage \ |
3689 | "[-c|--continue] [-q|--quiet] [-O|--output-document file]\n" \ | 3689 | "[-c|--continue] [-s|--spider] [-q|--quiet] [-O|--output-document file]\n" \ |
3690 | " [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]\n" \ | 3690 | " [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]\n" \ |
3691 | " [-U|--user-agent agent] url" | 3691 | " [-U|--user-agent agent] url" |
3692 | #define wget_full_usage \ | 3692 | #define wget_full_usage \ |
3693 | "Retrieve files via HTTP or FTP" \ | 3693 | "Retrieve files via HTTP or FTP" \ |
3694 | "\n\nOptions:\n" \ | 3694 | "\n\nOptions:\n" \ |
3695 | " -c Continue retrieval of aborted transfers\n" \ | 3695 | " -s Spider mode - only check file existence\n" \ |
3696 | " -c Continue retrieval of aborted transfer\n" \ | ||
3696 | " -q Quiet\n" \ | 3697 | " -q Quiet\n" \ |
3697 | " -P Set directory prefix to DIR\n" \ | 3698 | " -P Set directory prefix to DIR\n" \ |
3698 | " -O Save to filename ('-' for stdout)\n" \ | 3699 | " -O Save to filename ('-' for stdout)\n" \ |
diff --git a/networking/wget.c b/networking/wget.c index db222156b..94b9b6954 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -120,18 +120,20 @@ int wget_main(int argc, char **argv) | |||
120 | */ | 120 | */ |
121 | enum { | 121 | enum { |
122 | WGET_OPT_CONTINUE = 0x1, | 122 | WGET_OPT_CONTINUE = 0x1, |
123 | WGET_OPT_QUIET = 0x2, | 123 | WGET_OPT_SPIDER = 0x2, |
124 | WGET_OPT_OUTNAME = 0x4, | 124 | WGET_OPT_QUIET = 0x4, |
125 | WGET_OPT_PREFIX = 0x8, | 125 | WGET_OPT_OUTNAME = 0x8, |
126 | WGET_OPT_PROXY = 0x10, | 126 | WGET_OPT_PREFIX = 0x10, |
127 | WGET_OPT_USER_AGENT = 0x20, | 127 | WGET_OPT_PROXY = 0x20, |
128 | WGET_OPT_PASSIVE = 0x40, | 128 | WGET_OPT_USER_AGENT = 0x40, |
129 | WGET_OPT_HEADER = 0x80, | 129 | WGET_OPT_PASSIVE = 0x80, |
130 | WGET_OPT_HEADER = 0x100, | ||
130 | }; | 131 | }; |
131 | #if ENABLE_FEATURE_WGET_LONG_OPTIONS | 132 | #if ENABLE_FEATURE_WGET_LONG_OPTIONS |
132 | static const struct option wget_long_options[] = { | 133 | static const struct option wget_long_options[] = { |
133 | // name, has_arg, flag, val | 134 | // name, has_arg, flag, val |
134 | { "continue", no_argument, NULL, 'c' }, | 135 | { "continue", no_argument, NULL, 'c' }, |
136 | { "spider", no_argument, NULL, 's' }, | ||
135 | { "quiet", no_argument, NULL, 'q' }, | 137 | { "quiet", no_argument, NULL, 'q' }, |
136 | { "output-document", required_argument, NULL, 'O' }, | 138 | { "output-document", required_argument, NULL, 'O' }, |
137 | { "directory-prefix", required_argument, NULL, 'P' }, | 139 | { "directory-prefix", required_argument, NULL, 'P' }, |
@@ -144,7 +146,7 @@ int wget_main(int argc, char **argv) | |||
144 | applet_long_options = wget_long_options; | 146 | applet_long_options = wget_long_options; |
145 | #endif | 147 | #endif |
146 | opt_complementary = "-1" USE_FEATURE_WGET_LONG_OPTIONS(":\xfe::"); | 148 | opt_complementary = "-1" USE_FEATURE_WGET_LONG_OPTIONS(":\xfe::"); |
147 | opt = getopt32(argc, argv, "cqO:P:Y:U:", | 149 | opt = getopt32(argc, argv, "csqO:P:Y:U:", |
148 | &fname_out, &dir_prefix, | 150 | &fname_out, &dir_prefix, |
149 | &proxy_flag, &user_agent | 151 | &proxy_flag, &user_agent |
150 | USE_FEATURE_WGET_LONG_OPTIONS(, &headers_llist) | 152 | USE_FEATURE_WGET_LONG_OPTIONS(, &headers_llist) |
@@ -437,7 +439,11 @@ int wget_main(int argc, char **argv) | |||
437 | if (ftpcmd("RETR ", target.path, sfp, buf) > 150) | 439 | if (ftpcmd("RETR ", target.path, sfp, buf) > 150) |
438 | bb_error_msg_and_die("bad response to RETR: %s", buf); | 440 | bb_error_msg_and_die("bad response to RETR: %s", buf); |
439 | } | 441 | } |
440 | 442 | if (opt & WGET_OPT_SPIDER) { | |
443 | if (ENABLE_FEATURE_CLEAN_UP) | ||
444 | fclose(sfp); | ||
445 | goto done; | ||
446 | } | ||
441 | 447 | ||
442 | /* | 448 | /* |
443 | * Retrieve file | 449 | * Retrieve file |
@@ -499,6 +505,7 @@ int wget_main(int argc, char **argv) | |||
499 | bb_error_msg_and_die("ftp error: %s", buf+4); | 505 | bb_error_msg_and_die("ftp error: %s", buf+4); |
500 | ftpcmd("QUIT", NULL, sfp, buf); | 506 | ftpcmd("QUIT", NULL, sfp, buf); |
501 | } | 507 | } |
508 | done: | ||
502 | exit(EXIT_SUCCESS); | 509 | exit(EXIT_SUCCESS); |
503 | } | 510 | } |
504 | 511 | ||