2000-06-28 16:55:15 +00:00
|
|
|
|
.\"-
|
|
|
|
|
.\" Copyright (c) 2000 Dag-Erling Co<43>dan Sm<53>rgrav
|
|
|
|
|
.\" All rights reserved.
|
2000-07-05 12:04:31 +00:00
|
|
|
|
.\" Portions Copyright (c) 1999 Massachusetts Institute of Technology; used
|
|
|
|
|
.\" by permission.
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.\"
|
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
|
.\" are met:
|
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
|
.\" notice, this list of conditions and the following disclaimer
|
|
|
|
|
.\" in this position and unchanged.
|
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
|
.\" 3. The name of the author may not be used to endorse or promote products
|
|
|
|
|
.\" derived from this software without specific prior written permission.
|
|
|
|
|
.\"
|
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
.\"
|
|
|
|
|
.\" $FreeBSD$
|
|
|
|
|
.\"
|
|
|
|
|
.Dd June 28, 2000
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.Dt FETCH 1
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.Os
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.Sh NAME
|
|
|
|
|
.Nm fetch
|
|
|
|
|
.Nd retrieve a file by Uniform Resource Locator
|
|
|
|
|
.Sh SYNOPSIS
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.Nm
|
2001-03-24 00:32:11 +00:00
|
|
|
|
.Op Fl 146AFMPRUadlmnpqrsv
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.Op Fl B Ar bytes
|
|
|
|
|
.Op Fl S Ar bytes
|
|
|
|
|
.Op Fl T Ar seconds
|
2003-01-22 18:35:20 +00:00
|
|
|
|
.Op Fl N Ar file
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.Op Fl o Ar file
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.Op Fl w Ar seconds
|
2000-06-29 10:35:24 +00:00
|
|
|
|
.Op Fl h Ar host
|
|
|
|
|
.Op Fl c Ar dir
|
|
|
|
|
.Op Fl f Ar file
|
|
|
|
|
.Op Ar URL ...
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.Sh DESCRIPTION
|
2002-04-19 23:44:58 +00:00
|
|
|
|
The
|
|
|
|
|
.Nm
|
|
|
|
|
utility provides a command-line interface to the
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.Xr fetch 3
|
|
|
|
|
library.
|
|
|
|
|
Its purpose is to retrieve the file(s) pointed to by the URL(s) on the
|
|
|
|
|
command line.
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.Pp
|
|
|
|
|
The following options are available:
|
1997-02-05 19:59:18 +00:00
|
|
|
|
.Bl -tag -width Fl
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.It Fl \&1
|
|
|
|
|
Stop and return exit code 0 at the first successfully retrieved file.
|
|
|
|
|
.It Fl 4
|
|
|
|
|
Forces
|
|
|
|
|
.Nm
|
|
|
|
|
to use IPv4 addresses only.
|
|
|
|
|
.It Fl 6
|
|
|
|
|
Forces
|
|
|
|
|
.Nm
|
|
|
|
|
to use IPv6 addresses only.
|
1999-02-23 18:51:13 +00:00
|
|
|
|
.It Fl A
|
2000-06-28 16:55:15 +00:00
|
|
|
|
Do not automatically follow ``temporary'' (302) redirects.
|
|
|
|
|
Some broken Web sites will return a redirect instead of a not-found
|
|
|
|
|
error when the requested object does not exist.
|
1997-01-31 19:55:51 +00:00
|
|
|
|
.It Fl a
|
|
|
|
|
Automatically retry the transfer upon soft failures.
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.It Fl B Ar bytes
|
|
|
|
|
Specify the read buffer size in bytes.
|
|
|
|
|
The default is 4096 bytes.
|
|
|
|
|
Attempts to set a buffer size lower than this will be silently
|
|
|
|
|
ignored.
|
|
|
|
|
The number of reads actually performed is reported at verbosity level
|
|
|
|
|
two or higher (see the
|
|
|
|
|
.Fl v
|
|
|
|
|
flag).
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.It Fl c Ar dir
|
1997-01-30 21:43:44 +00:00
|
|
|
|
The file to retrieve is in directory
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.Ar dir
|
1997-01-30 21:43:44 +00:00
|
|
|
|
on the remote host.
|
2000-06-29 10:35:24 +00:00
|
|
|
|
This option is deprecated and is provided for backward compatibility
|
|
|
|
|
only.
|
|
|
|
|
.It Fl d
|
|
|
|
|
Use a direct connection even if a proxy is configured.
|
1999-10-23 15:22:53 +00:00
|
|
|
|
.It Fl F
|
2000-06-28 16:55:15 +00:00
|
|
|
|
In combination with the
|
1999-10-23 15:22:53 +00:00
|
|
|
|
.Fl r
|
2000-06-28 16:55:15 +00:00
|
|
|
|
flag, forces a restart even if the local and remote files have
|
|
|
|
|
different modification times.
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.It Fl f Ar file
|
1997-01-30 21:43:44 +00:00
|
|
|
|
The file to retrieve is named
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.Ar file
|
|
|
|
|
on the remote host.
|
2000-06-29 10:35:24 +00:00
|
|
|
|
This option is deprecated and is provided for backward compatibility
|
|
|
|
|
only.
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.It Fl h Ar host
|
1997-01-30 21:43:44 +00:00
|
|
|
|
The file to retrieve is located on the host
|
|
|
|
|
.Ar host .
|
2000-06-29 10:35:24 +00:00
|
|
|
|
This option is deprecated and is provided for backward compatibility
|
|
|
|
|
only.
|
1996-08-22 21:30:51 +00:00
|
|
|
|
.It Fl l
|
2000-06-28 16:55:15 +00:00
|
|
|
|
If the target is a file-scheme URL, make a symbolic link to the target
|
|
|
|
|
rather than trying to copy it.
|
1997-01-30 21:43:44 +00:00
|
|
|
|
.It Fl M
|
|
|
|
|
.It Fl m
|
2000-07-08 09:34:53 +00:00
|
|
|
|
Mirror mode: if the file already exists locally and has the same size
|
|
|
|
|
and modification time as the remote file, it will not be fetched.
|
2000-07-17 21:51:48 +00:00
|
|
|
|
Note that the
|
|
|
|
|
.Fl m
|
|
|
|
|
and
|
|
|
|
|
.Fl r
|
|
|
|
|
flags are mutually exclusive.
|
2003-01-22 18:35:20 +00:00
|
|
|
|
.It Fl N Ar file
|
|
|
|
|
Use
|
|
|
|
|
.Ar file
|
|
|
|
|
instead of
|
|
|
|
|
.Pa ~/.netrc
|
|
|
|
|
to lookup login names and passwords for FTP sites.
|
|
|
|
|
See
|
|
|
|
|
.Xr ftp 1
|
|
|
|
|
for a description of the file format.
|
|
|
|
|
This feature is experimental.
|
1997-01-30 21:43:44 +00:00
|
|
|
|
.It Fl n
|
2000-07-08 09:34:53 +00:00
|
|
|
|
Don't preserve the modification time of the transferred file.
|
1997-01-30 21:43:44 +00:00
|
|
|
|
.It Fl o Ar file
|
2001-07-15 08:06:20 +00:00
|
|
|
|
Set the output file name to
|
1997-01-30 21:43:44 +00:00
|
|
|
|
.Ar file .
|
|
|
|
|
By default, a ``pathname'' is extracted from the specified URI, and
|
2000-06-28 16:55:15 +00:00
|
|
|
|
its basename is used as the name of the output file.
|
|
|
|
|
A
|
1997-01-30 21:43:44 +00:00
|
|
|
|
.Ar file
|
|
|
|
|
argument of
|
|
|
|
|
.Sq Li \&-
|
|
|
|
|
indicates that results are to be directed to the standard output.
|
|
|
|
|
.It Fl P
|
|
|
|
|
.It Fl p
|
2000-06-28 16:55:15 +00:00
|
|
|
|
Use passive FTP.
|
|
|
|
|
This is useful if you are behind a firewall which blocks incoming
|
|
|
|
|
connections.
|
|
|
|
|
Try this flag if
|
|
|
|
|
.Nm
|
|
|
|
|
seems to hang when retrieving FTP URLs.
|
1997-01-30 21:43:44 +00:00
|
|
|
|
.It Fl q
|
2000-03-01 12:20:22 +00:00
|
|
|
|
Quiet mode.
|
1997-01-30 21:43:44 +00:00
|
|
|
|
.It Fl R
|
2000-06-28 16:55:15 +00:00
|
|
|
|
The output files are precious, and should not be deleted under any
|
|
|
|
|
circumstances, even if the transfer failed or was incomplete.
|
1997-01-30 21:43:44 +00:00
|
|
|
|
.It Fl r
|
|
|
|
|
Restart a previously interrupted transfer.
|
2000-07-17 21:51:48 +00:00
|
|
|
|
Note that the
|
|
|
|
|
.Fl m
|
|
|
|
|
and
|
|
|
|
|
.Fl r
|
|
|
|
|
flags are mutually exclusive.
|
1998-09-20 00:01:26 +00:00
|
|
|
|
.It Fl S Ar bytes
|
2000-06-28 16:55:15 +00:00
|
|
|
|
Require the file size reported by the server to match the specified
|
|
|
|
|
value.
|
|
|
|
|
If it does not, a message is printed and the file is not fetched.
|
|
|
|
|
If the server does not support reporting file sizes, this option is
|
|
|
|
|
ignored and the file is fetched unconditionally.
|
1998-12-08 13:00:49 +00:00
|
|
|
|
.It Fl s
|
2000-06-28 16:55:15 +00:00
|
|
|
|
Print the size in bytes of each requested file, without fetching it.
|
1996-08-22 21:30:51 +00:00
|
|
|
|
.It Fl T Ar seconds
|
|
|
|
|
Set timeout value to
|
2001-02-01 16:38:02 +00:00
|
|
|
|
.Ar seconds .
|
1996-09-19 18:07:24 +00:00
|
|
|
|
Overrides the environment variables
|
1996-08-22 21:30:51 +00:00
|
|
|
|
.Ev FTP_TIMEOUT
|
2000-06-28 16:55:15 +00:00
|
|
|
|
for FTP transfers or
|
2001-07-15 08:06:20 +00:00
|
|
|
|
.Ev HTTP_TIMEOUT
|
2000-06-28 16:55:15 +00:00
|
|
|
|
for HTTP transfers if set.
|
2001-03-24 00:32:11 +00:00
|
|
|
|
.It Fl U
|
|
|
|
|
When using passive FTP, allocate the port for the data connection from
|
|
|
|
|
the low (default) port range.
|
|
|
|
|
See
|
|
|
|
|
.Xr ip 4
|
|
|
|
|
for details on how to specify which port range this corresponds to.
|
1996-08-31 22:03:05 +00:00
|
|
|
|
.It Fl v
|
2000-07-17 22:44:36 +00:00
|
|
|
|
Increase verbosity level.
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.It Fl w Ar seconds
|
|
|
|
|
When the
|
|
|
|
|
.Fl a
|
|
|
|
|
flag is specified, wait this many seconds between successive retries.
|
1997-02-05 19:59:18 +00:00
|
|
|
|
.El
|
2002-01-16 16:16:08 +00:00
|
|
|
|
.Pp
|
|
|
|
|
If
|
|
|
|
|
.Nm
|
|
|
|
|
receives a
|
|
|
|
|
.Dv SIGINFO
|
|
|
|
|
signal (see the
|
|
|
|
|
.Cm status
|
|
|
|
|
argument for
|
|
|
|
|
.Xr stty 1 ) ,
|
|
|
|
|
the current transfer rate statistics will be written to the
|
|
|
|
|
standard error output, in the same format as the standard completion
|
|
|
|
|
message.
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.Sh DIAGNOSTICS
|
1997-02-05 19:59:18 +00:00
|
|
|
|
The
|
|
|
|
|
.Nm
|
2000-06-28 16:55:15 +00:00
|
|
|
|
command returns zero on success, or one on failure.
|
|
|
|
|
If multiple URLs are listed on the command line,
|
1997-02-05 19:59:18 +00:00
|
|
|
|
.Nm
|
2000-06-28 16:55:15 +00:00
|
|
|
|
will attempt to retrieve them each of them in turn, and return zero
|
|
|
|
|
only if they were all successfully retrieved.
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.Sh ENVIRONMENT
|
2001-03-07 03:22:11 +00:00
|
|
|
|
.Bl -tag -width HTTP_TIMEOUT
|
1997-01-30 21:43:44 +00:00
|
|
|
|
.It Ev FTP_TIMEOUT
|
2001-07-15 08:06:20 +00:00
|
|
|
|
maximum time, in seconds, to wait before aborting an
|
1997-01-30 21:43:44 +00:00
|
|
|
|
.Tn FTP
|
|
|
|
|
connection.
|
1997-02-05 19:59:18 +00:00
|
|
|
|
.It Ev HTTP_TIMEOUT
|
|
|
|
|
maximum time, in seconds, to wait before aborting an
|
|
|
|
|
.Tn HTTP
|
|
|
|
|
connection.
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.El
|
|
|
|
|
.Pp
|
|
|
|
|
All environment variables mentioned in the documentation for the
|
|
|
|
|
.Xr fetch 3
|
|
|
|
|
library are supported.
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.Sh SEE ALSO
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.Xr fetch 3
|
1996-07-05 01:03:20 +00:00
|
|
|
|
.Sh HISTORY
|
2001-07-15 08:06:20 +00:00
|
|
|
|
The
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.Nm
|
1996-08-23 00:57:08 +00:00
|
|
|
|
command appeared in
|
|
|
|
|
.Fx 2.1.5 .
|
2000-06-28 16:55:15 +00:00
|
|
|
|
This implementation first appeared in
|
|
|
|
|
.Fx 4.1 .
|
1997-01-30 21:43:44 +00:00
|
|
|
|
.Sh AUTHORS
|
2000-11-22 09:35:58 +00:00
|
|
|
|
.An -nosplit
|
1997-01-30 21:43:44 +00:00
|
|
|
|
The original implementation of
|
|
|
|
|
.Nm
|
1998-03-23 07:48:45 +00:00
|
|
|
|
was done by
|
|
|
|
|
.An Jean-Marc Zucconi .
|
|
|
|
|
It was extensively re-worked for
|
1997-02-22 23:43:32 +00:00
|
|
|
|
.Fx 2.2
|
1998-03-23 07:48:45 +00:00
|
|
|
|
by
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.An Garrett Wollman ,
|
|
|
|
|
and later completely rewritten to use the
|
|
|
|
|
.Xr fetch 3
|
|
|
|
|
library by
|
2000-11-14 13:19:26 +00:00
|
|
|
|
.An Dag-Erling Sm\(/orgrav .
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.Sh NOTES
|
1997-01-31 19:55:51 +00:00
|
|
|
|
The
|
1997-07-25 19:35:44 +00:00
|
|
|
|
.Fl b
|
2000-06-28 16:55:15 +00:00
|
|
|
|
and
|
|
|
|
|
.Fl t
|
|
|
|
|
options are no longer supported and will generate warnings.
|
|
|
|
|
They were workarounds for bugs in other OSes which this implementation
|
|
|
|
|
does not trigger.
|
1999-01-15 16:56:22 +00:00
|
|
|
|
.Pp
|
2000-06-29 10:35:24 +00:00
|
|
|
|
One cannot both use the
|
|
|
|
|
.Fl h ,
|
2000-07-18 21:05:11 +00:00
|
|
|
|
.Fl c
|
|
|
|
|
and
|
2000-06-28 16:55:15 +00:00
|
|
|
|
.Fl f
|
2000-06-29 10:35:24 +00:00
|
|
|
|
options and specify URLs on the command line.
|