mirror of https://github.com/mirror/busybox.git
- add -s|--spider which only checks if the file exists but does not download it's content.
Closes #12911_6_stable
parent
6d79dd66cb
commit
2e75dcc80d
|
@ -3056,7 +3056,7 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Prints names of all matching files even when
|
||||||
" %i File System ID in hex\n" \
|
" %i File System ID in hex\n" \
|
||||||
" %l Maximum length of filenames\n" \
|
" %l Maximum length of filenames\n" \
|
||||||
" %n File name\n" \
|
" %n File name\n" \
|
||||||
" %s Block size (for faster transfers)\n" \
|
" %s Block size (for faster transfer)\n" \
|
||||||
" %S Fundamental block size (for block counts)\n" \
|
" %S Fundamental block size (for block counts)\n" \
|
||||||
" %t Type in hex\n" \
|
" %t Type in hex\n" \
|
||||||
" %T Type in human readable form" \
|
" %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
|
||||||
" 31 46 1365 /etc/passwd\n"
|
" 31 46 1365 /etc/passwd\n"
|
||||||
|
|
||||||
#define wget_trivial_usage \
|
#define wget_trivial_usage \
|
||||||
"[-c|--continue] [-q|--quiet] [-O|--output-document file]\n" \
|
"[-c|--continue] [-s|--spider] [-q|--quiet] [-O|--output-document file]\n" \
|
||||||
" [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]\n" \
|
" [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]\n" \
|
||||||
" [-U|--user-agent agent] url"
|
" [-U|--user-agent agent] url"
|
||||||
#define wget_full_usage \
|
#define wget_full_usage \
|
||||||
"Retrieve files via HTTP or FTP" \
|
"Retrieve files via HTTP or FTP" \
|
||||||
"\n\nOptions:\n" \
|
"\n\nOptions:\n" \
|
||||||
" -c Continue retrieval of aborted transfers\n" \
|
" -s Spider mode - only check file existence\n" \
|
||||||
|
" -c Continue retrieval of aborted transfer\n" \
|
||||||
" -q Quiet\n" \
|
" -q Quiet\n" \
|
||||||
" -P Set directory prefix to DIR\n" \
|
" -P Set directory prefix to DIR\n" \
|
||||||
" -O Save to filename ('-' for stdout)\n" \
|
" -O Save to filename ('-' for stdout)\n" \
|
||||||
|
|
|
@ -120,18 +120,20 @@ int wget_main(int argc, char **argv)
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
WGET_OPT_CONTINUE = 0x1,
|
WGET_OPT_CONTINUE = 0x1,
|
||||||
WGET_OPT_QUIET = 0x2,
|
WGET_OPT_SPIDER = 0x2,
|
||||||
WGET_OPT_OUTNAME = 0x4,
|
WGET_OPT_QUIET = 0x4,
|
||||||
WGET_OPT_PREFIX = 0x8,
|
WGET_OPT_OUTNAME = 0x8,
|
||||||
WGET_OPT_PROXY = 0x10,
|
WGET_OPT_PREFIX = 0x10,
|
||||||
WGET_OPT_USER_AGENT = 0x20,
|
WGET_OPT_PROXY = 0x20,
|
||||||
WGET_OPT_PASSIVE = 0x40,
|
WGET_OPT_USER_AGENT = 0x40,
|
||||||
WGET_OPT_HEADER = 0x80,
|
WGET_OPT_PASSIVE = 0x80,
|
||||||
|
WGET_OPT_HEADER = 0x100,
|
||||||
};
|
};
|
||||||
#if ENABLE_FEATURE_WGET_LONG_OPTIONS
|
#if ENABLE_FEATURE_WGET_LONG_OPTIONS
|
||||||
static const struct option wget_long_options[] = {
|
static const struct option wget_long_options[] = {
|
||||||
// name, has_arg, flag, val
|
// name, has_arg, flag, val
|
||||||
{ "continue", no_argument, NULL, 'c' },
|
{ "continue", no_argument, NULL, 'c' },
|
||||||
|
{ "spider", no_argument, NULL, 's' },
|
||||||
{ "quiet", no_argument, NULL, 'q' },
|
{ "quiet", no_argument, NULL, 'q' },
|
||||||
{ "output-document", required_argument, NULL, 'O' },
|
{ "output-document", required_argument, NULL, 'O' },
|
||||||
{ "directory-prefix", required_argument, NULL, 'P' },
|
{ "directory-prefix", required_argument, NULL, 'P' },
|
||||||
|
@ -144,7 +146,7 @@ int wget_main(int argc, char **argv)
|
||||||
applet_long_options = wget_long_options;
|
applet_long_options = wget_long_options;
|
||||||
#endif
|
#endif
|
||||||
opt_complementary = "-1" USE_FEATURE_WGET_LONG_OPTIONS(":\xfe::");
|
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,
|
&fname_out, &dir_prefix,
|
||||||
&proxy_flag, &user_agent
|
&proxy_flag, &user_agent
|
||||||
USE_FEATURE_WGET_LONG_OPTIONS(, &headers_llist)
|
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)
|
if (ftpcmd("RETR ", target.path, sfp, buf) > 150)
|
||||||
bb_error_msg_and_die("bad response to RETR: %s", buf);
|
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
|
* Retrieve file
|
||||||
|
@ -499,6 +505,7 @@ int wget_main(int argc, char **argv)
|
||||||
bb_error_msg_and_die("ftp error: %s", buf+4);
|
bb_error_msg_and_die("ftp error: %s", buf+4);
|
||||||
ftpcmd("QUIT", NULL, sfp, buf);
|
ftpcmd("QUIT", NULL, sfp, buf);
|
||||||
}
|
}
|
||||||
|
done:
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue