summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2007-04-05 10:31:47 +0000
committerBernhard Reutner-Fischer2007-04-05 10:31:47 +0000
commit2e75dcc80d6dd2ad8858d6c343d25e6a8c5e4812 (patch)
tree51e6afadebbdb032855e86f69476daa71734fac7 /networking
parent6d79dd66cbeca350366103c8300c0335259e86a3 (diff)
downloadbusybox-2e75dcc80d6dd2ad8858d6c343d25e6a8c5e4812.zip
busybox-2e75dcc80d6dd2ad8858d6c343d25e6a8c5e4812.tar.gz
- add -s|--spider which only checks if the file exists but does not download it's content.
Closes #1291
Diffstat (limited to 'networking')
-rw-r--r--networking/wget.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/networking/wget.c b/networking/wget.c
index db22215..94b9b69 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -120,18 +120,20 @@ int wget_main(int argc, char **argv)
*/
enum {
WGET_OPT_CONTINUE = 0x1,
- WGET_OPT_QUIET = 0x2,
- WGET_OPT_OUTNAME = 0x4,
- WGET_OPT_PREFIX = 0x8,
- WGET_OPT_PROXY = 0x10,
- WGET_OPT_USER_AGENT = 0x20,
- WGET_OPT_PASSIVE = 0x40,
- WGET_OPT_HEADER = 0x80,
+ WGET_OPT_SPIDER = 0x2,
+ WGET_OPT_QUIET = 0x4,
+ WGET_OPT_OUTNAME = 0x8,
+ WGET_OPT_PREFIX = 0x10,
+ WGET_OPT_PROXY = 0x20,
+ WGET_OPT_USER_AGENT = 0x40,
+ WGET_OPT_PASSIVE = 0x80,
+ WGET_OPT_HEADER = 0x100,
};
#if ENABLE_FEATURE_WGET_LONG_OPTIONS
static const struct option wget_long_options[] = {
// name, has_arg, flag, val
{ "continue", no_argument, NULL, 'c' },
+ { "spider", no_argument, NULL, 's' },
{ "quiet", no_argument, NULL, 'q' },
{ "output-document", required_argument, NULL, 'O' },
{ "directory-prefix", required_argument, NULL, 'P' },
@@ -144,7 +146,7 @@ int wget_main(int argc, char **argv)
applet_long_options = wget_long_options;
#endif
opt_complementary = "-1" USE_FEATURE_WGET_LONG_OPTIONS(":\xfe::");
- opt = getopt32(argc, argv, "cqO:P:Y:U:",
+ opt = getopt32(argc, argv, "csqO:P:Y:U:",
&fname_out, &dir_prefix,
&proxy_flag, &user_agent
USE_FEATURE_WGET_LONG_OPTIONS(, &headers_llist)
@@ -437,7 +439,11 @@ int wget_main(int argc, char **argv)
if (ftpcmd("RETR ", target.path, sfp, buf) > 150)
bb_error_msg_and_die("bad response to RETR: %s", buf);
}
-
+ if (opt & WGET_OPT_SPIDER) {
+ if (ENABLE_FEATURE_CLEAN_UP)
+ fclose(sfp);
+ goto done;
+ }
/*
* Retrieve file
@@ -499,6 +505,7 @@ int wget_main(int argc, char **argv)
bb_error_msg_and_die("ftp error: %s", buf+4);
ftpcmd("QUIT", NULL, sfp, buf);
}
+done:
exit(EXIT_SUCCESS);
}