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 /networking/wget.c | |
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
Diffstat (limited to 'networking/wget.c')
-rw-r--r-- | networking/wget.c | 25 |
1 files changed, 16 insertions, 9 deletions
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 | ||