freebsd-nq/usr.bin/fetch/fetch.1

239 lines
6.6 KiB
Groff
Raw Normal View History

2000-06-28 16:55:15 +00:00
.\"-
.\" Copyright (c) 2000 Dag-Erling Co<43>dan Sm<53>rgrav
.\" All rights reserved.
.\"
.\" 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
.Dt FETCH 1
2000-06-28 16:55:15 +00:00
.Os
.Sh NAME
.Nm fetch
.Nd retrieve a file by Uniform Resource Locator
.Sh SYNOPSIS
2000-06-28 16:55:15 +00:00
.Nm
.Op Fl 146AFHMPRalmnpqrsv
.Op Fl B Ar bytes
.Op Fl S Ar bytes
.Op Fl T Ar seconds
.Op Fl o Ar file
2000-06-28 16:55:15 +00:00
.Op Fl w Ar seconds
.Ar URL
.Op Ar ...
.Sh DESCRIPTION
2000-06-28 16:55:15 +00:00
.Nm Fetch
provides a command-line interface to the
.Xr fetch 3
library.
Its purpose is to retrieve the file(s) pointed to by the URL(s) on the
command line.
.Pp
The following options are available:
.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.
.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.
.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).
.It Fl c Ar dir
The file to retrieve is in directory
.Ar dir
on the remote host.
.It Fl F
2000-06-28 16:55:15 +00:00
In combination with the
.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.
.It Fl f Ar file
The file to retrieve is named
.Ar file
on the remote host.
2000-06-28 16:55:15 +00:00
.It Fl H
When using passive FTP, allocate a high port for the data connection.
See
.Xr ip 4
for details on how to specify which port range this corresponds to.
.It Fl h Ar host
The file to retrieve is located on the host
.Ar host .
.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.
.It Fl M
.It Fl m
2000-06-28 16:55:15 +00:00
Mirror mode: set the modification time of the local file to that of
the remote file.
If the file already exists locally and has the same size and
modification time as the remote file, it will not be fetched.
.It Fl n
2000-06-28 16:55:15 +00:00
Don't preserve the modtime of the transfered file, use the current
time.
.It Fl o Ar file
Set the output file name to
.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
.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.
.It Fl q
Quiet mode.
2000-06-28 16:55:15 +00:00
This works by setting the verbosity level to zero; see the
.Fl v
option.
.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.
.It Fl r
Restart a previously interrupted transfer.
.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.
.It Fl s
2000-06-28 16:55:15 +00:00
Print the size in bytes of each requested file, without fetching it.
.It Fl T Ar seconds
Set timeout value to
.Ar seconds.
Overrides the environment variables
.Ev FTP_TIMEOUT
2000-06-28 16:55:15 +00:00
for FTP transfers or
.Ev HTTP_TIMEOUT
2000-06-28 16:55:15 +00:00
for HTTP transfers if set.
.It Fl t
Work around a different set of buggy
.Tn TCP
implementations.
.It Fl v
2000-06-28 16:55:15 +00:00
Each instance of this flag increases the verbosity level by one.
Level one (the default) only gives a summary after each file; level
two show a running count during the transfer, provided that the
standard output goes to a terminal; level three enables messages from
the
.Xr fetch 3
library.
.It Fl w Ar seconds
When the
.Fl a
flag is specified, wait this many seconds between successive retries.
.El
2000-06-28 16:55:15 +00:00
.Sh DIAGNOSTICS
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,
.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.
.Sh ENVIRONMENT
.Bl -tag -width FTP_PASSIVE_MODE -offset indent
.It Ev FTP_TIMEOUT
maximum time, in seconds, to wait before aborting an
.Tn FTP
connection.
.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.
.Sh SEE ALSO
2000-06-28 16:55:15 +00:00
.Xr fetch 3
.Sh HISTORY
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 .
.Sh AUTHORS
The original implementation of
.Nm
was done by
.An Jean-Marc Zucconi .
It was extensively re-worked for
.Fx 2.2
by
2000-06-28 16:55:15 +00:00
.An Garrett Wollman ,
and later completely rewritten to use the
.Xr fetch 3
library by
.An Dag-Erling Sm<EFBFBD>rgrav .
.Sh NOTES
The
.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.
.Pp
The
2000-06-28 16:55:15 +00:00
.Fl f
and
.Fl h
options (used for specifying an file to fetch and a host to fetch
from) are no longer supported and will generate errors.
Use URLs.
RFC1738 is your friend.
.Xr fetch 3
library.