]>
Commit | Line | Data |
---|---|---|
cd1a2927 MT |
1 | diff -u busybox-0.60.5.old/usage.h busybox-0.60.5/usage.h |
2 | --- busybox-0.60.5.old/usage.h 2002-09-30 21:59:58.000000000 +0100 | |
3 | +++ busybox-0.60.5/usage.h 2004-01-16 00:42:40.000000000 +0000 | |
4 | @@ -1901,12 +1901,13 @@ | |
5 | " 31 46 1365 /etc/passwd\n" | |
6 | ||
7 | #define wget_trivial_usage \ | |
8 | - "[-c|--continue] [-q|--quiet] [-O|--output-document file]\n\t[--header 'header: value'] [-P DIR] url" | |
9 | + "[-c|--continue] [-q|--quiet] [-s|--spider] [-O|--output-document file]\n\t[--header 'header: value'] [-P DIR] url" | |
10 | #define wget_full_usage \ | |
11 | "wget retrieves files via HTTP or FTP\n\n" \ | |
12 | "Options:\n" \ | |
13 | "\t-c\tcontinue retrieval of aborted transfers\n" \ | |
14 | "\t-q\tquiet mode - do not print\n" \ | |
15 | + "\t-s\tspider mode - check file exists\n" \ | |
16 | "\t-P\tSet directory prefix to DIR\n" \ | |
17 | "\t-O\tsave to filename ('-' for stdout)" | |
18 | ||
19 | diff -u busybox-0.60.5.old/wget.c busybox-0.60.5/wget.c | |
20 | --- busybox-0.60.5.old/wget.c 2002-04-27 08:40:00.000000000 +0100 | |
21 | +++ busybox-0.60.5/wget.c 2004-01-16 00:47:47.000000000 +0000 | |
22 | @@ -179,6 +179,7 @@ | |
23 | int got_clen = 0; /* got content-length: from server */ | |
24 | FILE *output; /* socket to web server */ | |
25 | int quiet_flag = FALSE; /* Be verry, verry quiet... */ | |
26 | + int spider = FALSE; /* Just check file exists (-s) */ | |
27 | ||
28 | #define LONG_HEADER 1 | |
29 | struct option long_options[] = { | |
30 | @@ -186,16 +187,20 @@ | |
31 | { "quiet", 0, NULL, 'q' }, | |
32 | { "output-document", 1, NULL, 'O' }, | |
33 | { "header", 1, &which_long_opt, LONG_HEADER }, | |
34 | + { "spider", 0, NULL, 's' }, | |
35 | { 0, 0, 0, 0 } | |
36 | }; | |
37 | /* | |
38 | * Crack command line. | |
39 | */ | |
40 | - while ((n = getopt_long(argc, argv, "cqO:P:", long_options, &option_index)) != EOF) { | |
41 | + while ((n = getopt_long(argc, argv, "cqsO:P:", long_options, &option_index)) != EOF) { | |
42 | switch (n) { | |
43 | case 'c': | |
44 | ++do_continue; | |
45 | break; | |
46 | + case 's': | |
47 | + spider = TRUE; | |
48 | + break; | |
49 | case 'P': | |
50 | dir_prefix = optarg; | |
51 | break; | |
52 | @@ -353,6 +358,8 @@ | |
53 | while (gethdr(buf, sizeof(buf), sfp, &n) != NULL); | |
54 | goto read_response; | |
55 | case 200: | |
56 | + if (spider) | |
57 | + exit(EXIT_SUCCESS); | |
58 | if (do_continue && output != stdout) | |
59 | output = freopen(fname_out, "w", output); | |
60 | do_continue = 0; |