aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-10-04 04:23:09 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-10-04 04:23:09 +0200
commit2972e2c4acb9c46a8cc05c857acac2b3d439bf69 (patch)
tree73d9b855f900da18f71a3eb943100cefb20f3a57
parenta85740c8afe6942beff90fec345403b37b2a9092 (diff)
downloadbusybox-w32-2972e2c4acb9c46a8cc05c857acac2b3d439bf69.tar.gz
busybox-w32-2972e2c4acb9c46a8cc05c857acac2b3d439bf69.tar.bz2
busybox-w32-2972e2c4acb9c46a8cc05c857acac2b3d439bf69.zip
wget: there is no -s option in GNU Wget 1.18, we should be compatible
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/wget.c57
1 files changed, 33 insertions, 24 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 8e642cbbe..b082a0f59 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -100,7 +100,7 @@
100 100
101//usage:#define wget_trivial_usage 101//usage:#define wget_trivial_usage
102//usage: IF_FEATURE_WGET_LONG_OPTIONS( 102//usage: IF_FEATURE_WGET_LONG_OPTIONS(
103//usage: "[-c|--continue] [-s|--spider] [-q|--quiet] [-O|--output-document FILE]\n" 103//usage: "[-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE]\n"
104//usage: " [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]\n" 104//usage: " [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]\n"
105/* Since we ignore these opts, we don't show them in --help */ 105/* Since we ignore these opts, we don't show them in --help */
106/* //usage: " [--no-check-certificate] [--no-cache] [--passive-ftp] [-t TRIES]" */ 106/* //usage: " [--no-check-certificate] [--no-cache] [--passive-ftp] [-t TRIES]" */
@@ -108,21 +108,23 @@
108//usage: " [-U|--user-agent AGENT]" IF_FEATURE_WGET_TIMEOUT(" [-T SEC]") " URL..." 108//usage: " [-U|--user-agent AGENT]" IF_FEATURE_WGET_TIMEOUT(" [-T SEC]") " URL..."
109//usage: ) 109//usage: )
110//usage: IF_NOT_FEATURE_WGET_LONG_OPTIONS( 110//usage: IF_NOT_FEATURE_WGET_LONG_OPTIONS(
111//usage: "[-csq] [-O FILE] [-Y on/off] [-P DIR] [-U AGENT]" 111//usage: "[-cq] [-O FILE] [-Y on/off] [-P DIR] [-U AGENT]"
112//usage: IF_FEATURE_WGET_TIMEOUT(" [-T SEC]") " URL..." 112//usage: IF_FEATURE_WGET_TIMEOUT(" [-T SEC]") " URL..."
113//usage: ) 113//usage: )
114//usage:#define wget_full_usage "\n\n" 114//usage:#define wget_full_usage "\n\n"
115//usage: "Retrieve files via HTTP or FTP\n" 115//usage: "Retrieve files via HTTP or FTP\n"
116//usage: "\n -s Spider mode - only check file existence" 116//usage: IF_FEATURE_WGET_LONG_OPTIONS(
117//usage: "\n -c Continue retrieval of aborted transfer" 117//usage: "\n --spider Spider mode - only check file existence"
118//usage: "\n -q Quiet" 118//usage: )
119//usage: "\n -P DIR Save to DIR (default .)" 119//usage: "\n -c Continue retrieval of aborted transfer"
120//usage: "\n -q Quiet"
121//usage: "\n -P DIR Save to DIR (default .)"
120//usage: IF_FEATURE_WGET_TIMEOUT( 122//usage: IF_FEATURE_WGET_TIMEOUT(
121//usage: "\n -T SEC Network read timeout is SEC seconds" 123//usage: "\n -T SEC Network read timeout is SEC seconds"
122//usage: ) 124//usage: )
123//usage: "\n -O FILE Save to FILE ('-' for stdout)" 125//usage: "\n -O FILE Save to FILE ('-' for stdout)"
124//usage: "\n -U STR Use STR for User-Agent header" 126//usage: "\n -U STR Use STR for User-Agent header"
125//usage: "\n -Y Use proxy ('on' or 'off')" 127//usage: "\n -Y on/off Use proxy"
126 128
127#include "libbb.h" 129#include "libbb.h"
128 130
@@ -229,17 +231,17 @@ struct globals {
229/* Must match option string! */ 231/* Must match option string! */
230enum { 232enum {
231 WGET_OPT_CONTINUE = (1 << 0), 233 WGET_OPT_CONTINUE = (1 << 0),
232 WGET_OPT_SPIDER = (1 << 1), 234 WGET_OPT_QUIET = (1 << 1),
233 WGET_OPT_QUIET = (1 << 2), 235 WGET_OPT_OUTNAME = (1 << 2),
234 WGET_OPT_OUTNAME = (1 << 3), 236 WGET_OPT_PREFIX = (1 << 3),
235 WGET_OPT_PREFIX = (1 << 4), 237 WGET_OPT_PROXY = (1 << 4),
236 WGET_OPT_PROXY = (1 << 5), 238 WGET_OPT_USER_AGENT = (1 << 5),
237 WGET_OPT_USER_AGENT = (1 << 6), 239 WGET_OPT_NETWORK_READ_TIMEOUT = (1 << 6),
238 WGET_OPT_NETWORK_READ_TIMEOUT = (1 << 7), 240 WGET_OPT_RETRIES = (1 << 7),
239 WGET_OPT_RETRIES = (1 << 8), 241 WGET_OPT_nsomething = (1 << 8),
240 WGET_OPT_PASSIVE = (1 << 9), 242 WGET_OPT_HEADER = (1 << 9) * ENABLE_FEATURE_WGET_LONG_OPTIONS,
241 WGET_OPT_HEADER = (1 << 10) * ENABLE_FEATURE_WGET_LONG_OPTIONS, 243 WGET_OPT_POST_DATA = (1 << 10) * ENABLE_FEATURE_WGET_LONG_OPTIONS,
242 WGET_OPT_POST_DATA = (1 << 11) * ENABLE_FEATURE_WGET_LONG_OPTIONS, 244 WGET_OPT_SPIDER = (1 << 11) * ENABLE_FEATURE_WGET_LONG_OPTIONS,
243}; 245};
244 246
245enum { 247enum {
@@ -1286,8 +1288,6 @@ int wget_main(int argc UNUSED_PARAM, char **argv)
1286 static const char wget_longopts[] ALIGN1 = 1288 static const char wget_longopts[] ALIGN1 =
1287 /* name, has_arg, val */ 1289 /* name, has_arg, val */
1288 "continue\0" No_argument "c" 1290 "continue\0" No_argument "c"
1289//FIXME: -s isn't --spider, it's --save-headers!
1290 "spider\0" No_argument "s"
1291 "quiet\0" No_argument "q" 1291 "quiet\0" No_argument "q"
1292 "output-document\0" Required_argument "O" 1292 "output-document\0" Required_argument "O"
1293 "directory-prefix\0" Required_argument "P" 1293 "directory-prefix\0" Required_argument "P"
@@ -1299,6 +1299,7 @@ IF_FEATURE_WGET_TIMEOUT(
1299IF_DESKTOP( "tries\0" Required_argument "t") 1299IF_DESKTOP( "tries\0" Required_argument "t")
1300 "header\0" Required_argument "\xff" 1300 "header\0" Required_argument "\xff"
1301 "post-data\0" Required_argument "\xfe" 1301 "post-data\0" Required_argument "\xfe"
1302 "spider\0" No_argument "\xfd"
1302 /* Ignored (we always use PASV): */ 1303 /* Ignored (we always use PASV): */
1303IF_DESKTOP( "passive-ftp\0" No_argument "\xf0") 1304IF_DESKTOP( "passive-ftp\0" No_argument "\xf0")
1304 /* Ignored (we don't do ssl) */ 1305 /* Ignored (we don't do ssl) */
@@ -1330,7 +1331,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0")
1330#endif 1331#endif
1331 opt_complementary = "-1" /* at least one URL */ 1332 opt_complementary = "-1" /* at least one URL */
1332 IF_FEATURE_WGET_LONG_OPTIONS(":\xff::"); /* --header is a list */ 1333 IF_FEATURE_WGET_LONG_OPTIONS(":\xff::"); /* --header is a list */
1333 getopt32(argv, "csqO:P:Y:U:T:+" 1334 getopt32(argv, "cqO:P:Y:U:T:+"
1334 /*ignored:*/ "t:" 1335 /*ignored:*/ "t:"
1335 /*ignored:*/ "n::" 1336 /*ignored:*/ "n::"
1336 /* wget has exactly four -n<letter> opts, all of which we can ignore: 1337 /* wget has exactly four -n<letter> opts, all of which we can ignore:
@@ -1349,6 +1350,14 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0")
1349 IF_FEATURE_WGET_LONG_OPTIONS(, &headers_llist) 1350 IF_FEATURE_WGET_LONG_OPTIONS(, &headers_llist)
1350 IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_data) 1351 IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_data)
1351 ); 1352 );
1353#if 0 /* option bits debug */
1354 if (option_mask32 & WGET_OPT_RETRIES) bb_error_msg("-t NUM");
1355 if (option_mask32 & WGET_OPT_nsomething) bb_error_msg("-nsomething");
1356 if (option_mask32 & WGET_OPT_HEADER) bb_error_msg("--header");
1357 if (option_mask32 & WGET_OPT_POST_DATA) bb_error_msg("--post-data");
1358 if (option_mask32 & WGET_OPT_SPIDER) bb_error_msg("--spider");
1359 exit(0);
1360#endif
1352 argv += optind; 1361 argv += optind;
1353 1362
1354#if ENABLE_FEATURE_WGET_LONG_OPTIONS 1363#if ENABLE_FEATURE_WGET_LONG_OPTIONS