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