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