blob: d1aacefa605318ad5d3f8ab2926f1cc3c4485bb4 [file] [log] [blame]
Eric Andersen96700832000-09-04 15:15:55 +00001/* vi: set sw=4 ts=4: */
2/*
3 * wget - retrieve a file using HTTP
4 *
Eric Andersen4e573f42000-11-14 23:29:24 +00005 * Chip Rosenthal Covad Communications <chip@laserlink.net>
Eric Andersenb520e082000-10-03 00:21:45 +00006 *
Eric Andersen4e573f42000-11-14 23:29:24 +00007 * Note: According to RFC2616 section 3.6.1, "All HTTP/1.1 applications MUST be
8 * able to receive and decode the "chunked" transfer-coding, and MUST ignore
9 * chunk-extension extensions they do not understand."
Eric Andersenb520e082000-10-03 00:21:45 +000010 *
Eric Andersen4e573f42000-11-14 23:29:24 +000011 * This prevents this particular wget app from completely RFC compliant, and as
12 * such, prevents it from being used as a general purpose web browser... This
13 * is a design decision, since it makes the code smaller.
Eric Andersenb520e082000-10-03 00:21:45 +000014 *
Eric Andersen96700832000-09-04 15:15:55 +000015 */
16
Eric Andersen3570a342000-09-25 21:45:58 +000017#include "busybox.h"
Eric Andersen96700832000-09-04 15:15:55 +000018#include <stdio.h>
Eric Andersendff9d542001-01-26 02:04:49 +000019#include <errno.h>
Eric Andersen96700832000-09-04 15:15:55 +000020#include <stdlib.h>
21#include <unistd.h>
22#include <ctype.h>
23#include <string.h>
Eric Andersenb520e082000-10-03 00:21:45 +000024#include <unistd.h>
25#include <signal.h>
26#include <sys/ioctl.h>
Eric Andersen96700832000-09-04 15:15:55 +000027
Eric Andersenb520e082000-10-03 00:21:45 +000028#include <sys/time.h>
Eric Andersen96700832000-09-04 15:15:55 +000029#include <sys/types.h>
30#include <sys/stat.h>
31#include <sys/socket.h>
32#include <netinet/in.h>
33#include <arpa/inet.h>
34#include <netdb.h>
35
Eric Andersened3ef502001-01-27 08:24:39 +000036/* Stupid libc5 doesn't define this... */
37#ifndef timersub
38#define timersub(a, b, result) \
39 do { \
40 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
41 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
42 if ((result)->tv_usec < 0) { \
43 --(result)->tv_sec; \
44 (result)->tv_usec += 1000000; \
45 } \
46 } while (0)
47#endif
Eric Andersen96700832000-09-04 15:15:55 +000048
49void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path);
50FILE *open_socket(char *host, int port);
51char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc);
Eric Andersenb520e082000-10-03 00:21:45 +000052void progressmeter(int flag);
Eric Andersen96700832000-09-04 15:15:55 +000053
Eric Andersenb520e082000-10-03 00:21:45 +000054/* Globals (can be accessed from signal handlers */
55static off_t filesize = 0; /* content-length of the file */
Eric Andersen370fb082001-01-20 20:07:00 +000056#ifdef BB_FEATURE_WGET_STATUSBAR
Eric Andersenb520e082000-10-03 00:21:45 +000057static char *curfile; /* Name of current file being transferred. */
58static struct timeval start; /* Time a transfer started. */
59volatile unsigned long statbytes; /* Number of bytes transferred so far. */
60/* For progressmeter() -- number of seconds before xfer considered "stalled" */
Mark Whitley59ab0252001-01-23 22:30:04 +000061static const int STALLTIME = 5;
Eric Andersenb520e082000-10-03 00:21:45 +000062#endif
Eric Andersen7d697012001-01-24 20:28:35 +000063
64void close_and_delete_outfile(FILE* output, char *fname_out, int do_continue)
65{
66 if (output != stdout && do_continue==0) {
67 fclose(output);
68 unlink(fname_out);
69 }
70}
Eric Andersen96700832000-09-04 15:15:55 +000071
72int wget_main(int argc, char **argv)
73{
Eric Andersen29edd002000-12-09 16:55:35 +000074 int n;
75 char *proxy, *proxy_host;
76 int uri_port, proxy_port;
77 char *s, buf[512];
78 struct stat sbuf;
79
Eric Andersen96700832000-09-04 15:15:55 +000080 FILE *sfp; /* socket to web server */
81 char *uri_host, *uri_path; /* parsed from command line url */
Eric Andersen96700832000-09-04 15:15:55 +000082 char *fname_out = NULL; /* where to direct output (-O) */
83 int do_continue = 0; /* continue a prev transfer (-c) */
84 long beg_range = 0L; /* range at which continue begins */
85 int got_clen = 0; /* got content-length: from server */
Eric Andersen29edd002000-12-09 16:55:35 +000086 FILE *output; /* socket to web server */
87 int quiet_flag = FALSE; /* Be verry, verry quiet... */
88
Eric Andersen96700832000-09-04 15:15:55 +000089 /*
90 * Crack command line.
91 */
Glenn L McGrath1bca5ed2000-12-09 08:12:06 +000092 while ((n = getopt(argc, argv, "cqO:")) != EOF) {
Eric Andersen96700832000-09-04 15:15:55 +000093 switch (n) {
94 case 'c':
95 ++do_continue;
96 break;
Glenn L McGrath1bca5ed2000-12-09 08:12:06 +000097 case 'q':
98 quiet_flag = TRUE;
99 break;
Eric Andersen96700832000-09-04 15:15:55 +0000100 case 'O':
Randolph Chung02553a22000-12-07 03:53:47 +0000101 /* can't set fname_out to NULL if outputting to stdout, because
102 * this gets interpreted as the auto-gen output filename
103 * case below - tausq@debian.org
104 */
105 fname_out = (strcmp(optarg, "-") == 0 ? (char *)1 : optarg);
Eric Andersen96700832000-09-04 15:15:55 +0000106 break;
107 default:
Eric Andersen67991cf2001-02-14 21:23:06 +0000108 show_usage();
Eric Andersen96700832000-09-04 15:15:55 +0000109 }
110 }
Eric Andersen25b669c2000-10-02 23:19:38 +0000111
Eric Andersen96700832000-09-04 15:15:55 +0000112 if (argc - optind != 1)
Eric Andersen67991cf2001-02-14 21:23:06 +0000113 show_usage();
Eric Andersen25b669c2000-10-02 23:19:38 +0000114
Eric Andersen96700832000-09-04 15:15:55 +0000115 /*
Eric Andersenf3b2b522000-12-07 22:42:11 +0000116 * Use the proxy if necessary.
Eric Andersen96700832000-09-04 15:15:55 +0000117 */
Eric Andersenf3b2b522000-12-07 22:42:11 +0000118 if ((proxy = getenv("http_proxy")) != NULL) {
119 proxy = xstrdup(proxy);
Eric Andersen29edd002000-12-09 16:55:35 +0000120 parse_url(proxy, &proxy_host, &proxy_port, &uri_path);
121 parse_url(argv[optind], &uri_host, &uri_port, &uri_path);
Eric Andersenf3b2b522000-12-07 22:42:11 +0000122 } else {
123 /*
124 * Parse url into components.
125 */
126 parse_url(argv[optind], &uri_host, &uri_port, &uri_path);
Eric Andersen29edd002000-12-09 16:55:35 +0000127 proxy_host=uri_host;
128 proxy_port=uri_port;
Eric Andersenf3b2b522000-12-07 22:42:11 +0000129 }
Eric Andersen29edd002000-12-09 16:55:35 +0000130
131 /* Guess an output filename */
132 if (!fname_out) {
133 fname_out =
Eric Andersen370fb082001-01-20 20:07:00 +0000134#ifdef BB_FEATURE_WGET_STATUSBAR
Eric Andersen29edd002000-12-09 16:55:35 +0000135 curfile =
136#endif
137 get_last_path_component(uri_path);
138 if (fname_out==NULL || strlen(fname_out)<1) {
139 fname_out =
Eric Andersen370fb082001-01-20 20:07:00 +0000140#ifdef BB_FEATURE_WGET_STATUSBAR
Eric Andersen29edd002000-12-09 16:55:35 +0000141 curfile =
142#endif
143 "index.html";
144 }
Eric Andersen370fb082001-01-20 20:07:00 +0000145#ifdef BB_FEATURE_WGET_STATUSBAR
Eric Andersen29edd002000-12-09 16:55:35 +0000146 } else {
147 curfile=argv[optind];
148#endif
149 }
Eric Andersen7d697012001-01-24 20:28:35 +0000150 if (do_continue && !fname_out)
Matt Kraaidd19c692001-01-31 19:00:21 +0000151 error_msg_and_die("cannot specify continue (-c) without a filename (-O)");
Eric Andersen29edd002000-12-09 16:55:35 +0000152
Eric Andersen96700832000-09-04 15:15:55 +0000153
154 /*
155 * Open socket to server.
156 */
Eric Andersen29edd002000-12-09 16:55:35 +0000157 sfp = open_socket(proxy_host, proxy_port);
158
159 /* Make the assumption that if the file already exists
160 * on disk that the intention is to continue downloading
161 * a previously aborted download -Erik */
162 if (stat(fname_out, &sbuf) == 0) {
163 ++do_continue;
164 }
Eric Andersen96700832000-09-04 15:15:55 +0000165
166 /*
Eric Andersen29edd002000-12-09 16:55:35 +0000167 * Open the output file stream.
Eric Andersen96700832000-09-04 15:15:55 +0000168 */
Randolph Chung02553a22000-12-07 03:53:47 +0000169 if (fname_out != (char *)1) {
Eric Andersen79e898a2001-01-31 17:49:47 +0000170 output = xfopen( fname_out, (do_continue ? "a" : "w") );
Randolph Chung02553a22000-12-07 03:53:47 +0000171 } else {
172 output = stdout;
Eric Andersen96700832000-09-04 15:15:55 +0000173 }
174
175 /*
176 * Determine where to start transfer.
177 */
178 if (do_continue) {
Eric Andersenb520e082000-10-03 00:21:45 +0000179 if (fstat(fileno(output), &sbuf) < 0)
Matt Kraai0dab8292000-12-18 03:08:29 +0000180 perror_msg_and_die("fstat()");
Eric Andersen96700832000-09-04 15:15:55 +0000181 if (sbuf.st_size > 0)
182 beg_range = sbuf.st_size;
183 else
184 do_continue = 0;
185 }
186
187 /*
188 * Send HTTP request.
189 */
Eric Andersen29edd002000-12-09 16:55:35 +0000190 fprintf(sfp, "GET http://%s:%d/%s HTTP/1.1\r\n",
191 uri_host, uri_port, uri_path);
192 fprintf(sfp, "Host: %s\r\nUser-Agent: Wget\r\n", uri_host);
Eric Andersen7d697012001-01-24 20:28:35 +0000193
Eric Andersen96700832000-09-04 15:15:55 +0000194 if (do_continue)
195 fprintf(sfp, "Range: bytes=%ld-\r\n", beg_range);
Eric Andersen29edd002000-12-09 16:55:35 +0000196 fprintf(sfp,"Connection: close\r\n\r\n");
Eric Andersen96700832000-09-04 15:15:55 +0000197
198 /*
199 * Retrieve HTTP response line and check for "200" status code.
200 */
Eric Andersen29edd002000-12-09 16:55:35 +0000201 if (fgets(buf, sizeof(buf), sfp) == NULL) {
Eric Andersen7d697012001-01-24 20:28:35 +0000202 close_and_delete_outfile(output, fname_out, do_continue);
Matt Kraaidd19c692001-01-31 19:00:21 +0000203 error_msg_and_die("no response from server");
Eric Andersen29edd002000-12-09 16:55:35 +0000204 }
Eric Andersen96700832000-09-04 15:15:55 +0000205 for (s = buf ; *s != '\0' && !isspace(*s) ; ++s)
206 ;
207 for ( ; isspace(*s) ; ++s)
208 ;
209 switch (atoi(s)) {
Eric Andersen7d697012001-01-24 20:28:35 +0000210 case 0:
Eric Andersenb520e082000-10-03 00:21:45 +0000211 case 200:
Eric Andersen7d697012001-01-24 20:28:35 +0000212 break;
Eric Andersenb520e082000-10-03 00:21:45 +0000213 case 206:
214 if (do_continue)
215 break;
216 /*FALLTHRU*/
217 default:
Eric Andersen7d697012001-01-24 20:28:35 +0000218 close_and_delete_outfile(output, fname_out, do_continue);
Matt Kraai05e782d2001-02-01 16:49:30 +0000219 chomp(buf);
Eric Andersen7d697012001-01-24 20:28:35 +0000220 error_msg_and_die("server returned error %d: %s", atoi(s), buf);
Eric Andersen96700832000-09-04 15:15:55 +0000221 }
222
223 /*
224 * Retrieve HTTP headers.
225 */
226 while ((s = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) {
Eric Andersen7d697012001-01-24 20:28:35 +0000227 if (strcasecmp(buf, "content-length") == 0) {
Eric Andersenb520e082000-10-03 00:21:45 +0000228 filesize = atol(s);
Eric Andersen96700832000-09-04 15:15:55 +0000229 got_clen = 1;
230 continue;
231 }
Eric Andersen7d697012001-01-24 20:28:35 +0000232 if (strcasecmp(buf, "transfer-encoding") == 0) {
233 close_and_delete_outfile(output, fname_out, do_continue);
Matt Kraaidd19c692001-01-31 19:00:21 +0000234 error_msg_and_die("server wants to do %s transfer encoding", s);
Eric Andersen96700832000-09-04 15:15:55 +0000235 continue;
236 }
237 }
238
239 /*
240 * Retrieve HTTP body.
241 */
Eric Andersen370fb082001-01-20 20:07:00 +0000242#ifdef BB_FEATURE_WGET_STATUSBAR
Eric Andersenb520e082000-10-03 00:21:45 +0000243 statbytes=0;
Glenn L McGrath1bca5ed2000-12-09 08:12:06 +0000244 if (quiet_flag==FALSE)
245 progressmeter(-1);
Eric Andersenb520e082000-10-03 00:21:45 +0000246#endif
247 while (filesize > 0 && (n = fread(buf, 1, sizeof(buf), sfp)) > 0) {
248 fwrite(buf, 1, n, output);
Eric Andersen370fb082001-01-20 20:07:00 +0000249#ifdef BB_FEATURE_WGET_STATUSBAR
Eric Andersenb520e082000-10-03 00:21:45 +0000250 statbytes+=n;
Glenn L McGrath1bca5ed2000-12-09 08:12:06 +0000251 if (quiet_flag==FALSE)
252 progressmeter(1);
Eric Andersenb520e082000-10-03 00:21:45 +0000253#endif
Eric Andersen96700832000-09-04 15:15:55 +0000254 if (got_clen)
Eric Andersenb520e082000-10-03 00:21:45 +0000255 filesize -= n;
Eric Andersen96700832000-09-04 15:15:55 +0000256 }
257 if (n == 0 && ferror(sfp))
Mark Whitleyf57c9442000-12-07 19:56:48 +0000258 perror_msg_and_die("network read error");
Eric Andersen96700832000-09-04 15:15:55 +0000259
260 exit(0);
261}
262
263
264void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path)
265{
Matt Kraaia9711a52001-01-03 16:15:15 +0000266 char *cp, *sp;
Eric Andersen96700832000-09-04 15:15:55 +0000267
268 *uri_port = 80;
269
270 if (strncmp(url, "http://", 7) != 0)
Matt Kraaidd19c692001-01-31 19:00:21 +0000271 error_msg_and_die("not an http url: %s", url);
Eric Andersen96700832000-09-04 15:15:55 +0000272
Matt Kraaia9711a52001-01-03 16:15:15 +0000273 *uri_host = url + 7;
274
275 cp = strchr(*uri_host, ':');
276 sp = strchr(*uri_host, '/');
277
278 if (cp != NULL && (sp == NULL || cp < sp)) {
279 *cp++ = '\0';
280 *uri_port = atoi(cp);
Eric Andersen96700832000-09-04 15:15:55 +0000281 }
Randolph Chung02553a22000-12-07 03:53:47 +0000282
Matt Kraaia9711a52001-01-03 16:15:15 +0000283 if (sp != NULL) {
284 *sp++ = '\0';
285 *uri_path = sp;
286 } else
287 *uri_path = "";
Eric Andersen96700832000-09-04 15:15:55 +0000288}
289
290
291FILE *open_socket(char *host, int port)
292{
293 struct sockaddr_in sin;
294 struct hostent *hp;
295 int fd;
296 FILE *fp;
297
Eric Andersened3ef502001-01-27 08:24:39 +0000298 memset(&sin, 0, sizeof(sin));
Eric Andersen96700832000-09-04 15:15:55 +0000299 sin.sin_family = AF_INET;
300 if ((hp = (struct hostent *) gethostbyname(host)) == NULL)
Matt Kraaidd19c692001-01-31 19:00:21 +0000301 error_msg_and_die("cannot resolve %s", host);
Eric Andersen96700832000-09-04 15:15:55 +0000302 memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length);
303 sin.sin_port = htons(port);
304
305 /*
306 * Get the server onto a stdio stream.
307 */
308 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
Mark Whitleyf57c9442000-12-07 19:56:48 +0000309 perror_msg_and_die("socket()");
Eric Andersen96700832000-09-04 15:15:55 +0000310 if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0)
Mark Whitleyf57c9442000-12-07 19:56:48 +0000311 perror_msg_and_die("connect(%s)", host);
Eric Andersen96700832000-09-04 15:15:55 +0000312 if ((fp = fdopen(fd, "r+")) == NULL)
Mark Whitleyf57c9442000-12-07 19:56:48 +0000313 perror_msg_and_die("fdopen()");
Eric Andersen96700832000-09-04 15:15:55 +0000314
315 return fp;
316}
317
318
319char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc)
320{
321 char *s, *hdrval;
322 int c;
323
324 *istrunc = 0;
325
326 /* retrieve header line */
327 if (fgets(buf, bufsiz, fp) == NULL)
328 return NULL;
329
330 /* see if we are at the end of the headers */
331 for (s = buf ; *s == '\r' ; ++s)
332 ;
333 if (s[0] == '\n')
334 return NULL;
335
336 /* convert the header name to lower case */
337 for (s = buf ; isalnum(*s) || *s == '-' ; ++s)
338 *s = tolower(*s);
339
340 /* verify we are at the end of the header name */
341 if (*s != ':')
Matt Kraaidd19c692001-01-31 19:00:21 +0000342 error_msg_and_die("bad header line: %s", buf);
Eric Andersen96700832000-09-04 15:15:55 +0000343
344 /* locate the start of the header value */
345 for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s)
346 ;
347 hdrval = s;
348
349 /* locate the end of header */
350 while (*s != '\0' && *s != '\r' && *s != '\n')
351 ++s;
352
353 /* end of header found */
354 if (*s != '\0') {
355 *s = '\0';
356 return hdrval;
357 }
358
Eric Andersen5d638842000-09-14 21:46:30 +0000359 /* Rats! The buffer isn't big enough to hold the entire header value. */
Eric Andersen96700832000-09-04 15:15:55 +0000360 while (c = getc(fp), c != EOF && c != '\n')
361 ;
362 *istrunc = 1;
363 return hdrval;
364}
365
Eric Andersen370fb082001-01-20 20:07:00 +0000366#ifdef BB_FEATURE_WGET_STATUSBAR
Eric Andersen4e573f42000-11-14 23:29:24 +0000367/* Stuff below is from BSD rcp util.c, as added to openshh.
368 * Original copyright notice is retained at the end of this file.
369 *
370 */
Eric Andersenb520e082000-10-03 00:21:45 +0000371
372
373int
374getttywidth(void)
375{
376 struct winsize winsize;
377
378 if (ioctl(fileno(stdout), TIOCGWINSZ, &winsize) != -1)
379 return (winsize.ws_col ? winsize.ws_col : 80);
380 else
381 return (80);
382}
383
384void
385updateprogressmeter(int ignore)
386{
387 int save_errno = errno;
388
389 progressmeter(0);
390 errno = save_errno;
391}
392
393void
394alarmtimer(int wait)
395{
396 struct itimerval itv;
397
398 itv.it_value.tv_sec = wait;
399 itv.it_value.tv_usec = 0;
400 itv.it_interval = itv.it_value;
401 setitimer(ITIMER_REAL, &itv, NULL);
402}
403
404
405void
406progressmeter(int flag)
407{
408 static const char prefixes[] = " KMGTP";
409 static struct timeval lastupdate;
410 static off_t lastsize;
411 struct timeval now, td, wait;
412 off_t cursize, abbrevsize;
413 double elapsed;
414 int ratio, barlength, i, remaining;
415 char buf[256];
416
417 if (flag == -1) {
418 (void) gettimeofday(&start, (struct timezone *) 0);
419 lastupdate = start;
420 lastsize = 0;
421 }
422
423 (void) gettimeofday(&now, (struct timezone *) 0);
424 cursize = statbytes;
425 if (filesize != 0) {
426 ratio = 100.0 * cursize / filesize;
427 ratio = MAX(ratio, 0);
428 ratio = MIN(ratio, 100);
429 } else
430 ratio = 100;
431
432 snprintf(buf, sizeof(buf), "\r%-20.20s %3d%% ", curfile, ratio);
433
434 barlength = getttywidth() - 51;
435 if (barlength > 0) {
436 i = barlength * ratio / 100;
437 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
438 "|%.*s%*s|", i,
439 "*****************************************************************************"
440 "*****************************************************************************",
441 barlength - i, "");
442 }
443 i = 0;
444 abbrevsize = cursize;
445 while (abbrevsize >= 100000 && i < sizeof(prefixes)) {
446 i++;
447 abbrevsize >>= 10;
448 }
449 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %5d %c%c ",
450 (int) abbrevsize, prefixes[i], prefixes[i] == ' ' ? ' ' :
451 'B');
452
453 timersub(&now, &lastupdate, &wait);
454 if (cursize > lastsize) {
455 lastupdate = now;
456 lastsize = cursize;
457 if (wait.tv_sec >= STALLTIME) {
458 start.tv_sec += wait.tv_sec;
459 start.tv_usec += wait.tv_usec;
460 }
461 wait.tv_sec = 0;
462 }
463 timersub(&now, &start, &td);
464 elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
465
466 if (statbytes <= 0 || elapsed <= 0.0 || cursize > filesize) {
467 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
468 " --:-- ETA");
469 } else if (wait.tv_sec >= STALLTIME) {
470 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
471 " - stalled -");
472 } else {
473 remaining = (int) (filesize / (statbytes / elapsed) - elapsed);
474 i = remaining / 3600;
475 if (i)
476 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
477 "%2d:", i);
478 else
479 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
480 " ");
481 i = remaining % 3600;
482 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
483 "%02d:%02d ETA", i / 60, i % 60);
484 }
Randolph Chungda7b8292000-12-07 03:55:35 +0000485 write(fileno(stderr), buf, strlen(buf));
Eric Andersenb520e082000-10-03 00:21:45 +0000486
487 if (flag == -1) {
488 struct sigaction sa;
489 sa.sa_handler = updateprogressmeter;
490 sigemptyset(&sa.sa_mask);
491 sa.sa_flags = SA_RESTART;
492 sigaction(SIGALRM, &sa, NULL);
493 alarmtimer(1);
494 } else if (flag == 1) {
495 alarmtimer(0);
496 statbytes = 0;
497 }
498}
499#endif
Eric Andersen4e573f42000-11-14 23:29:24 +0000500
Eric Andersen370fb082001-01-20 20:07:00 +0000501/* Original copyright notice which applies to the BB_FEATURE_WGET_STATUSBAR stuff,
Eric Andersen4e573f42000-11-14 23:29:24 +0000502 * much of which was blatently stolen from openssh. */
503
504/*-
505 * Copyright (c) 1992, 1993
506 * The Regents of the University of California. All rights reserved.
507 *
508 * Redistribution and use in source and binary forms, with or without
509 * modification, are permitted provided that the following conditions
510 * are met:
511 * 1. Redistributions of source code must retain the above copyright
512 * notice, this list of conditions and the following disclaimer.
513 * 2. Redistributions in binary form must reproduce the above copyright
514 * notice, this list of conditions and the following disclaimer in the
515 * documentation and/or other materials provided with the distribution.
516 *
517 * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
518 * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
519 *
520 * 4. Neither the name of the University nor the names of its contributors
521 * may be used to endorse or promote products derived from this software
522 * without specific prior written permission.
523 *
524 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
525 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
526 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
527 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
528 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
529 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
530 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
531 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
532 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
533 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
534 * SUCH DAMAGE.
535 *
Eric Andersen67991cf2001-02-14 21:23:06 +0000536 * $Id: wget.c,v 1.27 2001/02/14 21:23:06 andersen Exp $
Eric Andersen4e573f42000-11-14 23:29:24 +0000537 */
538
539
540
Eric Andersen96700832000-09-04 15:15:55 +0000541/*
542Local Variables:
543c-file-style: "linux"
544c-basic-offset: 4
545tab-width: 4
546End:
547*/
Eric Andersenb520e082000-10-03 00:21:45 +0000548
Eric Andersen4e573f42000-11-14 23:29:24 +0000549
550