]> sjero.net Git - wget/blob - doc/wget.texi
[svn] Manually applied Rob Mayoff <mayoff@dqd.com>'s patch (vs. 1.5.3, not 1.5.3...
[wget] / doc / wget.texi
1 \input texinfo   @c -*-texinfo-*-
2
3 @c %**start of header
4 @setfilename wget.info
5 @settitle GNU Wget Manual
6 @c Disable the monstrous rectangles beside overfull hbox-es.
7 @finalout
8 @c Use `odd' to print double-sided.
9 @setchapternewpage on
10 @c %**end of header
11
12 @iftex
13 @c Remove this if you don't use A4 paper.
14 @afourpaper
15 @end iftex
16
17 @c This should really be auto-generated!
18 @set VERSION 1.5.3+dev
19 @set UPDATED Feb 2000
20
21 @dircategory Net Utilities
22 @dircategory World Wide Web
23 @direntry
24 * Wget: (wget).         The non-interactive network downloader.
25 @end direntry
26
27 @ifinfo
28 This file documents the the GNU Wget utility for downloading network
29 data.
30
31 Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
32
33 Permission is granted to make and distribute verbatim copies of
34 this manual provided the copyright notice and this permission notice
35 are preserved on all copies.
36
37 @ignore
38 Permission is granted to process this file through TeX and print the
39 results, provided the printed document carries a copying permission
40 notice identical to this one except for the removal of this paragraph
41 (this paragraph not being relevant to the printed manual).
42 @end ignore
43 Permission is granted to copy and distribute modified versions of this
44 manual under the conditions for verbatim copying, provided also that the
45 sections entitled ``Copying'' and ``GNU General Public License'' are
46 included exactly as in the original, and provided that the entire
47 resulting derived work is distributed under the terms of a permission
48 notice identical to this one.
49 @end ifinfo
50
51 @titlepage
52 @title GNU Wget
53 @subtitle The noninteractive downloading utility
54 @subtitle Updated for Wget @value{VERSION}, @value{UPDATED}
55 @author by Hrvoje Nik@v{s}i@'{c} and the developers
56
57 @page
58 @vskip 0pt plus 1filll
59 Copyright @copyright{} 1996, 1997, 1998 Free Software Foundation, Inc.
60
61 Permission is granted to make and distribute verbatim copies of this
62 manual provided the copyright notice and this permission notice are
63 preserved on all copies.
64
65 Permission is granted to copy and distribute modified versions of this
66 manual under the conditions for verbatim copying, provided also that the
67 sections entitled ``Copying'' and ``GNU General Public License'' are
68 included exactly as in the original, and provided that the entire
69 resulting derived work is distributed under the terms of a permission
70 notice identical to this one.
71
72 Permission is granted to copy and distribute translations of this manual
73 into another language, under the above conditions for modified versions,
74 except that this permission notice may be stated in a translation
75 approved by the Free Software Foundation.
76 @end titlepage
77
78 @ifinfo
79 @node Top, Overview, (dir), (dir)
80 @top Wget @value{VERSION}
81
82 This manual documents version @value{VERSION} of GNU Wget, the freely
83 available utility for network download.
84
85 Copyright @copyright{} 1996, 1997, 1998 Free Software Foundation, Inc.
86
87 @menu
88 * Overview::            Features of Wget.
89 * Invoking::            Wget command-line arguments.
90 * Recursive Retrieval:: Description of recursive retrieval.
91 * Following Links::     The available methods of chasing links.
92 * Time-Stamping::       Mirroring according to time-stamps.
93 * Startup File::        Wget's initialization file.
94 * Examples::            Examples of usage.
95 * Various::             The stuff that doesn't fit anywhere else.
96 * Appendices::          Some useful references.
97 * Copying::             You may give out copies of Wget.
98 * Concept Index::       Topics covered by this manual.
99 @end menu
100 @end ifinfo
101
102 @node Overview, Invoking, Top, Top
103 @chapter Overview
104 @cindex overview
105 @cindex features
106
107 GNU Wget is a freely available network utility to retrieve files from
108 the World Wide Web, using @sc{http} (Hyper Text Transfer Protocol) and
109 @sc{ftp} (File Transfer Protocol), the two most widely used Internet
110 protocols.  It has many useful features to make downloading easier, some
111 of them being:
112
113 @itemize @bullet
114 @item
115 Wget is non-interactive, meaning that it can work in the background,
116 while the user is not logged on.  This allows you to start a retrieval
117 and disconnect from the system, letting Wget finish the work.  By
118 contrast, most of the Web browsers require constant user's presence,
119 which can be a great hindrance when transferring a lot of data.
120
121 @sp 1
122 @item
123 Wget is capable of descending recursively through the structure of
124 @sc{html} documents and @sc{ftp} directory trees, making a local copy of
125 the directory hierarchy similar to the one on the remote server.  This
126 feature can be used to mirror archives and home pages, or traverse the
127 web in search of data, like a @sc{www} robot (@xref{Robots}).  In that
128 spirit, Wget understands the @code{norobots} convention.
129
130 @sp 1
131 @item
132 File name wildcard matching and recursive mirroring of directories are
133 available when retrieving via @sc{ftp}.  Wget can read the time-stamp
134 information given by both @sc{http} and @sc{ftp} servers, and store it
135 locally.  Thus Wget can see if the remote file has changed since last
136 retrieval, and automatically retrieve the new version if it has.  This
137 makes Wget suitable for mirroring of @sc{ftp} sites, as well as home
138 pages.
139
140 @sp 1
141 @item
142 Wget works exceedingly well on slow or unstable connections,
143 retrying the document until it is fully retrieved, or until a
144 user-specified retry count is surpassed.  It will try to resume the
145 download from the point of interruption, using @code{REST} with @sc{ftp}
146 and @code{Range} with @sc{http} servers that support them.
147
148 @sp 1
149 @item
150 By default, Wget supports proxy servers, which can lighten the network
151 load, speed up retrieval and provide access behind firewalls.  However,
152 if you are behind a firewall that requires that you use a socks style
153 gateway, you can get the socks library and build wget with support for
154 socks.  Wget also supports the passive @sc{ftp} downloading as an
155 option.
156
157 @sp 1
158 @item
159 Builtin features offer mechanisms to tune which links you wish to follow
160 (@xref{Following Links}).
161
162 @sp 1
163 @item
164 The retrieval is conveniently traced with printing dots, each dot
165 representing a fixed amount of data received (1KB by default).  These
166 representations can be customized to your preferences.
167
168 @sp 1
169 @item
170 Most of the features are fully configurable, either through command line
171 options, or via the initialization file @file{.wgetrc} (@xref{Startup
172 File}).  Wget allows you to define @dfn{global} startup files
173 (@file{/usr/local/etc/wgetrc} by default) for site settings.
174
175 @sp 1
176 @item
177 Finally, GNU Wget is free software.  This means that everyone may use
178 it, redistribute it and/or modify it under the terms of the GNU General
179 Public License, as published by the Free Software Foundation
180 (@xref{Copying}).
181 @end itemize
182
183 @node Invoking, Recursive Retrieval, Overview, Top
184 @chapter Invoking
185 @cindex invoking
186 @cindex command line
187 @cindex arguments
188 @cindex nohup
189
190 By default, Wget is very simple to invoke.  The basic syntax is:
191
192 @example
193 wget [@var{option}]@dots{} [@var{URL}]@dots{}
194 @end example
195
196 Wget will simply download all the @sc{url}s specified on the command
197 line.  @var{URL} is a @dfn{Uniform Resource Locator}, as defined below.
198
199 However, you may wish to change some of the default parameters of
200 Wget.  You can do it two ways: permanently, adding the appropriate
201 command to @file{.wgetrc} (@xref{Startup File}), or specifying it on
202 the command line.
203
204 @menu
205 * URL Format::
206 * Option Syntax::
207 * Basic Startup Options::
208 * Logging and Input File Options::
209 * Download Options::
210 * Directory Options::
211 * HTTP Options::
212 * FTP Options::
213 * Recursive Retrieval Options::
214 * Recursive Accept/Reject Options::
215 @end menu
216
217 @node URL Format, Option Syntax, Invoking, Invoking
218 @section URL Format
219 @cindex URL
220 @cindex URL syntax
221
222 @dfn{URL} is an acronym for Uniform Resource Locator.  A uniform
223 resource locator is a compact string representation for a resource
224 available via the Internet.  Wget recognizes the @sc{url} syntax as per
225 @sc{rfc1738}.  This is the most widely used form (square brackets denote
226 optional parts):
227
228 @example
229 http://host[:port]/directory/file
230 ftp://host[:port]/directory/file
231 @end example
232
233 You can also encode your username and password within a @sc{url}:
234
235 @example
236 ftp://user:password@@host/path
237 http://user:password@@host/path
238 @end example
239
240 Either @var{user} or @var{password}, or both, may be left out.  If you
241 leave out either the @sc{http} username or password, no authentication
242 will be sent.  If you leave out the @sc{ftp} username, @samp{anonymous}
243 will be used.  If you leave out the @sc{ftp} password, your email
244 address will be supplied as a default password.@footnote{If you have a
245 @file{.netrc} file in your home directory, password will also be
246 searched for there.}
247
248 You can encode unsafe characters in a @sc{url} as @samp{%xy}, @code{xy}
249 being the hexadecimal representation of the character's @sc{ascii}
250 value.  Some common unsafe characters include @samp{%} (quoted as
251 @samp{%25}), @samp{:} (quoted as @samp{%3A}), and @samp{@@} (quoted as
252 @samp{%40}).  Refer to @sc{rfc1738} for a comprehensive list of unsafe
253 characters.
254
255 Wget also supports the @code{type} feature for @sc{ftp} @sc{url}s.  By
256 default, @sc{ftp} documents are retrieved in the binary mode (type
257 @samp{i}), which means that they are downloaded unchanged.  Another
258 useful mode is the @samp{a} (@dfn{ASCII}) mode, which converts the line
259 delimiters between the different operating systems, and is thus useful
260 for text files.  Here is an example:
261
262 @example
263 ftp://host/directory/file;type=a
264 @end example
265
266 Two alternative variants of @sc{url} specification are also supported,
267 because of historical (hysterical?) reasons and their widespreaded use.
268
269 @sc{ftp}-only syntax (supported by @code{NcFTP}):
270 @example
271 host:/dir/file
272 @end example
273
274 @sc{http}-only syntax (introduced by @code{Netscape}):
275 @example
276 host[:port]/dir/file
277 @end example
278
279 These two alternative forms are deprecated, and may cease being
280 supported in the future.
281
282 If you do not understand the difference between these notations, or do
283 not know which one to use, just use the plain ordinary format you use
284 with your favorite browser, like @code{Lynx} or @code{Netscape}.
285
286 @node Option Syntax, Basic Startup Options, URL Format, Invoking
287 @section Option Syntax
288 @cindex option syntax
289 @cindex syntax of options
290
291 Since Wget uses GNU getopts to process its arguments, every option has a
292 short form and a long form.  Long options are more convenient to
293 remember, but take time to type.  You may freely mix different option
294 styles, or specify options after the command-line arguments. Thus you
295 may write:
296
297 @example
298 wget -r --tries=10 http://fly.cc.fer.hr/ -o log
299 @end example
300
301 The space between the option accepting an argument and the argument may
302 be omitted.  Instead @samp{-o log} you can write @samp{-olog}.
303
304 You may put several options that do not require arguments together,
305 like:
306
307 @example
308 wget -drc @var{URL}
309 @end example
310
311 This is a complete equivalent of:
312
313 @example
314 wget -d -r -c @var{URL}
315 @end example
316
317 Since the options can be specified after the arguments, you may
318 terminate them with @samp{--}.  So the following will try to download
319 @sc{url} @samp{-x}, reporting failure to @file{log}:
320
321 @example
322 wget -o log -- -x
323 @end example
324
325 The options that accept comma-separated lists all respect the convention
326 that specifying an empty list clears its value.  This can be useful to
327 clear the @file{.wgetrc} settings.  For instance, if your @file{.wgetrc}
328 sets @code{exclude_directories} to @file{/cgi-bin}, the following
329 example will first reset it, and then set it to exclude @file{/~nobody}
330 and @file{/~somebody}.  You can also clear the lists in @file{.wgetrc}
331 (@xref{Wgetrc Syntax}).
332
333 @example
334 wget -X '' -X /~nobody,/~somebody
335 @end example
336
337 @node Basic Startup Options, Logging and Input File Options, Option Syntax, Invoking
338 @section Basic Startup Options
339
340 @table @samp
341 @item -V
342 @itemx --version
343 Display the version of Wget.
344
345 @item -h
346 @itemx --help
347 Print a help message describing all of Wget's command-line options.
348
349 @item -b
350 @itemx --background
351 Go to background immediately after startup.  If no output file is
352 specified via the @samp{-o}, output is redirected to @file{wget-log}.
353
354 @cindex execute wgetrc command
355 @item -e @var{command}
356 @itemx --execute @var{command}
357 Execute @var{command} as if it were a part of @file{.wgetrc}
358 (@xref{Startup File}).  A command thus invoked will be executed
359 @emph{after} the commands in @file{.wgetrc}, thus taking precedence over
360 them.
361 @end table
362
363 @node Logging and Input File Options, Download Options, Basic Startup Options, Invoking
364 @section Logging and Input File Options
365
366 @table @samp
367 @cindex output file
368 @cindex log file
369 @item -o @var{logfile}
370 @itemx --output-file=@var{logfile}
371 Log all messages to @var{logfile}.  The messages are normally reported
372 to standard error.
373
374 @cindex append to log
375 @item -a @var{logfile}
376 @itemx --append-output=@var{logfile}
377 Append to @var{logfile}.  This is the same as @samp{-o}, only it appends
378 to @var{logfile} instead of overwriting the old log file.  If
379 @var{logfile} does not exist, a new file is created.
380
381 @cindex debug
382 @item -d
383 @itemx --debug
384 Turn on debug output, meaning various information important to the
385 developers of Wget if it does not work properly.  Your system
386 administrator may have chosen to compile Wget without debug support, in
387 which case @samp{-d} will not work.  Please note that compiling with
388 debug support is always safe---Wget compiled with the debug support will
389 @emph{not} print any debug info unless requested with @samp{-d}.
390 @xref{Reporting Bugs} for more information on how to use @samp{-d} for
391 sending bug reports.
392
393 @cindex quiet
394 @item -q
395 @itemx --quiet
396 Turn off Wget's output.
397
398 @cindex verbose
399 @item -v
400 @itemx --verbose
401 Turn on verbose output, with all the available data.  The default output
402 is verbose.
403
404 @item -nv
405 @itemx --non-verbose
406 Non-verbose output---turn off verbose without being completely quiet
407 (use @samp{-q} for that), which means that error messages and basic
408 information still get printed.
409
410 @cindex input-file
411 @item -i @var{file}
412 @itemx --input-file=@var{file}
413 Read @sc{url}s from @var{file}, in which case no @sc{url}s need to be on
414 the command line.  If there are @sc{url}s both on the command line and
415 in an input file, those on the command lines will be the first ones to
416 be retrieved.  The @var{file} need not be an @sc{html} document (but no
417 harm if it is)---it is enough if the @sc{url}s are just listed
418 sequentially.
419
420 However, if you specify @samp{--force-html}, the document will be
421 regarded as @samp{html}.  In that case you may have problems with
422 relative links, which you can solve either by adding @code{<base
423 href="@var{url}">} to the documents or by specifying
424 @samp{--base=@var{url}} on the command line.
425
426 @cindex force html
427 @item -F
428 @itemx --force-html
429 When input is read from a file, force it to be treated as an @sc{html}
430 file.  This enables you to retrieve relative links from existing
431 @sc{html} files on your local disk, by adding @code{<base
432 href="@var{url}">} to @sc{html}, or using the @samp{--base} command-line
433 option.
434
435 @cindex base for relative links in input file
436 @item -B @var{URL}
437 @itemx --base=@var{URL}
438 When used in conjunction with @samp{-F}, prepends @var{URL} to relative
439 links in the file specified by @samp{-i}.
440 @end table
441
442 @node Download Options, Directory Options, Logging and Input File Options, Invoking
443 @section Download Options
444
445 @table @samp
446 @cindex bind() address
447 @cindex client IP address
448 @cindex IP address, client
449 @item --bind-address=@var{ADDRESS}
450 When making client TCP/IP connections, @code{bind()} to @var{ADDRESS} on
451 the local machine.  @var{ADDRESS} may be specified as a hostname or IP
452 address.  This option can be useful if your machine is bound to multiple
453 IPs.
454
455 @cindex retries
456 @cindex tries
457 @cindex number of retries
458 @item -t @var{number}
459 @itemx --tries=@var{number}
460 Set number of retries to @var{number}.  Specify 0 or @samp{inf} for
461 infinite retrying.
462
463 @item -O @var{file}
464 @itemx --output-document=@var{file}
465 The documents will not be written to the appropriate files, but all will
466 be concatenated together and written to @var{file}.  If @var{file}
467 already exists, it will be overwritten.  If the @var{file} is @samp{-},
468 the documents will be written to standard output.  Including this option
469 automatically sets the number of tries to 1.
470
471 @cindex clobbering, file
472 @cindex downloading multiple times
473 @cindex no-clobber
474 @item -nc
475 @itemx --no-clobber
476 If a file is downloaded more than once in the same directory, wget's
477 behavior depends on a few options, including @samp{-nc}.  In certain
478 cases, the local file will be "clobbered", or overwritten, upon repeated
479 download.  In other cases it will be preserved.
480
481 When running wget without @samp{-N}, @samp{-nc}, or @samp{-r},
482 downloading the same file in the same directory will result in the
483 original copy of @samp{@var{file}} being preserved and the second copy
484 being named @samp{@var{file}.1}.  If that file is downloaded yet again,
485 the third copy will be named @samp{@var{file}.2}, and so on.  When
486 @samp{-nc} is specified, this behavior is suppressed, and wget will
487 refuse to download newer copies of @samp{@var{file}}.  Therefore,
488 "no-clobber" is actually a misnomer in this mode -- it's not clobbering
489 that's prevented (as the numeric suffixes were already preventing
490 clobbering), but rather the multiple version saving that's prevented.
491
492 When running wget with @samp{-r}, but without @samp{-N} or @samp{-nc},
493 re-downloading a file will result in the new copy simply overwriting the
494 old.  Adding @samp{-nc} will prevent this behavior, instead causing the
495 original version to be preserved and any newer copies on the server to
496 be ignored.
497
498 When running wget with @samp{-N}, with or without @samp{-r}, the
499 decision as to whether or not to download a newer copy of a file depends
500 on the local and remote timestamp and size of the file
501 (@xref{Time-Stamping}).  @samp{-nc} may not be specified at the same
502 time as @samp{-N}.
503
504 Note that when @samp{-nc} is specified, files with the suffixes
505 @samp{.html} or (yuck) @samp{.htm} will be loaded from the local disk
506 and parsed as if they had been retrieved from the Web.
507
508 @cindex continue retrieval
509 @item -c
510 @itemx --continue
511 Continue getting an existing file.  This is useful when you want to
512 finish up the download started by another program, or a previous
513 instance of Wget.  Thus you can write:
514
515 @example
516 wget -c ftp://sunsite.doc.ic.ac.uk/ls-lR.Z
517 @end example
518
519 If there is a file name @file{ls-lR.Z} in the current directory, Wget
520 will assume that it is the first portion of the remote file, and will
521 require the server to continue the retrieval from an offset equal to the
522 length of the local file.
523
524 Note that you need not specify this option if all you want is Wget to
525 continue retrieving where it left off when the connection is lost---Wget
526 does this by default.  You need this option only when you want to
527 continue retrieval of a file already halfway retrieved, saved by another
528 @sc{ftp} client, or left by Wget being killed.
529
530 Without @samp{-c}, the previous example would just begin to download the
531 remote file to @file{ls-lR.Z.1}.  The @samp{-c} option is also
532 applicable for @sc{http} servers that support the @code{Range} header.
533
534 Note that if you use @samp{-c} on a file that's already downloaded
535 completely, @samp{@var{file}} will not be changed, nor will a second
536 @samp{@var{file}.1} copy be created.
537
538 @cindex dot style
539 @cindex retrieval tracing style
540 @item --dot-style=@var{style}
541 Set the retrieval style to @var{style}.  Wget traces the retrieval of
542 each document by printing dots on the screen, each dot representing a
543 fixed amount of retrieved data.  Any number of dots may be separated in
544 a @dfn{cluster}, to make counting easier.  This option allows you to
545 choose one of the pre-defined styles, determining the number of bytes
546 represented by a dot, the number of dots in a cluster, and the number of
547 dots on the line.
548
549 With the @code{default} style each dot represents 1K, there are ten dots
550 in a cluster and 50 dots in a line.  The @code{binary} style has a more
551 ``computer''-like orientation---8K dots, 16-dots clusters and 48 dots
552 per line (which makes for 384K lines).  The @code{mega} style is
553 suitable for downloading very large files---each dot represents 64K
554 retrieved, there are eight dots in a cluster, and 48 dots on each line
555 (so each line contains 3M).  The @code{micro} style is exactly the
556 reverse; it is suitable for downloading small files, with 128-byte dots,
557 8 dots per cluster, and 48 dots (6K) per line.
558
559 @item -N
560 @itemx --timestamping
561 Turn on time-stamping.  @xref{Time-Stamping} for details.
562
563 @cindex server response, print
564 @item -S
565 @itemx --server-response
566 Print the headers sent by @sc{http} servers and responses sent by
567 @sc{ftp} servers.
568
569 @cindex Wget as spider
570 @cindex spider
571 @item --spider
572 When invoked with this option, Wget will behave as a Web @dfn{spider},
573 which means that it will not download the pages, just check that they
574 are there.  You can use it to check your bookmarks, e.g. with:
575
576 @example
577 wget --spider --force-html -i bookmarks.html
578 @end example
579
580 This feature needs much more work for Wget to get close to the
581 functionality of real @sc{www} spiders.
582
583 @cindex timeout
584 @item -T seconds
585 @itemx --timeout=@var{seconds}
586 Set the read timeout to @var{seconds} seconds.  Whenever a network read
587 is issued, the file descriptor is checked for a timeout, which could
588 otherwise leave a pending connection (uninterrupted read).  The default
589 timeout is 900 seconds (fifteen minutes).  Setting timeout to 0 will
590 disable checking for timeouts.
591
592 Please do not lower the default timeout value with this option unless
593 you know what you are doing.
594
595 @cindex pause
596 @cindex wait
597 @item -w @var{seconds}
598 @itemx --wait=@var{seconds}
599 Wait the specified number of seconds between the retrievals.  Use of
600 this option is recommended, as it lightens the server load by making the
601 requests less frequent.  Instead of in seconds, the time can be
602 specified in minutes using the @code{m} suffix, in hours using @code{h}
603 suffix, or in days using @code{d} suffix.
604
605 Specifying a large value for this option is useful if the network or the
606 destination host is down, so that Wget can wait long enough to
607 reasonably expect the network error to be fixed before the retry.
608
609 @cindex retries, waiting between
610 @cindex waiting between retries
611 @item --waitretry=@var{seconds}
612 If you don't want Wget to wait between @emph{every} retrieval, but only
613 between retries of failed downloads, you can use this option.  Wget will
614 use "linear backoff", waiting 1 second after the first failure on a
615 given file, then waiting 2 seconds after the second failure on that
616 file, up to the maximum number of @var{seconds} you specify.  Therefore,
617 a value of 10 will actually make Wget wait up to (1 + 2 + ... + 10) = 55
618 seconds per file.
619
620 Note that this option is turned on by default in the global
621 @file{wgetrc} file.
622
623 @cindex proxy
624 @item -Y on/off
625 @itemx --proxy=on/off
626 Turn proxy support on or off. The proxy is on by default if the
627 appropriate environmental variable is defined.
628
629 @cindex quota
630 @item -Q @var{quota}
631 @itemx --quota=@var{quota}
632 Specify download quota for automatic retrievals.  The value can be
633 specified in bytes (default), kilobytes (with @samp{k} suffix), or
634 megabytes (with @samp{m} suffix).
635
636 Note that quota will never affect downloading a single file.  So if you
637 specify @samp{wget -Q10k ftp://wuarchive.wustl.edu/ls-lR.gz}, all of the
638 @file{ls-lR.gz} will be downloaded.  The same goes even when several
639 @sc{url}s are specified on the command-line.  However, quota is
640 respected when retrieving either recursively, or from an input file.
641 Thus you may safely type @samp{wget -Q2m -i sites}---download will be
642 aborted when the quota is exceeded.
643
644 Setting quota to 0 or to @samp{inf} unlimits the download quota.
645 @end table
646
647 @node Directory Options, HTTP Options, Download Options, Invoking
648 @section Directory Options
649
650 @table @samp
651 @item -nd
652 @itemx --no-directories
653 Do not create a hierarchy of directories when retrieving
654 recursively. With this option turned on, all files will get saved to the
655 current directory, without clobbering (if a name shows up more than
656 once, the filenames will get extensions @samp{.n}).
657
658 @item -x
659 @itemx --force-directories
660 The opposite of @samp{-nd}---create a hierarchy of directories, even if
661 one would not have been created otherwise.  E.g. @samp{wget -x
662 http://fly.cc.fer.hr/robots.txt} will save the downloaded file to
663 @file{fly.cc.fer.hr/robots.txt}.
664
665 @item -nH
666 @itemx --no-host-directories
667 Disable generation of host-prefixed directories.  By default, invoking
668 Wget with @samp{-r http://fly.cc.fer.hr/} will create a structure of
669 directories beginning with @file{fly.cc.fer.hr/}.  This option disables
670 such behavior.
671
672 @cindex cut directories
673 @item --cut-dirs=@var{number}
674 Ignore @var{number} directory components.  This is useful for getting a
675 fine-grained control over the directory where recursive retrieval will
676 be saved.
677
678 Take, for example, the directory at
679 @samp{ftp://ftp.xemacs.org/pub/xemacs/}.  If you retrieve it with
680 @samp{-r}, it will be saved locally under
681 @file{ftp.xemacs.org/pub/xemacs/}.  While the @samp{-nH} option can
682 remove the @file{ftp.xemacs.org/} part, you are still stuck with
683 @file{pub/xemacs}.  This is where @samp{--cut-dirs} comes in handy; it
684 makes Wget not ``see'' @var{number} remote directory components.  Here
685 are several examples of how @samp{--cut-dirs} option works.
686
687 @example
688 @group
689 No options        -> ftp.xemacs.org/pub/xemacs/
690 -nH               -> pub/xemacs/
691 -nH --cut-dirs=1  -> xemacs/
692 -nH --cut-dirs=2  -> .
693
694 --cut-dirs=1      -> ftp.xemacs.org/xemacs/
695 ...
696 @end group
697 @end example
698
699 If you just want to get rid of the directory structure, this option is
700 similar to a combination of @samp{-nd} and @samp{-P}.  However, unlike
701 @samp{-nd}, @samp{--cut-dirs} does not lose with subdirectories---for
702 instance, with @samp{-nH --cut-dirs=1}, a @file{beta/} subdirectory will
703 be placed to @file{xemacs/beta}, as one would expect.
704
705 @cindex directory prefix
706 @item -P @var{prefix}
707 @itemx --directory-prefix=@var{prefix}
708 Set directory prefix to @var{prefix}.  The @dfn{directory prefix} is the
709 directory where all other files and subdirectories will be saved to,
710 i.e. the top of the retrieval tree.  The default is @samp{.} (the
711 current directory).
712 @end table
713
714 @node HTTP Options, FTP Options, Directory Options, Invoking
715 @section HTTP Options
716
717 @table @samp
718 @cindex .html extension
719 @item -E
720 @itemx --html-extension
721 If a file of type @samp{text/html} is downloaded and the URL does not
722 end with the regexp "\.[Hh][Tt][Mm][Ll]?", this option will cause the
723 suffix @samp{.html} to be appended to the local filename.  This is
724 useful, for instance, when you're mirroring a remote site that uses
725 @samp{.asp} pages, but you want the mirrored pages to be viewable on
726 your stock Apache server.  Another good use for this is when you're
727 downloading the output of CGIs.  A URL like
728 @samp{http://site.com/article.cgi?25} will be saved as
729 @file{article.cgi?25.html}.
730
731 Note that filenames changed in this way will be re-downloaded every time
732 you re-mirror a site, because wget can't tell that the local
733 @file{@var{X}.html} file corresponds to remote URL @samp{@var{X}} (since
734 it doesn't yet know that the URL produces output of type
735 @samp{text/html}.  To prevent this re-downloading, you must use
736 @samp{-k} and @samp{-K} so that the original version of the file will be
737 saved as @file{@var{X}.orig} (@xref{Recursive Retrieval Options}).
738
739 @cindex http user
740 @cindex http password
741 @cindex authentication
742 @item --http-user=@var{user}
743 @itemx --http-passwd=@var{password}
744 Specify the username @var{user} and password @var{password} on an
745 @sc{http} server.  According to the type of the challenge, Wget will
746 encode them using either the @code{basic} (insecure) or the
747 @code{digest} authentication scheme.
748
749 Another way to specify username and password is in the @sc{url} itself
750 (@xref{URL Format}).  For more information about security issues with
751 Wget, @xref{Security Considerations}.
752
753 @cindex proxy
754 @cindex cache
755 @item -C on/off
756 @itemx --cache=on/off
757 When set to off, disable server-side cache.  In this case, Wget will
758 send the remote server an appropriate directive (@samp{Pragma:
759 no-cache}) to get the file from the remote service, rather than
760 returning the cached version.  This is especially useful for retrieving
761 and flushing out-of-date documents on proxy servers.
762
763 Caching is allowed by default.
764
765 @cindex Content-Length, ignore
766 @cindex ignore length
767 @item --ignore-length
768 Unfortunately, some @sc{http} servers (@sc{cgi} programs, to be more
769 precise) send out bogus @code{Content-Length} headers, which makes Wget
770 go wild, as it thinks not all the document was retrieved.  You can spot
771 this syndrome if Wget retries getting the same document again and again,
772 each time claiming that the (otherwise normal) connection has closed on
773 the very same byte.
774
775 With this option, Wget will ignore the @code{Content-Length} header---as
776 if it never existed.
777
778 @cindex header, add
779 @item --header=@var{additional-header}
780 Define an @var{additional-header} to be passed to the @sc{http} servers.
781 Headers must contain a @samp{:} preceded by one or more non-blank
782 characters, and must not contain newlines.
783
784 You may define more than one additional header by specifying
785 @samp{--header} more than once.
786
787 @example
788 @group
789 wget --header='Accept-Charset: iso-8859-2' \
790      --header='Accept-Language: hr'        \
791        http://fly.cc.fer.hr/
792 @end group
793 @end example
794
795 Specification of an empty string as the header value will clear all
796 previous user-defined headers.
797
798 @cindex proxy user
799 @cindex proxy password
800 @cindex proxy authentication
801 @item --proxy-user=@var{user}
802 @itemx --proxy-passwd=@var{password}
803 Specify the username @var{user} and password @var{password} for
804 authentication on a proxy server.  Wget will encode them using the
805 @code{basic} authentication scheme.
806
807 @cindex http referer
808 @cindex referer, http
809 @item --referer=@var{url}
810 Include `Referer: @var{url}' header in HTTP request.  Useful for
811 retrieving documents with server-side processing that assume they are
812 always being retrieved by interactive web browsers and only come out
813 properly when Referer is set to one of the pages that point to them.
814
815 @cindex server response, save
816 @item -s
817 @itemx --save-headers
818 Save the headers sent by the @sc{http} server to the file, preceding the
819 actual contents, with an empty line as the separator.
820
821 @cindex user-agent
822 @item -U @var{agent-string}
823 @itemx --user-agent=@var{agent-string}
824 Identify as @var{agent-string} to the @sc{http} server.
825
826 The @sc{http} protocol allows the clients to identify themselves using a
827 @code{User-Agent} header field.  This enables distinguishing the
828 @sc{www} software, usually for statistical purposes or for tracing of
829 protocol violations.  Wget normally identifies as
830 @samp{Wget/@var{version}}, @var{version} being the current version
831 number of Wget.
832
833 However, some sites have been known to impose the policy of tailoring
834 the output according to the @code{User-Agent}-supplied information.
835 While conceptually this is not such a bad idea, it has been abused by
836 servers denying information to clients other than @code{Mozilla} or
837 Microsoft @code{Internet Explorer}.  This option allows you to change
838 the @code{User-Agent} line issued by Wget.  Use of this option is
839 discouraged, unless you really know what you are doing.
840 @end table
841
842 @node FTP Options, Recursive Retrieval Options, HTTP Options, Invoking
843 @section FTP Options
844
845 @table @samp
846 @cindex symbolic links, retrieving
847 @item --retr-symlinks
848 Usually, when retrieving @sc{ftp} directories recursively and a symbolic
849 link is encountered, the linked-to file is not downloaded.  Instead, a
850 matching symbolic link is created on the local filesystem.  The
851 pointed-to file will not be downloaded unless this recursive retrieval
852 would have encountered it separately and downloaded it anyway.
853
854 When @samp{--retr-symlinks} is specified, however, symbolic links are
855 traversed and the pointed-to files are retrieved.  At this time, this
856 option does not cause wget to traverse symlinks to directories and
857 recurse through them, but in the future it should be enhanced to do
858 this.
859
860 Note that when retrieving a file (not a directory) because it was
861 specified on the commandline, rather than because it was recursed to,
862 this option has no effect.  Symbolic links are always traversed in this
863 case.
864
865 @cindex globbing, toggle
866 @item -g on/off
867 @itemx --glob=on/off
868 Turn @sc{ftp} globbing on or off.  Globbing means you may use the
869 shell-like special characters (@dfn{wildcards}), like @samp{*},
870 @samp{?}, @samp{[} and @samp{]} to retrieve more than one file from the
871 same directory at once, like:
872
873 @example
874 wget ftp://gnjilux.cc.fer.hr/*.msg
875 @end example
876
877 By default, globbing will be turned on if the @sc{url} contains a
878 globbing character.  This option may be used to turn globbing on or off
879 permanently.
880
881 You may have to quote the @sc{url} to protect it from being expanded by
882 your shell.  Globbing makes Wget look for a directory listing, which is
883 system-specific.  This is why it currently works only with Unix @sc{ftp}
884 servers (and the ones emulating Unix @code{ls} output).
885
886 @cindex passive ftp
887 @item --passive-ftp
888 Use the @dfn{passive} @sc{ftp} retrieval scheme, in which the client
889 initiates the data connection.  This is sometimes required for @sc{ftp}
890 to work behind firewalls.
891 @end table
892
893 @node Recursive Retrieval Options, Recursive Accept/Reject Options, FTP Options, Invoking
894 @section Recursive Retrieval Options
895
896 @table @samp
897 @item -r
898 @itemx --recursive
899 Turn on recursive retrieving.  @xref{Recursive Retrieval} for more
900 details.
901
902 @item -l @var{depth}
903 @itemx --level=@var{depth}
904 Specify recursion maximum depth level @var{depth} (@xref{Recursive
905 Retrieval}).  The default maximum depth is 5.
906
907 @cindex proxy filling
908 @cindex delete after retrieval
909 @cindex filling proxy cache
910 @item --delete-after
911 This option tells Wget to delete every single file it downloads,
912 @emph{after} having done so.  It is useful for pre-fetching popular
913 pages through a proxy, e.g.:
914
915 @example
916 wget -r -nd --delete-after http://whatever.com/~popular/page/
917 @end example
918
919 The @samp{-r} option is to retrieve recursively, and @samp{-nd} to not
920 create directories.  
921
922 Note that @samp{--delete-after} deletes files on the local machine.  It
923 does not issue the @samp{DELE} command to remote FTP sites, for
924 instance.  Also note that when @samp{--delete-after} is specified,
925 @samp{--convert-links} is ignored, so @samp{.orig} files are simply not
926 created in the first place.
927
928 @cindex conversion of links
929 @cindex link conversion
930 @item -k
931 @itemx --convert-links
932 Convert the non-relative links to relative ones locally.  Only the
933 references to the documents actually downloaded will be converted; the
934 rest will be left unchanged.
935
936 Note that only at the end of the download can Wget know which links have
937 been downloaded.  Because of that, much of the work done by @samp{-k}
938 will be performed at the end of the downloads.
939
940 @cindex backing up converted files
941 @item -K
942 @itemx --backup-converted
943 When converting a file, back up the original version with a @samp{.orig}
944 suffix.  Affects the behavior of @samp{-N} (@xref{HTTP Time-Stamping
945 Internals}).
946
947 @item -m
948 @itemx --mirror
949 Turn on options suitable for mirroring.  This option turns on recursion
950 and time-stamping, sets infinite recursion depth and keeps @sc{ftp}
951 directory listings.  It is currently equivalent to
952 @samp{-r -N -l inf -nr}.
953
954 @item -nr
955 @itemx --dont-remove-listing
956 Don't remove the temporary @file{.listing} files generated by @sc{ftp}
957 retrievals.  Normally, these files contain the raw directory listings
958 received from @sc{ftp} servers.  Not removing them can be useful to
959 access the full remote file list when running a mirror, or for debugging
960 purposes.
961
962 @cindex page requisites
963 @cindex required images, downloading
964 @item -p
965 @itemx --page-requisites
966 This option causes wget to download all the files that are necessary to
967 properly display a given HTML page.  This includes such things as
968 inlined images, sounds, and referenced stylesheets.
969
970 Ordinarily, when downloading a single HTML page, any requisite documents
971 that may be needed to display it properly are not downloaded.  Using
972 @samp{-r} together with @samp{-l} can help, but since wget does not
973 ordinarily distinguish between external and inlined documents, one is
974 generally left with "leaf documents" that are missing their requisites.
975
976 For instance, say document @file{1.html} contains an @code{<IMG>} tag
977 referencing @file{1.gif} and an @code{<A>} tag pointing to external
978 document @file{2.html}.  Say that @file{2.html} is the same but that its
979 image is @file{2.gif} and it links to @file{3.html}.  Say this
980 continues up to some arbitrarily high number.
981
982 If one executes the command:
983
984 @example
985 wget -r -l 2 http://@var{site}/1.html
986 @end example
987
988 then @file{1.html}, @file{1.gif}, @file{2.html}, @file{2.gif}, and
989 @file{3.html} will be downloaded.  As you can see, @file{3.html} is
990 without its requisite @file{3.gif} because wget is simply counting the
991 number of hops (up to 2) away from @file{1.html} in order to determine
992 where to stop the recursion.  However, with this command:
993
994 @example
995 wget -r -l 2 -p http://@var{site}/1.html
996 @end example
997
998 all the above files @emph{and} @file{3.html}'s requisite @file{3.gif}
999 will be downloaded.  Similarly,
1000
1001 @example
1002 wget -r -l 1 -p http://@var{site}/1.html
1003 @end example
1004
1005 will cause @file{1.html}, @file{1.gif}, @file{2.html}, and @file{2.gif}
1006 to be downloaded.  One might think that:
1007
1008 @example
1009 wget -r -l 0 -p http://@var{site}/1.html
1010 @end example
1011
1012 would download just @file{1.html} and @file{1.gif}, but unfortunately
1013 this is not the case, because @samp{-l 0} is equivalent to @samp{-l inf}
1014 -- that is, infinite recursion.  To download a single HTML page (or a
1015 handful of them, all specified on the commandline or in a @samp{-i} @sc{url}
1016 input file) and its requisites, simply leave off @samp{-p} and @samp{-l}:
1017
1018 @example
1019 wget -p http://@var{site}/1.html
1020 @end example
1021
1022 Note that wget will behave as if @samp{-r} had been specified, but only
1023 that single page and its requisites will be downloaded.  Links from that
1024 page to external documents will not be followed.  Actually, to download
1025 a single page and all its requisites (even if they exist on separate
1026 websites), and make sure the lot displays properly locally, this author
1027 likes to use a few options in addition to @samp{-p}:
1028
1029 @example
1030 wget -E -H -k -K -nh -p http://@var{site}/@var{document}
1031 @end example
1032
1033 To finish off this topic, it's worth knowing that wget's idea of an
1034 external document link is any URL specified in an @code{<A>} tag, an
1035 @code{<AREA>} tag, or a @code{<LINK>} tag other than @code{<LINK
1036 REL="stylesheet">}.
1037 @end table
1038
1039 @node Recursive Accept/Reject Options,  , Recursive Retrieval Options, Invoking
1040 @section Recursive Accept/Reject Options
1041
1042 @table @samp
1043 @item -A @var{acclist} --accept @var{acclist}
1044 @itemx -R @var{rejlist} --reject @var{rejlist}
1045 Specify comma-separated lists of file name suffixes or patterns to
1046 accept or reject (@xref{Types of Files} for more details).
1047
1048 @item -D @var{domain-list}
1049 @itemx --domains=@var{domain-list}
1050 Set domains to be accepted and @sc{dns} looked-up, where
1051 @var{domain-list} is a comma-separated list.  Note that it does
1052 @emph{not} turn on @samp{-H}.  This option speeds things up, even if
1053 only one host is spanned (@xref{Domain Acceptance}).
1054
1055 @item --exclude-domains @var{domain-list}
1056 Exclude the domains given in a comma-separated @var{domain-list} from
1057 @sc{dns}-lookup (@xref{Domain Acceptance}).
1058
1059 @cindex follow FTP links
1060 @item --follow-ftp
1061 Follow @sc{ftp} links from @sc{html} documents.  Without this option,
1062 Wget will ignore all the @sc{ftp} links.
1063
1064 @cindex tag-based recursive pruning
1065 @item --follow-tags=@var{list}
1066 Wget has an internal table of HTML tag / attribute pairs that it
1067 considers when looking for linked documents during a recursive
1068 retrieval.  If a user wants only a subset of those tags to be
1069 considered, however, he or she should be specify such tags in a
1070 comma-separated @var{list} with this option.
1071
1072 @item -G @var{list}
1073 @itemx --ignore-tags=@var{list}
1074 This is the opposite of the @samp{--follow-tags} option.  To skip
1075 certain HTML tags when recursively looking for documents to download,
1076 specify them in a comma-separated @var{list}.  
1077
1078 In the past, the @samp{-G} option was the best bet for downloading a
1079 single page and its requisites, using a commandline like:
1080
1081 @example
1082 wget -Ga,area -H -k -K -nh -r http://@var{site}/@var{document}
1083 @end example
1084
1085 However, the author of this option came across a page with tags like
1086 @code{<LINK REL="home" HREF="/">} and came to the realization that
1087 @samp{-G} was not enough.  One can't just tell wget to ignore
1088 @code{<LINK>}, because then stylesheets will not be downloaded.  Now the
1089 best bet for downloading a single page and its requisites is the
1090 dedicated @samp{--page-requisites} option.
1091
1092 @item -H
1093 @itemx --span-hosts
1094 Enable spanning across hosts when doing recursive retrieving (@xref{All
1095 Hosts}).
1096
1097 @item -L
1098 @itemx --relative
1099 Follow relative links only.  Useful for retrieving a specific home page
1100 without any distractions, not even those from the same hosts
1101 (@xref{Relative Links}).
1102
1103 @item -I @var{list}
1104 @itemx --include-directories=@var{list}
1105 Specify a comma-separated list of directories you wish to follow when
1106 downloading (@xref{Directory-Based Limits} for more details.)  Elements
1107 of @var{list} may contain wildcards.
1108
1109 @item -X @var{list}
1110 @itemx --exclude-directories=@var{list}
1111 Specify a comma-separated list of directories you wish to exclude from
1112 download (@xref{Directory-Based Limits} for more details.)  Elements of
1113 @var{list} may contain wildcards.
1114
1115 @item -nh
1116 @itemx --no-host-lookup
1117 Disable the time-consuming @sc{dns} lookup of almost all hosts
1118 (@xref{Host Checking}).
1119
1120 @item -np
1121 @item --no-parent
1122 Do not ever ascend to the parent directory when retrieving recursively.
1123 This is a useful option, since it guarantees that only the files
1124 @emph{below} a certain hierarchy will be downloaded.
1125 @xref{Directory-Based Limits} for more details.
1126 @end table
1127
1128 @node Recursive Retrieval, Following Links, Invoking, Top
1129 @chapter Recursive Retrieval
1130 @cindex recursion
1131 @cindex retrieving
1132 @cindex recursive retrieval
1133
1134 GNU Wget is capable of traversing parts of the Web (or a single
1135 @sc{http} or @sc{ftp} server), depth-first following links and directory
1136 structure.  This is called @dfn{recursive} retrieving, or
1137 @dfn{recursion}.
1138
1139 With @sc{http} @sc{url}s, Wget retrieves and parses the @sc{html} from
1140 the given @sc{url}, documents, retrieving the files the @sc{html}
1141 document was referring to, through markups like @code{href}, or
1142 @code{src}.  If the freshly downloaded file is also of type
1143 @code{text/html}, it will be parsed and followed further.
1144
1145 The maximum @dfn{depth} to which the retrieval may descend is specified
1146 with the @samp{-l} option (the default maximum depth is five layers).
1147 @xref{Recursive Retrieval}.
1148
1149 When retrieving an @sc{ftp} @sc{url} recursively, Wget will retrieve all
1150 the data from the given directory tree (including the subdirectories up
1151 to the specified depth) on the remote server, creating its mirror image
1152 locally.  @sc{ftp} retrieval is also limited by the @code{depth}
1153 parameter.
1154
1155 By default, Wget will create a local directory tree, corresponding to
1156 the one found on the remote server.
1157
1158 Recursive retrieving can find a number of applications, the most
1159 important of which is mirroring.  It is also useful for @sc{www}
1160 presentations, and any other opportunities where slow network
1161 connections should be bypassed by storing the files locally.
1162
1163 You should be warned that invoking recursion may cause grave overloading
1164 on your system, because of the fast exchange of data through the
1165 network; all of this may hamper other users' work.  The same stands for
1166 the foreign server you are mirroring---the more requests it gets in a
1167 rows, the greater is its load.
1168
1169 Careless retrieving can also fill your file system uncontrollably, which
1170 can grind the machine to a halt.
1171
1172 The load can be minimized by lowering the maximum recursion level
1173 (@samp{-l}) and/or by lowering the number of retries (@samp{-t}).  You
1174 may also consider using the @samp{-w} option to slow down your requests
1175 to the remote servers, as well as the numerous options to narrow the
1176 number of followed links (@xref{Following Links}).
1177
1178 Recursive retrieval is a good thing when used properly.  Please take all
1179 precautions not to wreak havoc through carelessness.
1180
1181 @node Following Links, Time-Stamping, Recursive Retrieval, Top
1182 @chapter Following Links
1183 @cindex links
1184 @cindex following links
1185
1186 When retrieving recursively, one does not wish to retrieve loads of
1187 unnecessary data.  Most of the time the users bear in mind exactly what
1188 they want to download, and want Wget to follow only specific links.
1189
1190 For example, if you wish to download the music archive from
1191 @samp{fly.cc.fer.hr}, you will not want to download all the home pages
1192 that happen to be referenced by an obscure part of the archive.
1193
1194 Wget possesses several mechanisms that allows you to fine-tune which
1195 links it will follow.
1196
1197 @menu
1198 * Relative Links::         Follow relative links only.
1199 * Host Checking::          Follow links on the same host.
1200 * Domain Acceptance::      Check on a list of domains.
1201 * All Hosts::              No host restrictions.
1202 * Types of Files::         Getting only certain files.
1203 * Directory-Based Limits:: Getting only certain directories.
1204 * FTP Links::              Following FTP links.
1205 @end menu
1206
1207 @node Relative Links, Host Checking, Following Links, Following Links
1208 @section Relative Links
1209 @cindex relative links
1210
1211 When only relative links are followed (option @samp{-L}), recursive
1212 retrieving will never span hosts.  No time-expensive @sc{dns}-lookups
1213 will be performed, and the process will be very fast, with the minimum
1214 strain of the network.  This will suit your needs often, especially when
1215 mirroring the output of various @code{x2html} converters, since they
1216 generally output relative links.
1217
1218 @node Host Checking, Domain Acceptance, Relative Links, Following Links
1219 @section Host Checking
1220 @cindex DNS lookup
1221 @cindex host lookup
1222 @cindex host checking
1223
1224 The drawback of following the relative links solely is that humans often
1225 tend to mix them with absolute links to the very same host, and the very
1226 same page.  In this mode (which is the default mode for following links)
1227 all @sc{url}s that refer to the same host will be retrieved.
1228
1229 The problem with this option are the aliases of the hosts and domains.
1230 Thus there is no way for Wget to know that @samp{regoc.srce.hr} and
1231 @samp{www.srce.hr} are the same host, or that @samp{fly.cc.fer.hr} is
1232 the same as @samp{fly.cc.etf.hr}.  Whenever an absolute link is
1233 encountered, the host is @sc{dns}-looked-up with @code{gethostbyname} to
1234 check whether we are maybe dealing with the same hosts.  Although the
1235 results of @code{gethostbyname} are cached, it is still a great
1236 slowdown, e.g. when dealing with large indices of home pages on different
1237 hosts (because each of the hosts must be @sc{dns}-resolved to see
1238 whether it just @emph{might} be an alias of the starting host).
1239
1240 To avoid the overhead you may use @samp{-nh}, which will turn off
1241 @sc{dns}-resolving and make Wget compare hosts literally.  This will
1242 make things run much faster, but also much less reliable
1243 (e.g. @samp{www.srce.hr} and @samp{regoc.srce.hr} will be flagged as
1244 different hosts).
1245
1246 Note that modern @sc{http} servers allow one IP address to host several
1247 @dfn{virtual servers}, each having its own directory hierarchy.  Such
1248 ``servers'' are distinguished by their hostnames (all of which point to
1249 the same IP address); for this to work, a client must send a @code{Host}
1250 header, which is what Wget does.  However, in that case Wget @emph{must
1251 not} try to divine a host's ``real'' address, nor try to use the same
1252 hostname for each access, i.e. @samp{-nh} must be turned on.
1253
1254 In other words, the @samp{-nh} option must be used to enable the
1255 retrieval from virtual servers distinguished by their hostnames.  As the
1256 number of such server setups grow, the behavior of @samp{-nh} may become
1257 the default in the future.
1258
1259 @node Domain Acceptance, All Hosts, Host Checking, Following Links
1260 @section Domain Acceptance
1261
1262 With the @samp{-D} option you may specify the domains that will be
1263 followed.  The hosts the domain of which is not in this list will not be
1264 @sc{dns}-resolved.  Thus you can specify @samp{-Dmit.edu} just to make
1265 sure that @strong{nothing outside of @sc{mit} gets looked up}.  This is
1266 very important and useful.  It also means that @samp{-D} does @emph{not}
1267 imply @samp{-H} (span all hosts), which must be specified explicitly.
1268 Feel free to use this options since it will speed things up, with almost
1269 all the reliability of checking for all hosts.  Thus you could invoke
1270
1271 @example
1272 wget -r -D.hr http://fly.cc.fer.hr/
1273 @end example
1274
1275 to make sure that only the hosts in @samp{.hr} domain get
1276 @sc{dns}-looked-up for being equal to @samp{fly.cc.fer.hr}.  So
1277 @samp{fly.cc.etf.hr} will be checked (only once!) and found equal, but
1278 @samp{www.gnu.ai.mit.edu} will not even be checked.
1279
1280 Of course, domain acceptance can be used to limit the retrieval to
1281 particular domains with spanning of hosts in them, but then you must
1282 specify @samp{-H} explicitly.  E.g.:
1283
1284 @example
1285 wget -r -H -Dmit.edu,stanford.edu http://www.mit.edu/
1286 @end example
1287
1288 will start with @samp{http://www.mit.edu/}, following links across
1289 @sc{mit} and Stanford.
1290
1291 If there are domains you want to exclude specifically, you can do it
1292 with @samp{--exclude-domains}, which accepts the same type of arguments
1293 of @samp{-D}, but will @emph{exclude} all the listed domains.  For
1294 example, if you want to download all the hosts from @samp{foo.edu}
1295 domain, with the exception of @samp{sunsite.foo.edu}, you can do it like
1296 this:
1297
1298 @example
1299 wget -rH -Dfoo.edu --exclude-domains sunsite.foo.edu http://www.foo.edu/
1300 @end example
1301
1302 @node All Hosts, Types of Files, Domain Acceptance, Following Links
1303 @section All Hosts
1304 @cindex all hosts
1305 @cindex span hosts
1306
1307 When @samp{-H} is specified without @samp{-D}, all hosts are freely
1308 spanned.  There are no restrictions whatsoever as to what part of the
1309 net Wget will go to fetch documents, other than maximum retrieval depth.
1310 If a page references @samp{www.yahoo.com}, so be it.  Such an option is
1311 rarely useful for itself.
1312
1313 @node Types of Files, Directory-Based Limits, All Hosts, Following Links
1314 @section Types of Files
1315 @cindex types of files
1316
1317 When downloading material from the web, you will often want to restrict
1318 the retrieval to only certain file types.  For example, if you are
1319 interested in downloading @sc{gif}s, you will not be overjoyed to get
1320 loads of PostScript documents, and vice versa.
1321
1322 Wget offers two options to deal with this problem.  Each option
1323 description lists a short name, a long name, and the equivalent command
1324 in @file{.wgetrc}.
1325
1326 @cindex accept wildcards
1327 @cindex accept suffixes
1328 @cindex wildcards, accept
1329 @cindex suffixes, accept
1330 @table @samp
1331 @item -A @var{acclist}
1332 @itemx --accept @var{acclist}
1333 @itemx accept = @var{acclist}
1334 The argument to @samp{--accept} option is a list of file suffixes or
1335 patterns that Wget will download during recursive retrieval.  A suffix
1336 is the ending part of a file, and consists of ``normal'' letters,
1337 e.g. @samp{gif} or @samp{.jpg}.  A matching pattern contains shell-like
1338 wildcards, e.g. @samp{books*} or @samp{zelazny*196[0-9]*}.
1339
1340 So, specifying @samp{wget -A gif,jpg} will make Wget download only the
1341 files ending with @samp{gif} or @samp{jpg}, i.e. @sc{gif}s and
1342 @sc{jpeg}s.  On the other hand, @samp{wget -A "zelazny*196[0-9]*"} will
1343 download only files beginning with @samp{zelazny} and containing numbers
1344 from 1960 to 1969 anywhere within.  Look up the manual of your shell for
1345 a description of how pattern matching works.
1346
1347 Of course, any number of suffixes and patterns can be combined into a
1348 comma-separated list, and given as an argument to @samp{-A}.
1349
1350 @cindex reject wildcards
1351 @cindex reject suffixes
1352 @cindex wildcards, reject
1353 @cindex suffixes, reject
1354 @item -R @var{rejlist}
1355 @itemx --reject @var{rejlist}
1356 @itemx reject = @var{rejlist}
1357 The @samp{--reject} option works the same way as @samp{--accept}, only
1358 its logic is the reverse; Wget will download all files @emph{except} the
1359 ones matching the suffixes (or patterns) in the list.
1360
1361 So, if you want to download a whole page except for the cumbersome
1362 @sc{mpeg}s and @sc{.au} files, you can use @samp{wget -R mpg,mpeg,au}.
1363 Analogously, to download all files except the ones beginning with
1364 @samp{bjork}, use @samp{wget -R "bjork*"}.  The quotes are to prevent
1365 expansion by the shell.
1366 @end table
1367
1368 The @samp{-A} and @samp{-R} options may be combined to achieve even
1369 better fine-tuning of which files to retrieve.  E.g. @samp{wget -A
1370 "*zelazny*" -R .ps} will download all the files having @samp{zelazny} as
1371 a part of their name, but @emph{not} the PostScript files.
1372
1373 Note that these two options do not affect the downloading of @sc{html}
1374 files; Wget must load all the @sc{html}s to know where to go at
1375 all---recursive retrieval would make no sense otherwise.
1376
1377 @node Directory-Based Limits, FTP Links, Types of Files, Following Links
1378 @section Directory-Based Limits
1379 @cindex directories
1380 @cindex directory limits
1381
1382 Regardless of other link-following facilities, it is often useful to
1383 place the restriction of what files to retrieve based on the directories
1384 those files are placed in.  There can be many reasons for this---the
1385 home pages may be organized in a reasonable directory structure; or some
1386 directories may contain useless information, e.g. @file{/cgi-bin} or
1387 @file{/dev} directories.
1388
1389 Wget offers three different options to deal with this requirement.  Each
1390 option description lists a short name, a long name, and the equivalent
1391 command in @file{.wgetrc}.
1392
1393 @cindex directories, include
1394 @cindex include directories
1395 @cindex accept directories
1396 @table @samp
1397 @item -I @var{list}
1398 @itemx --include @var{list}
1399 @itemx include_directories = @var{list}
1400 @samp{-I} option accepts a comma-separated list of directories included
1401 in the retrieval.  Any other directories will simply be ignored.  The
1402 directories are absolute paths.
1403
1404 So, if you wish to download from @samp{http://host/people/bozo/}
1405 following only links to bozo's colleagues in the @file{/people}
1406 directory and the bogus scripts in @file{/cgi-bin}, you can specify:
1407
1408 @example
1409 wget -I /people,/cgi-bin http://host/people/bozo/
1410 @end example
1411
1412 @cindex directories, exclude
1413 @cindex exclude directories
1414 @cindex reject directories
1415 @item -X @var{list}
1416 @itemx --exclude @var{list}
1417 @itemx exclude_directories = @var{list}
1418 @samp{-X} option is exactly the reverse of @samp{-I}---this is a list of
1419 directories @emph{excluded} from the download.  E.g. if you do not want
1420 Wget to download things from @file{/cgi-bin} directory, specify @samp{-X
1421 /cgi-bin} on the command line.
1422
1423 The same as with @samp{-A}/@samp{-R}, these two options can be combined
1424 to get a better fine-tuning of downloading subdirectories.  E.g. if you
1425 want to load all the files from @file{/pub} hierarchy except for
1426 @file{/pub/worthless}, specify @samp{-I/pub -X/pub/worthless}.
1427
1428 @cindex no parent
1429 @item -np
1430 @itemx --no-parent
1431 @itemx no_parent = on
1432 The simplest, and often very useful way of limiting directories is
1433 disallowing retrieval of the links that refer to the hierarchy
1434 @dfn{above} than the beginning directory, i.e. disallowing ascent to the
1435 parent directory/directories.
1436
1437 The @samp{--no-parent} option (short @samp{-np}) is useful in this case.
1438 Using it guarantees that you will never leave the existing hierarchy.
1439 Supposing you issue Wget with:
1440
1441 @example
1442 wget -r --no-parent http://somehost/~luzer/my-archive/
1443 @end example
1444
1445 You may rest assured that none of the references to
1446 @file{/~his-girls-homepage/} or @file{/~luzer/all-my-mpegs/} will be
1447 followed.  Only the archive you are interested in will be downloaded.
1448 Essentially, @samp{--no-parent} is similar to
1449 @samp{-I/~luzer/my-archive}, only it handles redirections in a more
1450 intelligent fashion.
1451 @end table
1452
1453 @node FTP Links,  , Directory-Based Limits, Following Links
1454 @section Following FTP Links
1455 @cindex following ftp links
1456
1457 The rules for @sc{ftp} are somewhat specific, as it is necessary for
1458 them to be.  @sc{ftp} links in @sc{html} documents are often included
1459 for purposes of reference, and it is often inconvenient to download them
1460 by default.
1461
1462 To have @sc{ftp} links followed from @sc{html} documents, you need to
1463 specify the @samp{--follow-ftp} option.  Having done that, @sc{ftp}
1464 links will span hosts regardless of @samp{-H} setting.  This is logical,
1465 as @sc{ftp} links rarely point to the same host where the @sc{http}
1466 server resides.  For similar reasons, the @samp{-L} options has no
1467 effect on such downloads.  On the other hand, domain acceptance
1468 (@samp{-D}) and suffix rules (@samp{-A} and @samp{-R}) apply normally.
1469
1470 Also note that followed links to @sc{ftp} directories will not be
1471 retrieved recursively further.
1472
1473 @node Time-Stamping, Startup File, Following Links, Top
1474 @chapter Time-Stamping
1475 @cindex time-stamping
1476 @cindex timestamping
1477 @cindex updating the archives
1478 @cindex incremental updating
1479
1480 One of the most important aspects of mirroring information from the
1481 Internet is updating your archives.
1482
1483 Downloading the whole archive again and again, just to replace a few
1484 changed files is expensive, both in terms of wasted bandwidth and money,
1485 and the time to do the update.  This is why all the mirroring tools
1486 offer the option of incremental updating.
1487
1488 Such an updating mechanism means that the remote server is scanned in
1489 search of @dfn{new} files.  Only those new files will be downloaded in
1490 the place of the old ones.
1491
1492 A file is considered new if one of these two conditions are met:
1493
1494 @enumerate
1495 @item
1496 A file of that name does not already exist locally.
1497
1498 @item
1499 A file of that name does exist, but the remote file was modified more
1500 recently than the local file.
1501 @end enumerate
1502
1503 To implement this, the program needs to be aware of the time of last
1504 modification of both remote and local files.  Such information are
1505 called the @dfn{time-stamps}.
1506
1507 The time-stamping in GNU Wget is turned on using @samp{--timestamping}
1508 (@samp{-N}) option, or through @code{timestamping = on} directive in
1509 @file{.wgetrc}.  With this option, for each file it intends to download,
1510 Wget will check whether a local file of the same name exists.  If it
1511 does, and the remote file is older, Wget will not download it.
1512
1513 If the local file does not exist, or the sizes of the files do not
1514 match, Wget will download the remote file no matter what the time-stamps
1515 say.
1516
1517 @menu
1518 * Time-Stamping Usage::
1519 * HTTP Time-Stamping Internals::
1520 * FTP Time-Stamping Internals::
1521 @end menu
1522
1523 @node Time-Stamping Usage, HTTP Time-Stamping Internals, Time-Stamping, Time-Stamping
1524 @section Time-Stamping Usage
1525 @cindex time-stamping usage
1526 @cindex usage, time-stamping
1527
1528 The usage of time-stamping is simple.  Say you would like to download a
1529 file so that it keeps its date of modification.
1530
1531 @example
1532 wget -S http://www.gnu.ai.mit.edu/
1533 @end example
1534
1535 A simple @code{ls -l} shows that the time stamp on the local file equals
1536 the state of the @code{Last-Modified} header, as returned by the server.
1537 As you can see, the time-stamping info is preserved locally, even
1538 without @samp{-N}.
1539
1540 Several days later, you would like Wget to check if the remote file has
1541 changed, and download it if it has.
1542
1543 @example
1544 wget -N http://www.gnu.ai.mit.edu/
1545 @end example
1546
1547 Wget will ask the server for the last-modified date.  If the local file
1548 is newer, the remote file will not be re-fetched.  However, if the remote
1549 file is more recent, Wget will proceed fetching it normally.
1550
1551 The same goes for @sc{ftp}.  For example:
1552
1553 @example
1554 wget ftp://ftp.ifi.uio.no/pub/emacs/gnus/*
1555 @end example
1556
1557 @code{ls} will show that the timestamps are set according to the state
1558 on the remote server.  Reissuing the command with @samp{-N} will make
1559 Wget re-fetch @emph{only} the files that have been modified.
1560
1561 In both @sc{http} and @sc{ftp} retrieval Wget will time-stamp the local
1562 file correctly (with or without @samp{-N}) if it gets the stamps,
1563 i.e. gets the directory listing for @sc{ftp} or the @code{Last-Modified}
1564 header for @sc{http}.
1565
1566 If you wished to mirror the GNU archive every week, you would use the
1567 following command every week:
1568
1569 @example
1570 wget --timestamping -r ftp://prep.ai.mit.edu/pub/gnu/
1571 @end example
1572
1573 @node HTTP Time-Stamping Internals, FTP Time-Stamping Internals, Time-Stamping Usage, Time-Stamping
1574 @section HTTP Time-Stamping Internals
1575 @cindex http time-stamping
1576
1577 Time-stamping in @sc{http} is implemented by checking of the
1578 @code{Last-Modified} header.  If you wish to retrieve the file
1579 @file{foo.html} through @sc{http}, Wget will check whether
1580 @file{foo.html} exists locally.  If it doesn't, @file{foo.html} will be
1581 retrieved unconditionally.
1582
1583 If the file does exist locally, Wget will first check its local
1584 time-stamp (similar to the way @code{ls -l} checks it), and then send a
1585 @code{HEAD} request to the remote server, demanding the information on
1586 the remote file.
1587
1588 The @code{Last-Modified} header is examined to find which file was
1589 modified more recently (which makes it ``newer'').  If the remote file
1590 is newer, it will be downloaded; if it is older, Wget will give
1591 up.@footnote{As an additional check, Wget will look at the
1592 @code{Content-Length} header, and compare the sizes; if they are not the
1593 same, the remote file will be downloaded no matter what the time-stamp
1594 says.}
1595
1596 When @samp{--backup-converted} (@samp{-K}) is specified in conjunction
1597 with @samp{-N}, server file @samp{@var{X}} is compared to local file
1598 @samp{@var{X}.orig}, if extant, rather than being compared to local file
1599 @samp{@var{X}}, which will always differ if it's been converted by
1600 @samp{--convert-links} (@samp{-k}).
1601
1602 Arguably, @sc{http} time-stamping should be implemented using the
1603 @code{If-Modified-Since} request.
1604
1605 @node FTP Time-Stamping Internals,  , HTTP Time-Stamping Internals, Time-Stamping
1606 @section FTP Time-Stamping Internals
1607 @cindex ftp time-stamping
1608
1609 In theory, @sc{ftp} time-stamping works much the same as @sc{http}, only
1610 @sc{ftp} has no headers---time-stamps must be received from the
1611 directory listings.
1612
1613 For each directory files must be retrieved from, Wget will use the
1614 @code{LIST} command to get the listing.  It will try to analyze the
1615 listing, assuming that it is a Unix @code{ls -l} listing, and extract
1616 the time-stamps.  The rest is exactly the same as for @sc{http}.
1617
1618 Assumption that every directory listing is a Unix-style listing may
1619 sound extremely constraining, but in practice it is not, as many
1620 non-Unix @sc{ftp} servers use the Unixoid listing format because most
1621 (all?) of the clients understand it.  Bear in mind that @sc{rfc959}
1622 defines no standard way to get a file list, let alone the time-stamps.
1623 We can only hope that a future standard will define this.
1624
1625 Another non-standard solution includes the use of @code{MDTM} command
1626 that is supported by some @sc{ftp} servers (including the popular
1627 @code{wu-ftpd}), which returns the exact time of the specified file.
1628 Wget may support this command in the future.
1629
1630 @node Startup File, Examples, Time-Stamping, Top
1631 @chapter Startup File
1632 @cindex startup file
1633 @cindex wgetrc
1634 @cindex .wgetrc
1635 @cindex startup
1636 @cindex .netrc
1637
1638 Once you know how to change default settings of Wget through command
1639 line arguments, you may wish to make some of those settings permanent.
1640 You can do that in a convenient way by creating the Wget startup
1641 file---@file{.wgetrc}.
1642
1643 Besides @file{.wgetrc} is the ``main'' initialization file, it is
1644 convenient to have a special facility for storing passwords.  Thus Wget
1645 reads and interprets the contents of @file{$HOME/.netrc}, if it finds
1646 it.  You can find @file{.netrc} format in your system manuals.
1647
1648 Wget reads @file{.wgetrc} upon startup, recognizing a limited set of
1649 commands.
1650
1651 @menu
1652 * Wgetrc Location::   Location of various wgetrc files.
1653 * Wgetrc Syntax::     Syntax of wgetrc.
1654 * Wgetrc Commands::   List of available commands.
1655 * Sample Wgetrc::     A wgetrc example.
1656 @end menu
1657
1658 @node Wgetrc Location, Wgetrc Syntax, Startup File, Startup File
1659 @section Wgetrc Location
1660 @cindex wgetrc location
1661 @cindex location of wgetrc
1662
1663 When initializing, Wget will look for a @dfn{global} startup file,
1664 @file{/usr/local/etc/wgetrc} by default (or some prefix other than
1665 @file{/usr/local}, if Wget was not installed there) and read commands
1666 from there, if it exists.
1667
1668 Then it will look for the user's file.  If the environmental variable
1669 @code{WGETRC} is set, Wget will try to load that file.  Failing that, no
1670 further attempts will be made.
1671
1672 If @code{WGETRC} is not set, Wget will try to load @file{$HOME/.wgetrc}.
1673
1674 The fact that user's settings are loaded after the system-wide ones
1675 means that in case of collision user's wgetrc @emph{overrides} the
1676 system-wide wgetrc (in @file{/usr/local/etc/wgetrc} by default).
1677 Fascist admins, away!
1678
1679 @node Wgetrc Syntax, Wgetrc Commands, Wgetrc Location, Startup File
1680 @section Wgetrc Syntax
1681 @cindex wgetrc syntax
1682 @cindex syntax of wgetrc
1683
1684 The syntax of a wgetrc command is simple:
1685
1686 @example
1687 variable = value
1688 @end example
1689
1690 The @dfn{variable} will also be called @dfn{command}.  Valid
1691 @dfn{values} are different for different commands.
1692
1693 The commands are case-insensitive and underscore-insensitive.  Thus
1694 @samp{DIr__PrefiX} is the same as @samp{dirprefix}.  Empty lines, lines
1695 beginning with @samp{#} and lines containing white-space only are
1696 discarded.
1697
1698 Commands that expect a comma-separated list will clear the list on an
1699 empty command.  So, if you wish to reset the rejection list specified in
1700 global @file{wgetrc}, you can do it with:
1701
1702 @example
1703 reject =
1704 @end example
1705
1706 @node Wgetrc Commands, Sample Wgetrc, Wgetrc Syntax, Startup File
1707 @section Wgetrc Commands
1708 @cindex wgetrc commands
1709
1710 The complete set of commands is listed below.  Legal values are listed
1711 after the @samp{=}.  Simple Boolean values can be set or unset using
1712 @samp{on} and @samp{off} or @samp{1} and @samp{0}.  A fancier kind of
1713 Boolean allowed in some cases is the "lockable" Boolean, which may be
1714 set to @samp{on}, @samp{off}, @samp{always}, or @samp{never}.  If an
1715 option is set to @samp{always} or @samp{never}, that value will be
1716 locked in for the duration of the wget invocation -- commandline options
1717 will not override.
1718
1719 Some commands take pseudo-arbitrary values.  @var{address} values can be
1720 hostnames or dotted-quad IP addresses.  @var{n} can be any positive
1721 integer, or @samp{inf} for infinity, where appropriate.  @var{string}
1722 values can be any non-empty string.
1723
1724 Most of these commands have commandline equivalents (@xref{Invoking}),
1725 though some of the more obscure or rarely used ones do not.
1726
1727 @table @asis
1728 @item accept/reject = @var{string}
1729 Same as @samp{-A}/@samp{-R} (@xref{Types of Files}).
1730
1731 @item add_hostdir = on/off
1732 Enable/disable host-prefixed file names.  @samp{-nH} disables it.
1733
1734 @item continue = on/off
1735 Enable/disable continuation of the retrieval -- the same as @samp{-c}
1736 (which enables it).
1737
1738 @item background = on/off
1739 Enable/disable going to background -- the same as @samp{-b} (which enables
1740 it).
1741
1742 @item backup_converted = on/off
1743 Enable/disable saving pre-converted files with the suffix @samp{.orig}
1744 -- the same as @samp{-K} (which enables it).
1745
1746 @c @item backups = @var{number}
1747 @c #### Document me!
1748 @c
1749 @item base = @var{string}
1750 Consider relative @sc{url}s in @sc{url} input files forced to be
1751 interpreted as @sc{html} as being relative to @var{string} -- the same
1752 as @samp{-B}.
1753
1754 @item bind_address = @var{address}
1755 Bind to @var{address}, like the @samp{--bind-address} option.
1756
1757 @item cache = on/off
1758 When set to off, disallow server-caching.  See the @samp{-C} option.
1759
1760 @item convert links = on/off
1761 Convert non-relative links locally.  The same as @samp{-k}.
1762
1763 @item cut_dirs = @var{n}
1764 Ignore @var{n} remote directory components.
1765
1766 @item debug = on/off
1767 Debug mode, same as @samp{-d}.
1768
1769 @item delete_after = on/off
1770 Delete after download -- the same as @samp{--delete-after}.
1771
1772 @item dir_prefix = @var{string}
1773 Top of directory tree -- the same as @samp{-P}.
1774
1775 @item dirstruct = on/off
1776 Turning dirstruct on or off -- the same as @samp{-x} or @samp{-nd},
1777 respectively.
1778
1779 @item domains = @var{string}
1780 Same as @samp{-D} (@xref{Domain Acceptance}).
1781
1782 @item dot_bytes = @var{n}
1783 Specify the number of bytes ``contained'' in a dot, as seen throughout
1784 the retrieval (1024 by default).  You can postfix the value with
1785 @samp{k} or @samp{m}, representing kilobytes and megabytes,
1786 respectively.  With dot settings you can tailor the dot retrieval to
1787 suit your needs, or you can use the predefined @dfn{styles}
1788 (@xref{Download Options}).
1789
1790 @item dots_in_line = @var{n}
1791 Specify the number of dots that will be printed in each line throughout
1792 the retrieval (50 by default).
1793
1794 @item dot_spacing = @var{n}
1795 Specify the number of dots in a single cluster (10 by default).
1796
1797 @item dot_style = @var{string}
1798 Specify the dot retrieval @dfn{style}, as with @samp{--dot-style}.
1799
1800 @item exclude_directories = @var{string}
1801 Specify a comma-separated list of directories you wish to exclude from
1802 download -- the same as @samp{-X} (@xref{Directory-Based Limits}).
1803
1804 @item exclude_domains = @var{string}
1805 Same as @samp{--exclude-domains} (@xref{Domain Acceptance}).
1806
1807 @item follow_ftp = on/off
1808 Follow @sc{ftp} links from @sc{html} documents -- the same as @samp{-f}.
1809
1810 @item follow_tags = @var{string}
1811 Only follow certain HTML tags when doing a recursive retrieval, just like
1812 @samp{--follow-tags}. 
1813
1814 @item force_html = on/off
1815 If set to on, force the input filename to be regarded as an @sc{html}
1816 document -- the same as @samp{-F}.
1817
1818 @item ftp_proxy = @var{string}
1819 Use @var{string} as @sc{ftp} proxy, instead of the one specified in
1820 environment.
1821
1822 @item glob = on/off
1823 Turn globbing on/off -- the same as @samp{-g}.
1824
1825 @item header = @var{string}
1826 Define an additional header, like @samp{--header}.
1827
1828 @item html_extension = on/off
1829 Add a @samp{.html} extension to @samp{text/html} files without it, like
1830 @samp{-E}.
1831
1832 @item http_passwd = @var{string}
1833 Set @sc{http} password.
1834
1835 @item http_proxy = @var{string}
1836 Use @var{string} as @sc{http} proxy, instead of the one specified in
1837 environment.
1838
1839 @item http_user = @var{string}
1840 Set @sc{http} user to @var{string}.
1841
1842 @item ignore_length = on/off
1843 When set to on, ignore @code{Content-Length} header; the same as
1844 @samp{--ignore-length}.
1845
1846 @item ignore_tags = @var{string}
1847 Ignore certain HTML tags when doing a recursive retrieval, just like
1848 @samp{-G} / @samp{--ignore-tags}. 
1849
1850 @item include_directories = @var{string}
1851 Specify a comma-separated list of directories you wish to follow when
1852 downloading -- the same as @samp{-I}.
1853
1854 @item input = @var{string}
1855 Read the @sc{url}s from @var{string}, like @samp{-i}.
1856
1857 @item kill_longer = on/off
1858 Consider data longer than specified in content-length header
1859 as invalid (and retry getting it). The default behaviour is to save
1860 as much data as there is, provided there is more than or equal
1861 to the value in @code{Content-Length}.
1862
1863 @item logfile = @var{string}
1864 Set logfile -- the same as @samp{-o}.
1865
1866 @item login = @var{string}
1867 Your user name on the remote machine, for @sc{ftp}.  Defaults to
1868 @samp{anonymous}.
1869
1870 @item mirror = on/off
1871 Turn mirroring on/off.  The same as @samp{-m}.
1872
1873 @item netrc = on/off
1874 Turn reading netrc on or off.
1875
1876 @item noclobber = on/off
1877 Same as @samp{-nc}.
1878
1879 @item no_parent = on/off
1880 Disallow retrieving outside the directory hierarchy, like
1881 @samp{--no-parent} (@xref{Directory-Based Limits}).
1882
1883 @item no_proxy = @var{string}
1884 Use @var{string} as the comma-separated list of domains to avoid in
1885 proxy loading, instead of the one specified in environment.
1886
1887 @item output_document = @var{string}
1888 Set the output filename -- the same as @samp{-O}.
1889
1890 @item page_requisites = on/off
1891 Download all ancillary documents necessary for a single HTML page to
1892 display properly -- the same as @samp{-p}.
1893
1894 @item passive_ftp = on/off/always/never
1895 Set passive @sc{ftp} -- the same as @samp{--passive-ftp}.  Some scripts
1896 and @samp{.pm} (Perl module) files download files using @samp{wget
1897 --passive-ftp}.  If your firewall does not allow this, you can set
1898 @samp{passive_ftp = never} to override the commandline.
1899
1900 @item passwd = @var{string}
1901 Set your @sc{ftp} password to @var{password}.  Without this setting, the
1902 password defaults to @samp{username@@hostname.domainname}.
1903
1904 @item proxy_user = @var{string}
1905 Set proxy authentication user name to @var{string}, like @samp{--proxy-user}.
1906
1907 @item proxy_passwd = @var{string}
1908 Set proxy authentication password to @var{string}, like @samp{--proxy-passwd}.
1909
1910 @item referer = @var{string}
1911 Set HTTP @samp{Referer:} header just like @samp{--referer}.  (Note it
1912 was the folks who wrote the @sc{http} spec who got the spelling of
1913 "referrer" wrong.)
1914
1915 @item quiet = on/off
1916 Quiet mode -- the same as @samp{-q}.
1917
1918 @item quota = @var{quota}
1919 Specify the download quota, which is useful to put in the global
1920 @file{wgetrc}. When download quota is specified, Wget will stop retrieving
1921 after the download sum has become greater than quota.  The quota can be
1922 specified in bytes (default), kbytes @samp{k} appended) or mbytes
1923 (@samp{m} appended).  Thus @samp{quota = 5m} will set the quota to 5
1924 mbytes. Note that the user's startup file overrides system settings.
1925
1926 @item reclevel = @var{n}
1927 Recursion level -- the same as @samp{-l}.
1928
1929 @item recursive = on/off
1930 Recursive on/off -- the same as @samp{-r}.
1931
1932 @item relative_only = on/off
1933 Follow only relative links -- the same as @samp{-L} (@xref{Relative
1934 Links}).
1935
1936 @item remove_listing = on/off
1937 If set to on, remove @sc{ftp} listings downloaded by Wget.  Setting it
1938 to off is the same as @samp{-nr}.
1939
1940 @item retr_symlinks = on/off
1941 When set to on, retrieve symbolic links as if they were plain files; the
1942 same as @samp{--retr-symlinks}.
1943
1944 @item robots = on/off
1945 Use (or not) @file{/robots.txt} file (@xref{Robots}).  Be sure to know
1946 what you are doing before changing the default (which is @samp{on}).
1947
1948 @item server_response = on/off
1949 Choose whether or not to print the @sc{http} and @sc{ftp} server
1950 responses -- the same as @samp{-S}.
1951
1952 @item simple_host_check = on/off
1953 Same as @samp{-nh} (@xref{Host Checking}).
1954
1955 @item span_hosts = on/off
1956 Same as @samp{-H}.
1957
1958 @item timeout = @var{n}
1959 Set timeout value -- the same as @samp{-T}.
1960
1961 @item timestamping = on/off
1962 Turn timestamping on/off. The same as @samp{-N} (@xref{Time-Stamping}).
1963
1964 @item tries = @var{n}
1965 Set number of retries per @sc{url} -- the same as @samp{-t}.
1966
1967 @item use_proxy = on/off
1968 Turn proxy support on/off. The same as @samp{-Y}.
1969
1970 @item verbose = on/off
1971 Turn verbose on/off -- the same as @samp{-v}/@samp{-nv}.
1972
1973 @item wait = @var{n}
1974 Wait @var{n} seconds between retrievals -- the same as @samp{-w}.
1975
1976 @item waitretry = @var{n}
1977 Wait up to @var{n} seconds between retries of failed retrievals only --
1978 the same as @samp{--waitretry}.  Note that this is turned on by default
1979 in the global @file{wgetrc}.
1980 @end table
1981
1982 @node Sample Wgetrc,  , Wgetrc Commands, Startup File
1983 @section Sample Wgetrc
1984 @cindex sample wgetrc
1985
1986 This is the sample initialization file, as given in the distribution.
1987 It is divided in two section---one for global usage (suitable for global
1988 startup file), and one for local usage (suitable for
1989 @file{$HOME/.wgetrc}).  Be careful about the things you change.
1990
1991 Note that almost all the lines are commented out.  For a command to have
1992 any effect, you must remove the @samp{#} character at the beginning of
1993 its line.
1994
1995 @example
1996 @include sample.wgetrc.munged_for_texi_inclusion
1997 @end example
1998
1999 @node Examples, Various, Startup File, Top
2000 @chapter Examples
2001 @cindex examples
2002
2003 The examples are classified into three sections, because of clarity.
2004 The first section is a tutorial for beginners.  The second section
2005 explains some of the more complex program features.  The third section
2006 contains advice for mirror administrators, as well as even more complex
2007 features (that some would call perverted).
2008
2009 @menu
2010 * Simple Usage::        Simple, basic usage of the program.
2011 * Advanced Usage::      Advanced techniques of usage.
2012 * Guru Usage::          Mirroring and the hairy stuff.
2013 @end menu
2014
2015 @node Simple Usage, Advanced Usage, Examples, Examples
2016 @section Simple Usage
2017
2018 @itemize @bullet
2019 @item
2020 Say you want to download a @sc{url}.  Just type:
2021
2022 @example
2023 wget http://fly.cc.fer.hr/
2024 @end example
2025
2026 The response will be something like:
2027
2028 @example
2029 @group
2030 --13:30:45--  http://fly.cc.fer.hr:80/en/
2031            => `index.html'
2032 Connecting to fly.cc.fer.hr:80... connected!
2033 HTTP request sent, awaiting response... 200 OK
2034 Length: 4,694 [text/html]
2035
2036     0K -> ....                                                   [100%]
2037
2038 13:30:46 (23.75 KB/s) - `index.html' saved [4694/4694]
2039 @end group
2040 @end example
2041
2042 @item
2043 But what will happen if the connection is slow, and the file is lengthy?
2044 The connection will probably fail before the whole file is retrieved,
2045 more than once.  In this case, Wget will try getting the file until it
2046 either gets the whole of it, or exceeds the default number of retries
2047 (this being 20).  It is easy to change the number of tries to 45, to
2048 insure that the whole file will arrive safely:
2049
2050 @example
2051 wget --tries=45 http://fly.cc.fer.hr/jpg/flyweb.jpg
2052 @end example
2053
2054 @item
2055 Now let's leave Wget to work in the background, and write its progress
2056 to log file @file{log}.  It is tiring to type @samp{--tries}, so we
2057 shall use @samp{-t}.
2058
2059 @example
2060 wget -t 45 -o log http://fly.cc.fer.hr/jpg/flyweb.jpg &
2061 @end example
2062
2063 The ampersand at the end of the line makes sure that Wget works in the
2064 background.  To unlimit the number of retries, use @samp{-t inf}.
2065
2066 @item
2067 The usage of @sc{ftp} is as simple.  Wget will take care of login and
2068 password.
2069
2070 @example
2071 @group
2072 $ wget ftp://gnjilux.cc.fer.hr/welcome.msg
2073 --10:08:47--  ftp://gnjilux.cc.fer.hr:21/welcome.msg
2074            => `welcome.msg'
2075 Connecting to gnjilux.cc.fer.hr:21... connected!
2076 Logging in as anonymous ... Logged in!
2077 ==> TYPE I ... done.  ==> CWD not needed.
2078 ==> PORT ... done.    ==> RETR welcome.msg ... done.
2079 Length: 1,340 (unauthoritative)
2080
2081     0K -> .                                                      [100%]
2082
2083 10:08:48 (1.28 MB/s) - `welcome.msg' saved [1340]
2084 @end group
2085 @end example
2086
2087 @item
2088 If you specify a directory, Wget will retrieve the directory listing,
2089 parse it and convert it to @sc{html}.  Try:
2090
2091 @example
2092 wget ftp://prep.ai.mit.edu/pub/gnu/
2093 lynx index.html
2094 @end example
2095 @end itemize
2096
2097 @node Advanced Usage, Guru Usage, Simple Usage, Examples
2098 @section Advanced Usage
2099
2100 @itemize @bullet
2101 @item
2102 You would like to read the list of @sc{url}s from a file?  Not a problem
2103 with that:
2104
2105 @example
2106 wget -i file
2107 @end example
2108
2109 If you specify @samp{-} as file name, the @sc{url}s will be read from
2110 standard input.
2111
2112 @item
2113 Create a mirror image of GNU @sc{www} site (with the same directory structure
2114 the original has) with only one try per document, saving the log of the
2115 activities to @file{gnulog}:
2116
2117 @example
2118 wget -r -t1 http://www.gnu.ai.mit.edu/ -o gnulog
2119 @end example
2120
2121 @item
2122 Retrieve the first layer of yahoo links:
2123
2124 @example
2125 wget -r -l1 http://www.yahoo.com/
2126 @end example
2127
2128 @item
2129 Retrieve the index.html of @samp{www.lycos.com}, showing the original
2130 server headers:
2131
2132 @example
2133 wget -S http://www.lycos.com/
2134 @end example
2135
2136 @item
2137 Save the server headers with the file:
2138 @example
2139 wget -s http://www.lycos.com/
2140 more index.html
2141 @end example
2142
2143 @item
2144 Retrieve the first two levels of @samp{wuarchive.wustl.edu}, saving them
2145 to /tmp.
2146
2147 @example
2148 wget -P/tmp -l2 ftp://wuarchive.wustl.edu/
2149 @end example
2150
2151 @item
2152 You want to download all the @sc{gif}s from an @sc{http} directory.
2153 @samp{wget http://host/dir/*.gif} doesn't work, since @sc{http}
2154 retrieval does not support globbing.  In that case, use:
2155
2156 @example
2157 wget -r -l1 --no-parent -A.gif http://host/dir/
2158 @end example
2159
2160 It is a bit of a kludge, but it works.  @samp{-r -l1} means to retrieve
2161 recursively (@xref{Recursive Retrieval}), with maximum depth of 1.
2162 @samp{--no-parent} means that references to the parent directory are
2163 ignored (@xref{Directory-Based Limits}), and @samp{-A.gif} means to
2164 download only the @sc{gif} files.  @samp{-A "*.gif"} would have worked
2165 too.
2166
2167 @item
2168 Suppose you were in the middle of downloading, when Wget was
2169 interrupted.  Now you do not want to clobber the files already present.
2170 It would be:
2171
2172 @example
2173 wget -nc -r http://www.gnu.ai.mit.edu/
2174 @end example
2175
2176 @item
2177 If you want to encode your own username and password to @sc{http} or
2178 @sc{ftp}, use the appropriate @sc{url} syntax (@xref{URL Format}).
2179
2180 @example
2181 wget ftp://hniksic:mypassword@@jagor.srce.hr/.emacs
2182 @end example
2183
2184 @item
2185 If you do not like the default retrieval visualization (1K dots with 10
2186 dots per cluster and 50 dots per line), you can customize it through dot
2187 settings (@xref{Wgetrc Commands}).  For example, many people like the
2188 ``binary'' style of retrieval, with 8K dots and 512K lines:
2189
2190 @example
2191 wget --dot-style=binary ftp://prep.ai.mit.edu/pub/gnu/README
2192 @end example
2193
2194 You can experiment with other styles, like:
2195
2196 @example
2197 wget --dot-style=mega ftp://ftp.xemacs.org/pub/xemacs/xemacs-20.4/xemacs-20.4.tar.gz
2198 wget --dot-style=micro http://fly.cc.fer.hr/
2199 @end example
2200
2201 To make these settings permanent, put them in your @file{.wgetrc}, as
2202 described before (@xref{Sample Wgetrc}).
2203 @end itemize
2204
2205 @node Guru Usage,  , Advanced Usage, Examples
2206 @section Guru Usage
2207
2208 @cindex mirroring
2209 @itemize @bullet
2210 @item
2211 If you wish Wget to keep a mirror of a page (or @sc{ftp}
2212 subdirectories), use @samp{--mirror} (@samp{-m}), which is the shorthand
2213 for @samp{-r -N}.  You can put Wget in the crontab file asking it to
2214 recheck a site each Sunday:
2215
2216 @example
2217 crontab
2218 0 0 * * 0 wget --mirror ftp://ftp.xemacs.org/pub/xemacs/ -o /home/me/weeklog
2219 @end example
2220
2221 @item
2222 You may wish to do the same with someone's home page.  But you do not
2223 want to download all those images---you're only interested in @sc{html}.
2224
2225 @example
2226 wget --mirror -A.html http://www.w3.org/
2227 @end example
2228
2229 @item
2230 But what about mirroring the hosts networkologically close to you?  It
2231 seems so awfully slow because of all that @sc{dns} resolving.  Just use
2232 @samp{-D} (@xref{Domain Acceptance}).
2233
2234 @example
2235 wget -rN -Dsrce.hr http://www.srce.hr/
2236 @end example
2237
2238 Now Wget will correctly find out that @samp{regoc.srce.hr} is the same
2239 as @samp{www.srce.hr}, but will not even take into consideration the
2240 link to @samp{www.mit.edu}.
2241
2242 @item
2243 You have a presentation and would like the dumb absolute links to be
2244 converted to relative?  Use @samp{-k}:
2245
2246 @example
2247 wget -k -r @var{URL}
2248 @end example
2249
2250 @cindex redirecting output
2251 @item
2252 You would like the output documents to go to standard output instead of
2253 to files?  OK, but Wget will automatically shut up (turn on
2254 @samp{--quiet}) to prevent mixing of Wget output and the retrieved
2255 documents.
2256
2257 @example
2258 wget -O - http://jagor.srce.hr/ http://www.srce.hr/
2259 @end example
2260
2261 You can also combine the two options and make weird pipelines to
2262 retrieve the documents from remote hotlists:
2263
2264 @example
2265 wget -O - http://cool.list.com/ | wget --force-html -i -
2266 @end example
2267 @end itemize
2268
2269 @node Various, Appendices, Examples, Top
2270 @chapter Various
2271 @cindex various
2272
2273 This chapter contains all the stuff that could not fit anywhere else.
2274
2275 @menu
2276 * Proxies::             Support for proxy servers
2277 * Distribution::        Getting the latest version.
2278 * Mailing List::        Wget mailing list for announcements and discussion.
2279 * Reporting Bugs::      How and where to report bugs.
2280 * Portability::         The systems Wget works on.
2281 * Signals::             Signal-handling performed by Wget.
2282 @end menu
2283
2284 @node Proxies, Distribution, Various, Various
2285 @section Proxies
2286 @cindex proxies
2287
2288 @dfn{Proxies} are special-purpose @sc{http} servers designed to transfer
2289 data from remote servers to local clients.  One typical use of proxies
2290 is lightening network load for users behind a slow connection.  This is
2291 achieved by channeling all @sc{http} and @sc{ftp} requests through the
2292 proxy which caches the transferred data.  When a cached resource is
2293 requested again, proxy will return the data from cache.  Another use for
2294 proxies is for companies that separate (for security reasons) their
2295 internal networks from the rest of Internet.  In order to obtain
2296 information from the Web, their users connect and retrieve remote data
2297 using an authorized proxy.
2298
2299 Wget supports proxies for both @sc{http} and @sc{ftp} retrievals.  The
2300 standard way to specify proxy location, which Wget recognizes, is using
2301 the following environment variables:
2302
2303 @table @code
2304 @item http_proxy
2305 This variable should contain the @sc{url} of the proxy for @sc{http}
2306 connections.
2307
2308 @item ftp_proxy
2309 This variable should contain the @sc{url} of the proxy for @sc{http}
2310 connections.  It is quite common that @sc{http_proxy} and @sc{ftp_proxy}
2311 are set to the same @sc{url}.
2312
2313 @item no_proxy
2314 This variable should contain a comma-separated list of domain extensions
2315 proxy should @emph{not} be used for.  For instance, if the value of
2316 @code{no_proxy} is @samp{.mit.edu}, proxy will not be used to retrieve
2317 documents from MIT.
2318 @end table
2319
2320 In addition to the environment variables, proxy location and settings
2321 may be specified from within Wget itself.
2322
2323 @table @samp
2324 @item -Y on/off
2325 @itemx --proxy=on/off
2326 @itemx proxy = on/off
2327 This option may be used to turn the proxy support on or off.  Proxy
2328 support is on by default, provided that the appropriate environment
2329 variables are set.
2330
2331 @item http_proxy = @var{URL}
2332 @itemx ftp_proxy = @var{URL}
2333 @itemx no_proxy = @var{string}
2334 These startup file variables allow you to override the proxy settings
2335 specified by the environment.
2336 @end table
2337
2338 Some proxy servers require authorization to enable you to use them.  The
2339 authorization consists of @dfn{username} and @dfn{password}, which must
2340 be sent by Wget.  As with @sc{http} authorization, several
2341 authentication schemes exist.  For proxy authorization only the
2342 @code{Basic} authentication scheme is currently implemented.
2343
2344 You may specify your username and password either through the proxy
2345 @sc{url} or through the command-line options.  Assuming that the
2346 company's proxy is located at @samp{proxy.srce.hr} at port 8001, a proxy
2347 @sc{url} location containing authorization data might look like this:
2348
2349 @example
2350 http://hniksic:mypassword@@proxy.company.com:8001/
2351 @end example
2352
2353 Alternatively, you may use the @samp{proxy-user} and
2354 @samp{proxy-password} options, and the equivalent @file{.wgetrc}
2355 settings @code{proxy_user} and @code{proxy_passwd} to set the proxy
2356 username and password.
2357
2358 @node Distribution, Mailing List, Proxies, Various
2359 @section Distribution
2360 @cindex latest version
2361
2362 Like all GNU utilities, the latest version of Wget can be found at the
2363 master GNU archive site prep.ai.mit.edu, and its mirrors.  For example,
2364 Wget @value{VERSION} can be found at
2365 @url{ftp://prep.ai.mit.edu/gnu/wget/wget-@value{VERSION}.tar.gz}
2366
2367 @node Mailing List, Reporting Bugs, Distribution, Various
2368 @section Mailing List
2369 @cindex mailing list
2370 @cindex list
2371
2372 Wget has its own mailing list at @email{wget@@sunsite.auc.dk}, thanks
2373 to Karsten Thygesen.  The mailing list is for discussion of Wget
2374 features and web, reporting Wget bugs (those that you think may be of
2375 interest to the public) and mailing announcements.  You are welcome to
2376 subscribe.  The more people on the list, the better!
2377
2378 To subscribe, send mail to @email{wget-subscribe@@sunsite.auc.dk}.
2379 the magic word @samp{subscribe} in the subject line.  Unsubscribe by
2380 mailing to @email{wget-unsubscribe@@sunsite.auc.dk}.
2381
2382 The mailing list is archived at @url{http://fly.cc.fer.hr/archive/wget}.
2383
2384 @node Reporting Bugs, Portability, Mailing List, Various
2385 @section Reporting Bugs
2386 @cindex bugs
2387 @cindex reporting bugs
2388 @cindex bug reports
2389
2390 You are welcome to send bug reports about GNU Wget to
2391 @email{bug-wget@@gnu.org}.  The bugs that you think are of the
2392 interest to the public (i.e. more people should be informed about them)
2393 can be Cc-ed to the mailing list at @email{wget@@sunsite.auc.dk}.
2394
2395 Before actually submitting a bug report, please try to follow a few
2396 simple guidelines.
2397
2398 @enumerate
2399 @item
2400 Please try to ascertain that the behaviour you see really is a bug.  If
2401 Wget crashes, it's a bug.  If Wget does not behave as documented,
2402 it's a bug.  If things work strange, but you are not sure about the way
2403 they are supposed to work, it might well be a bug.
2404
2405 @item
2406 Try to repeat the bug in as simple circumstances as possible.  E.g. if
2407 Wget crashes on @samp{wget -rLl0 -t5 -Y0 http://yoyodyne.com -o
2408 /tmp/log}, you should try to see if it will crash with a simpler set of
2409 options.
2410
2411 Also, while I will probably be interested to know the contents of your
2412 @file{.wgetrc} file, just dumping it into the debug message is probably
2413 a bad idea.  Instead, you should first try to see if the bug repeats
2414 with @file{.wgetrc} moved out of the way.  Only if it turns out that
2415 @file{.wgetrc} settings affect the bug, should you mail me the relevant
2416 parts of the file.
2417
2418 @item
2419 Please start Wget with @samp{-d} option and send the log (or the
2420 relevant parts of it).  If Wget was compiled without debug support,
2421 recompile it.  It is @emph{much} easier to trace bugs with debug support
2422 on.
2423
2424 @item
2425 If Wget has crashed, try to run it in a debugger, e.g. @code{gdb `which
2426 wget` core} and type @code{where} to get the backtrace.
2427
2428 @item
2429 Find where the bug is, fix it and send me the patches. :-)
2430 @end enumerate
2431
2432 @node Portability, Signals, Reporting Bugs, Various
2433 @section Portability
2434 @cindex portability
2435 @cindex operating systems
2436
2437 Since Wget uses GNU Autoconf for building and configuring, and avoids
2438 using ``special'' ultra--mega--cool features of any particular Unix, it
2439 should compile (and work) on all common Unix flavors.
2440
2441 Various Wget versions have been compiled and tested under many kinds of
2442 Unix systems, including Solaris, Linux, SunOS, OSF (aka Digital Unix),
2443 Ultrix, *BSD, IRIX, and others; refer to the file @file{MACHINES} in the
2444 distribution directory for a comprehensive list.  If you compile it on
2445 an architecture not listed there, please let me know so I can update it.
2446
2447 Wget should also compile on the other Unix systems, not listed in
2448 @file{MACHINES}.  If it doesn't, please let me know.
2449
2450 Thanks to kind contributors, this version of Wget compiles and works on
2451 Microsoft Windows 95 and Windows NT platforms.  It has been compiled
2452 successfully using MS Visual C++ 4.0, Watcom, and Borland C compilers,
2453 with Winsock as networking software.  Naturally, it is crippled of some
2454 features available on Unix, but it should work as a substitute for
2455 people stuck with Windows.  Note that the Windows port is
2456 @strong{neither tested nor maintained} by me---all questions and
2457 problems should be reported to Wget mailing list at
2458 @email{wget@@sunsite.auc.dk} where the maintainers will look at them.
2459
2460 @node Signals,  , Portability, Various
2461 @section Signals
2462 @cindex signal handling
2463 @cindex hangup
2464
2465 Since the purpose of Wget is background work, it catches the hangup
2466 signal (@code{SIGHUP}) and ignores it.  If the output was on standard
2467 output, it will be redirected to a file named @file{wget-log}.
2468 Otherwise, @code{SIGHUP} is ignored.  This is convenient when you wish
2469 to redirect the output of Wget after having started it.
2470
2471 @example
2472 $ wget http://www.ifi.uio.no/~larsi/gnus.tar.gz &
2473 $ kill -HUP %%     # Redirect the output to wget-log
2474 @end example
2475
2476 Other than that, Wget will not try to interfere with signals in any
2477 way. @kbd{C-c}, @code{kill -TERM} and @code{kill -KILL} should kill it
2478 alike.
2479
2480 @node Appendices, Copying, Various, Top
2481 @chapter Appendices
2482
2483 This chapter contains some references I consider useful, like the Robots
2484 Exclusion Standard specification, as well as a list of contributors to
2485 GNU Wget.
2486
2487 @menu
2488 * Robots::                  Wget as a WWW robot.
2489 * Security Considerations:: Security with Wget.
2490 * Contributors::            People who helped.
2491 @end menu
2492
2493 @node Robots, Security Considerations, Appendices, Appendices
2494 @section Robots
2495 @cindex robots
2496 @cindex robots.txt
2497 @cindex server maintenance
2498
2499 Since Wget is able to traverse the web, it counts as one of the Web
2500 @dfn{robots}.  Thus Wget understands @dfn{Robots Exclusion Standard}
2501 (@sc{res})---contents of @file{/robots.txt}, used by server
2502 administrators to shield parts of their systems from wanderings of Wget.
2503
2504 Norobots support is turned on only when retrieving recursively, and
2505 @emph{never} for the first page.  Thus, you may issue:
2506
2507 @example
2508 wget -r http://fly.cc.fer.hr/
2509 @end example
2510
2511 First the index of fly.cc.fer.hr will be downloaded.  If Wget finds
2512 anything worth downloading on the same host, only @emph{then} will it
2513 load the robots, and decide whether or not to load the links after all.
2514 @file{/robots.txt} is loaded only once per host.  Wget does not support
2515 the robots @code{META} tag.
2516
2517 The description of the norobots standard was written, and is maintained
2518 by Martijn Koster @email{m.koster@@webcrawler.com}.  With his
2519 permission, I contribute a (slightly modified) TeXified version of the
2520 @sc{res}.
2521
2522 @menu
2523 * Introduction to RES::
2524 * RES Format::
2525 * User-Agent Field::
2526 * Disallow Field::
2527 * Norobots Examples::
2528 @end menu
2529
2530 @node Introduction to RES, RES Format, Robots, Robots
2531 @subsection Introduction to RES
2532 @cindex norobots introduction
2533
2534 @dfn{WWW Robots} (also called @dfn{wanderers} or @dfn{spiders}) are
2535 programs that traverse many pages in the World Wide Web by recursively
2536 retrieving linked pages. For more information see the robots page.
2537
2538 In 1993 and 1994 there have been occasions where robots have visited
2539 @sc{www} servers where they weren't welcome for various
2540 reasons. Sometimes these reasons were robot specific, e.g. certain
2541 robots swamped servers with rapid-fire requests, or retrieved the same
2542 files repeatedly. In other situations robots traversed parts of @sc{www}
2543 servers that weren't suitable, e.g. very deep virtual trees, duplicated
2544 information, temporary information, or cgi-scripts with side-effects
2545 (such as voting).
2546
2547 These incidents indicated the need for established mechanisms for
2548 @sc{www} servers to indicate to robots which parts of their server
2549 should not be accessed. This standard addresses this need with an
2550 operational solution.
2551
2552 This document represents a consensus on 30 June 1994 on the robots
2553 mailing list (@code{robots@@webcrawler.com}), between the majority of
2554 robot authors and other people with an interest in robots. It has also
2555 been open for discussion on the Technical World Wide Web mailing list
2556 (@code{www-talk@@info.cern.ch}). This document is based on a previous
2557 working draft under the same title.
2558
2559 It is not an official standard backed by a standards body, or owned by
2560 any commercial organization. It is not enforced by anybody, and there
2561 no guarantee that all current and future robots will use it. Consider
2562 it a common facility the majority of robot authors offer the @sc{www}
2563 community to protect @sc{www} server against unwanted accesses by their
2564 robots.
2565
2566 The latest version of this document can be found at
2567 @url{http://info.webcrawler.com/mak/projects/robots/norobots.html}.
2568
2569 @node RES Format, User-Agent Field, Introduction to RES, Robots
2570 @subsection RES Format
2571 @cindex norobots format
2572
2573 The format and semantics of the @file{/robots.txt} file are as follows:
2574
2575 The file consists of one or more records separated by one or more blank
2576 lines (terminated by @code{CR}, @code{CR/NL}, or @code{NL}).  Each
2577 record contains lines of the form:
2578
2579 @example
2580 <field>:<optionalspace><value><optionalspace>
2581 @end example
2582
2583 The field name is case insensitive.
2584
2585 Comments can be included in file using UNIX Bourne shell conventions:
2586 the @samp{#} character is used to indicate that preceding space (if any)
2587 and the remainder of the line up to the line termination is discarded.
2588 Lines containing only a comment are discarded completely, and therefore
2589 do not indicate a record boundary.
2590
2591 The record starts with one or more User-agent lines, followed by one or
2592 more Disallow lines, as detailed below. Unrecognized headers are
2593 ignored.
2594
2595 The presence of an empty @file{/robots.txt} file has no explicit
2596 associated semantics, it will be treated as if it was not present,
2597 i.e. all robots will consider themselves welcome.
2598
2599 @node User-Agent Field, Disallow Field, RES Format, Robots
2600 @subsection User-Agent Field
2601 @cindex norobots user-agent
2602
2603 The value of this field is the name of the robot the record is
2604 describing access policy for.
2605
2606 If more than one User-agent field is present the record describes an
2607 identical access policy for more than one robot.  At least one field
2608 needs to be present per record.
2609
2610 The robot should be liberal in interpreting this field. A case
2611 insensitive substring match of the name without version information is
2612 recommended.
2613
2614 If the value is @samp{*}, the record describes the default access policy
2615 for any robot that has not matched any of the other records. It is not
2616 allowed to have multiple such records in the @file{/robots.txt} file.
2617
2618 @node Disallow Field, Norobots Examples, User-Agent Field, Robots
2619 @subsection Disallow Field
2620 @cindex norobots disallow
2621
2622 The value of this field specifies a partial @sc{url} that is not to be
2623 visited. This can be a full path, or a partial path; any @sc{url} that
2624 starts with this value will not be retrieved. For example,
2625 @w{@samp{Disallow: /help}} disallows both @samp{/help.html} and
2626 @samp{/help/index.html}, whereas @w{@samp{Disallow: /help/}} would
2627 disallow @samp{/help/index.html} but allow @samp{/help.html}.
2628
2629 Any empty value, indicates that all @sc{url}s can be retrieved. At least
2630 one Disallow field needs to be present in a record.
2631
2632 @node Norobots Examples,  , Disallow Field, Robots
2633 @subsection Norobots Examples
2634 @cindex norobots examples
2635
2636 The following example @samp{/robots.txt} file specifies that no robots
2637 should visit any @sc{url} starting with @samp{/cyberworld/map/} or
2638 @samp{/tmp/}:
2639
2640 @example
2641 # robots.txt for http://www.site.com/
2642
2643 User-agent: *
2644 Disallow: /cyberworld/map/ # This is an infinite virtual URL space
2645 Disallow: /tmp/ # these will soon disappear
2646 @end example
2647
2648 This example @samp{/robots.txt} file specifies that no robots should
2649 visit any @sc{url} starting with @samp{/cyberworld/map/}, except the
2650 robot called @samp{cybermapper}:
2651
2652 @example
2653 # robots.txt for http://www.site.com/
2654
2655 User-agent: *
2656 Disallow: /cyberworld/map/ # This is an infinite virtual URL space
2657
2658 # Cybermapper knows where to go.
2659 User-agent: cybermapper
2660 Disallow:
2661 @end example
2662
2663 This example indicates that no robots should visit this site further:
2664
2665 @example
2666 # go away
2667 User-agent: *
2668 Disallow: /
2669 @end example
2670
2671 @node Security Considerations, Contributors, Robots, Appendices
2672 @section Security Considerations
2673 @cindex security
2674
2675 When using Wget, you must be aware that it sends unencrypted passwords
2676 through the network, which may present a security problem.  Here are the
2677 main issues, and some solutions.
2678
2679 @enumerate
2680 @item
2681 The passwords on the command line are visible using @code{ps}.  If this
2682 is a problem, avoid putting passwords from the command line---e.g. you
2683 can use @file{.netrc} for this.
2684
2685 @item
2686 Using the insecure @dfn{basic} authentication scheme, unencrypted
2687 passwords are transmitted through the network routers and gateways.
2688
2689 @item
2690 The @sc{ftp} passwords are also in no way encrypted.  There is no good
2691 solution for this at the moment.
2692
2693 @item
2694 Although the ``normal'' output of Wget tries to hide the passwords,
2695 debugging logs show them, in all forms.  This problem is avoided by
2696 being careful when you send debug logs (yes, even when you send them to
2697 me).
2698 @end enumerate
2699
2700 @node Contributors,  , Security Considerations, Appendices
2701 @section Contributors
2702 @cindex contributors
2703
2704 @iftex
2705 GNU Wget was written by Hrvoje Nik@v{s}i@'{c} @email{hniksic@@arsdigita.com}.
2706 @end iftex
2707 @ifinfo
2708 GNU Wget was written by Hrvoje Niksic @email{hniksic@@arsdigita.com}.
2709 @end ifinfo
2710 However, its development could never have gone as far as it has, were it
2711 not for the help of many people, either with bug reports, feature
2712 proposals, patches, or letters saying ``Thanks!''.
2713
2714 Special thanks goes to the following people (no particular order):
2715
2716 @itemize @bullet
2717 @item
2718 Karsten Thygesen---donated the mailing list and the initial @sc{ftp}
2719 space.
2720
2721 @item
2722 Shawn McHorse---bug reports and patches.
2723
2724 @item
2725 Kaveh R. Ghazi---on-the-fly @code{ansi2knr}-ization.
2726
2727 @item
2728 Gordon Matzigkeit---@file{.netrc} support.
2729
2730 @item
2731 @iftex
2732 Zlatko @v{C}alu@v{s}i@'{c}, Tomislav Vujec and Dra@v{z}en
2733 Ka@v{c}ar---feature suggestions and ``philosophical'' discussions.
2734 @end iftex
2735 @ifinfo
2736 Zlatko Calusic, Tomislav Vujec and Drazen Kacar---feature suggestions
2737 and ``philosophical'' discussions.
2738 @end ifinfo
2739
2740 @item
2741 Darko Budor---initial port to Windows.
2742
2743 @item
2744 Antonio Rosella---help and suggestions, plus the Italian translation.
2745
2746 @item
2747 @iftex
2748 Tomislav Petrovi@'{c}, Mario Miko@v{c}evi@'{c}---many bug reports and
2749 suggestions.
2750 @end iftex
2751 @ifinfo
2752 Tomislav Petrovic, Mario Mikocevic---many bug reports and suggestions.
2753 @end ifinfo
2754
2755 @item
2756 @iftex
2757 Fran@,{c}ois Pinard---many thorough bug reports and discussions.
2758 @end iftex
2759 @ifinfo
2760 Francois Pinard---many thorough bug reports and discussions.
2761 @end ifinfo
2762
2763 @item
2764 Karl Eichwalder---lots of help with internationalization and other
2765 things.
2766
2767 @item
2768 Junio Hamano---donated support for Opie and @sc{http} @code{Digest}
2769 authentication.
2770
2771 @item
2772 Brian Gough---a generous donation.
2773 @end itemize
2774
2775 The following people have provided patches, bug/build reports, useful
2776 suggestions, beta testing services, fan mail and all the other things
2777 that make maintenance so much fun:
2778
2779 Tim Adam,
2780 Martin Baehr,
2781 Dieter Baron,
2782 Roger Beeman and the Gurus at Cisco,
2783 Dan Berger,
2784 Mark Boyns,
2785 John Burden,
2786 Wanderlei Cavassin,
2787 Gilles Cedoc,
2788 Tim Charron,
2789 Noel Cragg,
2790 @iftex
2791 Kristijan @v{C}onka@v{s},
2792 @end iftex
2793 @ifinfo
2794 Kristijan Conkas,
2795 @end ifinfo
2796 Andrew Deryabin,
2797 @iftex
2798 Damir D@v{z}eko,
2799 @end iftex
2800 @ifinfo
2801 Damir Dzeko,
2802 @end ifinfo
2803 Andrew Davison,
2804 Ulrich Drepper,
2805 Marc Duponcheel,
2806 @iftex
2807 Aleksandar Erkalovi@'{c},
2808 @end iftex
2809 @ifinfo
2810 Aleksandar Erkalovic,
2811 @end ifinfo
2812 Andy Eskilsson,
2813 Masashi Fujita,
2814 Howard Gayle,
2815 Marcel Gerrits,
2816 Hans Grobler,
2817 Mathieu Guillaume,
2818 Dan Harkless,
2819 Heiko Herold,
2820 Karl Heuer,
2821 HIROSE Masaaki,
2822 Gregor Hoffleit,
2823 Erik Magnus Hulthen,
2824 Richard Huveneers,
2825 Simon Josefsson,
2826 @iftex
2827 Mario Juri@'{c},
2828 @end iftex
2829 @ifinfo
2830 Mario Juric,
2831 @end ifinfo
2832 @iftex
2833 Goran Kezunovi@'{c},
2834 @end iftex
2835 @ifinfo
2836 Goran Kezunovic,
2837 @end ifinfo
2838 Robert Kleine,
2839 Fila Kolodny,
2840 Alexander Kourakos,
2841 Martin Kraemer,
2842 @tex
2843 $\Sigma\acute{\iota}\mu o\varsigma\;
2844 \Xi\varepsilon\nu\iota\tau\acute{\epsilon}\lambda\lambda\eta\varsigma$
2845 (Simos KSenitellis),
2846 @end tex
2847 @ifinfo
2848 Simos KSenitellis,
2849 @end ifinfo
2850 Hrvoje Lacko,
2851 Daniel S. Lewart,
2852 Dave Love,
2853 Jordan Mendelson,
2854 Lin Zhe Min,
2855 Charlie Negyesi,
2856 Andrew Pollock,
2857 Steve Pothier,
2858 Jan Prikryl,
2859 Marin Purgar,
2860 Keith Refson,
2861 Tobias Ringstrom,
2862 @c Texinfo doesn't grok @'{@i}, so we have to use TeX itself.
2863 @tex
2864 Juan Jos\'{e} Rodr\'{\i}gues,
2865 @end tex
2866 @ifinfo
2867 Juan Jose Rodrigues,
2868 @end ifinfo
2869 Edward J. Sabol,
2870 Heinz Salzmann,
2871 Robert Schmidt,
2872 Toomas Soome,
2873 Tage Stabell-Kulo,
2874 Sven Sternberger,
2875 Markus Strasser,
2876 Szakacsits Szabolcs,
2877 Mike Thomas,
2878 Russell Vincent,
2879 Charles G Waldman,
2880 Douglas E. Wegscheid,
2881 Jasmin Zainul,
2882 @iftex
2883 Bojan @v{Z}drnja,
2884 @end iftex
2885 @ifinfo
2886 Bojan Zdrnja,
2887 @end ifinfo
2888 Kristijan Zimmer.
2889
2890 Apologies to all who I accidentally left out, and many thanks to all the
2891 subscribers of the Wget mailing list.
2892
2893 @node Copying, Concept Index, Appendices, Top
2894 @unnumbered GNU GENERAL PUBLIC LICENSE
2895 @cindex copying
2896 @cindex GPL
2897 @center Version 2, June 1991
2898
2899 @display
2900 Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
2901 675 Mass Ave, Cambridge, MA 02139, USA
2902
2903 Everyone is permitted to copy and distribute verbatim copies
2904 of this license document, but changing it is not allowed.
2905 @end display
2906
2907 @unnumberedsec Preamble
2908
2909   The licenses for most software are designed to take away your
2910 freedom to share and change it.  By contrast, the GNU General Public
2911 License is intended to guarantee your freedom to share and change free
2912 software---to make sure the software is free for all its users.  This
2913 General Public License applies to most of the Free Software
2914 Foundation's software and to any other program whose authors commit to
2915 using it.  (Some other Free Software Foundation software is covered by
2916 the GNU Library General Public License instead.)  You can apply it to
2917 your programs, too.
2918
2919   When we speak of free software, we are referring to freedom, not
2920 price.  Our General Public Licenses are designed to make sure that you
2921 have the freedom to distribute copies of free software (and charge for
2922 this service if you wish), that you receive source code or can get it
2923 if you want it, that you can change the software or use pieces of it
2924 in new free programs; and that you know you can do these things.
2925
2926   To protect your rights, we need to make restrictions that forbid
2927 anyone to deny you these rights or to ask you to surrender the rights.
2928 These restrictions translate to certain responsibilities for you if you
2929 distribute copies of the software, or if you modify it.
2930
2931   For example, if you distribute copies of such a program, whether
2932 gratis or for a fee, you must give the recipients all the rights that
2933 you have.  You must make sure that they, too, receive or can get the
2934 source code.  And you must show them these terms so they know their
2935 rights.
2936
2937   We protect your rights with two steps: (1) copyright the software, and
2938 (2) offer you this license which gives you legal permission to copy,
2939 distribute and/or modify the software.
2940
2941   Also, for each author's protection and ours, we want to make certain
2942 that everyone understands that there is no warranty for this free
2943 software.  If the software is modified by someone else and passed on, we
2944 want its recipients to know that what they have is not the original, so
2945 that any problems introduced by others will not reflect on the original
2946 authors' reputations.
2947
2948   Finally, any free program is threatened constantly by software
2949 patents.  We wish to avoid the danger that redistributors of a free
2950 program will individually obtain patent licenses, in effect making the
2951 program proprietary.  To prevent this, we have made it clear that any
2952 patent must be licensed for everyone's free use or not licensed at all.
2953
2954   The precise terms and conditions for copying, distribution and
2955 modification follow.
2956
2957 @iftex
2958 @unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
2959 @end iftex
2960 @ifinfo
2961 @center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
2962 @end ifinfo
2963
2964 @enumerate
2965 @item
2966 This License applies to any program or other work which contains
2967 a notice placed by the copyright holder saying it may be distributed
2968 under the terms of this General Public License.  The ``Program'', below,
2969 refers to any such program or work, and a ``work based on the Program''
2970 means either the Program or any derivative work under copyright law:
2971 that is to say, a work containing the Program or a portion of it,
2972 either verbatim or with modifications and/or translated into another
2973 language.  (Hereinafter, translation is included without limitation in
2974 the term ``modification''.)  Each licensee is addressed as ``you''.
2975
2976 Activities other than copying, distribution and modification are not
2977 covered by this License; they are outside its scope.  The act of
2978 running the Program is not restricted, and the output from the Program
2979 is covered only if its contents constitute a work based on the
2980 Program (independent of having been made by running the Program).
2981 Whether that is true depends on what the Program does.
2982
2983 @item
2984 You may copy and distribute verbatim copies of the Program's
2985 source code as you receive it, in any medium, provided that you
2986 conspicuously and appropriately publish on each copy an appropriate
2987 copyright notice and disclaimer of warranty; keep intact all the
2988 notices that refer to this License and to the absence of any warranty;
2989 and give any other recipients of the Program a copy of this License
2990 along with the Program.
2991
2992 You may charge a fee for the physical act of transferring a copy, and
2993 you may at your option offer warranty protection in exchange for a fee.
2994
2995 @item
2996 You may modify your copy or copies of the Program or any portion
2997 of it, thus forming a work based on the Program, and copy and
2998 distribute such modifications or work under the terms of Section 1
2999 above, provided that you also meet all of these conditions:
3000
3001 @enumerate a
3002 @item
3003 You must cause the modified files to carry prominent notices
3004 stating that you changed the files and the date of any change.
3005
3006 @item
3007 You must cause any work that you distribute or publish, that in
3008 whole or in part contains or is derived from the Program or any
3009 part thereof, to be licensed as a whole at no charge to all third
3010 parties under the terms of this License.
3011
3012 @item
3013 If the modified program normally reads commands interactively
3014 when run, you must cause it, when started running for such
3015 interactive use in the most ordinary way, to print or display an
3016 announcement including an appropriate copyright notice and a
3017 notice that there is no warranty (or else, saying that you provide
3018 a warranty) and that users may redistribute the program under
3019 these conditions, and telling the user how to view a copy of this
3020 License.  (Exception: if the Program itself is interactive but
3021 does not normally print such an announcement, your work based on
3022 the Program is not required to print an announcement.)
3023 @end enumerate
3024
3025 These requirements apply to the modified work as a whole.  If
3026 identifiable sections of that work are not derived from the Program,
3027 and can be reasonably considered independent and separate works in
3028 themselves, then this License, and its terms, do not apply to those
3029 sections when you distribute them as separate works.  But when you
3030 distribute the same sections as part of a whole which is a work based
3031 on the Program, the distribution of the whole must be on the terms of
3032 this License, whose permissions for other licensees extend to the
3033 entire whole, and thus to each and every part regardless of who wrote it.
3034
3035 Thus, it is not the intent of this section to claim rights or contest
3036 your rights to work written entirely by you; rather, the intent is to
3037 exercise the right to control the distribution of derivative or
3038 collective works based on the Program.
3039
3040 In addition, mere aggregation of another work not based on the Program
3041 with the Program (or with a work based on the Program) on a volume of
3042 a storage or distribution medium does not bring the other work under
3043 the scope of this License.
3044
3045 @item
3046 You may copy and distribute the Program (or a work based on it,
3047 under Section 2) in object code or executable form under the terms of
3048 Sections 1 and 2 above provided that you also do one of the following:
3049
3050 @enumerate a
3051 @item
3052 Accompany it with the complete corresponding machine-readable
3053 source code, which must be distributed under the terms of Sections
3054 1 and 2 above on a medium customarily used for software interchange; or,
3055
3056 @item
3057 Accompany it with a written offer, valid for at least three
3058 years, to give any third party, for a charge no more than your
3059 cost of physically performing source distribution, a complete
3060 machine-readable copy of the corresponding source code, to be
3061 distributed under the terms of Sections 1 and 2 above on a medium
3062 customarily used for software interchange; or,
3063
3064 @item
3065 Accompany it with the information you received as to the offer
3066 to distribute corresponding source code.  (This alternative is
3067 allowed only for noncommercial distribution and only if you
3068 received the program in object code or executable form with such
3069 an offer, in accord with Subsection b above.)
3070 @end enumerate
3071
3072 The source code for a work means the preferred form of the work for
3073 making modifications to it.  For an executable work, complete source
3074 code means all the source code for all modules it contains, plus any
3075 associated interface definition files, plus the scripts used to
3076 control compilation and installation of the executable.  However, as a
3077 special exception, the source code distributed need not include
3078 anything that is normally distributed (in either source or binary
3079 form) with the major components (compiler, kernel, and so on) of the
3080 operating system on which the executable runs, unless that component
3081 itself accompanies the executable.
3082
3083 If distribution of executable or object code is made by offering
3084 access to copy from a designated place, then offering equivalent
3085 access to copy the source code from the same place counts as
3086 distribution of the source code, even though third parties are not
3087 compelled to copy the source along with the object code.
3088
3089 @item
3090 You may not copy, modify, sublicense, or distribute the Program
3091 except as expressly provided under this License.  Any attempt
3092 otherwise to copy, modify, sublicense or distribute the Program is
3093 void, and will automatically terminate your rights under this License.
3094 However, parties who have received copies, or rights, from you under
3095 this License will not have their licenses terminated so long as such
3096 parties remain in full compliance.
3097
3098 @item
3099 You are not required to accept this License, since you have not
3100 signed it.  However, nothing else grants you permission to modify or
3101 distribute the Program or its derivative works.  These actions are
3102 prohibited by law if you do not accept this License.  Therefore, by
3103 modifying or distributing the Program (or any work based on the
3104 Program), you indicate your acceptance of this License to do so, and
3105 all its terms and conditions for copying, distributing or modifying
3106 the Program or works based on it.
3107
3108 @item
3109 Each time you redistribute the Program (or any work based on the
3110 Program), the recipient automatically receives a license from the
3111 original licensor to copy, distribute or modify the Program subject to
3112 these terms and conditions.  You may not impose any further
3113 restrictions on the recipients' exercise of the rights granted herein.
3114 You are not responsible for enforcing compliance by third parties to
3115 this License.
3116
3117 @item
3118 If, as a consequence of a court judgment or allegation of patent
3119 infringement or for any other reason (not limited to patent issues),
3120 conditions are imposed on you (whether by court order, agreement or
3121 otherwise) that contradict the conditions of this License, they do not
3122 excuse you from the conditions of this License.  If you cannot
3123 distribute so as to satisfy simultaneously your obligations under this
3124 License and any other pertinent obligations, then as a consequence you
3125 may not distribute the Program at all.  For example, if a patent
3126 license would not permit royalty-free redistribution of the Program by
3127 all those who receive copies directly or indirectly through you, then
3128 the only way you could satisfy both it and this License would be to
3129 refrain entirely from distribution of the Program.
3130
3131 If any portion of this section is held invalid or unenforceable under
3132 any particular circumstance, the balance of the section is intended to
3133 apply and the section as a whole is intended to apply in other
3134 circumstances.
3135
3136 It is not the purpose of this section to induce you to infringe any
3137 patents or other property right claims or to contest validity of any
3138 such claims; this section has the sole purpose of protecting the
3139 integrity of the free software distribution system, which is
3140 implemented by public license practices.  Many people have made
3141 generous contributions to the wide range of software distributed
3142 through that system in reliance on consistent application of that
3143 system; it is up to the author/donor to decide if he or she is willing
3144 to distribute software through any other system and a licensee cannot
3145 impose that choice.
3146
3147 This section is intended to make thoroughly clear what is believed to
3148 be a consequence of the rest of this License.
3149
3150 @item
3151 If the distribution and/or use of the Program is restricted in
3152 certain countries either by patents or by copyrighted interfaces, the
3153 original copyright holder who places the Program under this License
3154 may add an explicit geographical distribution limitation excluding
3155 those countries, so that distribution is permitted only in or among
3156 countries not thus excluded.  In such case, this License incorporates
3157 the limitation as if written in the body of this License.
3158
3159 @item
3160 The Free Software Foundation may publish revised and/or new versions
3161 of the General Public License from time to time.  Such new versions will
3162 be similar in spirit to the present version, but may differ in detail to
3163 address new problems or concerns.
3164
3165 Each version is given a distinguishing version number.  If the Program
3166 specifies a version number of this License which applies to it and ``any
3167 later version'', you have the option of following the terms and conditions
3168 either of that version or of any later version published by the Free
3169 Software Foundation.  If the Program does not specify a version number of
3170 this License, you may choose any version ever published by the Free Software
3171 Foundation.
3172
3173 @item
3174 If you wish to incorporate parts of the Program into other free
3175 programs whose distribution conditions are different, write to the author
3176 to ask for permission.  For software which is copyrighted by the Free
3177 Software Foundation, write to the Free Software Foundation; we sometimes
3178 make exceptions for this.  Our decision will be guided by the two goals
3179 of preserving the free status of all derivatives of our free software and
3180 of promoting the sharing and reuse of software generally.
3181
3182 @iftex
3183 @heading NO WARRANTY
3184 @end iftex
3185 @ifinfo
3186 @center NO WARRANTY
3187 @end ifinfo
3188 @cindex no warranty
3189
3190 @item
3191 BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
3192 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
3193 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
3194 PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
3195 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
3196 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
3197 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
3198 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
3199 REPAIR OR CORRECTION.
3200
3201 @item
3202 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
3203 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
3204 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
3205 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
3206 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
3207 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
3208 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
3209 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
3210 POSSIBILITY OF SUCH DAMAGES.
3211 @end enumerate
3212
3213 @iftex
3214 @heading END OF TERMS AND CONDITIONS
3215 @end iftex
3216 @ifinfo
3217 @center END OF TERMS AND CONDITIONS
3218 @end ifinfo
3219
3220 @page
3221 @unnumberedsec How to Apply These Terms to Your New Programs
3222
3223   If you develop a new program, and you want it to be of the greatest
3224 possible use to the public, the best way to achieve this is to make it
3225 free software which everyone can redistribute and change under these terms.
3226
3227   To do so, attach the following notices to the program.  It is safest
3228 to attach them to the start of each source file to most effectively
3229 convey the exclusion of warranty; and each file should have at least
3230 the ``copyright'' line and a pointer to where the full notice is found.
3231
3232 @smallexample
3233 @var{one line to give the program's name and an idea of what it does.}
3234 Copyright (C) 19@var{yy}  @var{name of author}
3235
3236 This program is free software; you can redistribute it and/or
3237 modify it under the terms of the GNU General Public License
3238 as published by the Free Software Foundation; either version 2
3239 of the License, or (at your option) any later version.
3240
3241 This program is distributed in the hope that it will be useful,
3242 but WITHOUT ANY WARRANTY; without even the implied warranty of
3243 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3244 GNU General Public License for more details.
3245
3246 You should have received a copy of the GNU General Public License
3247 along with this program; if not, write to the Free Software
3248 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3249 @end smallexample
3250
3251 Also add information on how to contact you by electronic and paper mail.
3252
3253 If the program is interactive, make it output a short notice like this
3254 when it starts in an interactive mode:
3255
3256 @smallexample
3257 Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author}
3258 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
3259 type `show w'.  This is free software, and you are welcome
3260 to redistribute it under certain conditions; type `show c'
3261 for details.
3262 @end smallexample
3263
3264 The hypothetical commands @samp{show w} and @samp{show c} should show
3265 the appropriate parts of the General Public License.  Of course, the
3266 commands you use may be called something other than @samp{show w} and
3267 @samp{show c}; they could even be mouse-clicks or menu items---whatever
3268 suits your program.
3269
3270 You should also get your employer (if you work as a programmer) or your
3271 school, if any, to sign a ``copyright disclaimer'' for the program, if
3272 necessary.  Here is a sample; alter the names:
3273
3274 @smallexample
3275 @group
3276 Yoyodyne, Inc., hereby disclaims all copyright
3277 interest in the program `Gnomovision'
3278 (which makes passes at compilers) written
3279 by James Hacker.
3280
3281 @var{signature of Ty Coon}, 1 April 1989
3282 Ty Coon, President of Vice
3283 @end group
3284 @end smallexample
3285
3286 This General Public License does not permit incorporating your program into
3287 proprietary programs.  If your program is a subroutine library, you may
3288 consider it more useful to permit linking proprietary applications with the
3289 library.  If this is what you want to do, use the GNU Library General
3290 Public License instead of this License.
3291
3292 @node Concept Index,  , Copying, Top
3293 @unnumbered Concept Index
3294 @printindex cp
3295
3296 @contents
3297
3298 @bye