1b39628e7SDag-Erling Smørgrav.\"- 2b39628e7SDag-Erling Smørgrav.\" Copyright (c) 2000 Dag-Erling Co�dan Sm�rgrav 3b39628e7SDag-Erling Smørgrav.\" All rights reserved. 4b39628e7SDag-Erling Smørgrav.\" 5b39628e7SDag-Erling Smørgrav.\" Redistribution and use in source and binary forms, with or without 6b39628e7SDag-Erling Smørgrav.\" modification, are permitted provided that the following conditions 7b39628e7SDag-Erling Smørgrav.\" are met: 8b39628e7SDag-Erling Smørgrav.\" 1. Redistributions of source code must retain the above copyright 9b39628e7SDag-Erling Smørgrav.\" notice, this list of conditions and the following disclaimer 10b39628e7SDag-Erling Smørgrav.\" in this position and unchanged. 11b39628e7SDag-Erling Smørgrav.\" 2. Redistributions in binary form must reproduce the above copyright 12b39628e7SDag-Erling Smørgrav.\" notice, this list of conditions and the following disclaimer in the 13b39628e7SDag-Erling Smørgrav.\" documentation and/or other materials provided with the distribution. 14b39628e7SDag-Erling Smørgrav.\" 3. The name of the author may not be used to endorse or promote products 15b39628e7SDag-Erling Smørgrav.\" derived from this software without specific prior written permission. 16b39628e7SDag-Erling Smørgrav.\" 17b39628e7SDag-Erling Smørgrav.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18b39628e7SDag-Erling Smørgrav.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19b39628e7SDag-Erling Smørgrav.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20b39628e7SDag-Erling Smørgrav.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21b39628e7SDag-Erling Smørgrav.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22b39628e7SDag-Erling Smørgrav.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23b39628e7SDag-Erling Smørgrav.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24b39628e7SDag-Erling Smørgrav.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25b39628e7SDag-Erling Smørgrav.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26b39628e7SDag-Erling Smørgrav.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27b39628e7SDag-Erling Smørgrav.\" 28c3aac50fSPeter Wemm.\" $FreeBSD$ 29b39628e7SDag-Erling Smørgrav.\" 30b39628e7SDag-Erling Smørgrav.Dd June 28, 2000 317fefc698SJordan K. Hubbard.Dt FETCH 1 32b39628e7SDag-Erling Smørgrav.Os 337fefc698SJordan K. Hubbard.Sh NAME 347fefc698SJordan K. Hubbard.Nm fetch 357fefc698SJordan K. Hubbard.Nd retrieve a file by Uniform Resource Locator 367fefc698SJordan K. Hubbard.Sh SYNOPSIS 37b39628e7SDag-Erling Smørgrav.Nm 38047843ddSDag-Erling Smørgrav.Op Fl 146AFHMPRadlmnpqrsv 39b39628e7SDag-Erling Smørgrav.Op Fl B Ar bytes 40b39628e7SDag-Erling Smørgrav.Op Fl S Ar bytes 41b39628e7SDag-Erling Smørgrav.Op Fl T Ar seconds 427fefc698SJordan K. Hubbard.Op Fl o Ar file 43b39628e7SDag-Erling Smørgrav.Op Fl w Ar seconds 44047843ddSDag-Erling Smørgrav.Op Fl h Ar host 45047843ddSDag-Erling Smørgrav.Op Fl c Ar dir 46047843ddSDag-Erling Smørgrav.Op Fl f Ar file 47047843ddSDag-Erling Smørgrav.Op Ar URL ... 487fefc698SJordan K. Hubbard.Sh DESCRIPTION 49b39628e7SDag-Erling Smørgrav.Nm Fetch 50b39628e7SDag-Erling Smørgravprovides a command-line interface to the 51b39628e7SDag-Erling Smørgrav.Xr fetch 3 52b39628e7SDag-Erling Smørgravlibrary. 53b39628e7SDag-Erling SmørgravIts purpose is to retrieve the file(s) pointed to by the URL(s) on the 54b39628e7SDag-Erling Smørgravcommand line. 557fefc698SJordan K. Hubbard.Pp 567fefc698SJordan K. HubbardThe following options are available: 5776dafb89SGarrett Wollman.Bl -tag -width Fl 58b39628e7SDag-Erling Smørgrav.It Fl \&1 59b39628e7SDag-Erling SmørgravStop and return exit code 0 at the first successfully retrieved file. 60b39628e7SDag-Erling Smørgrav.It Fl 4 61b39628e7SDag-Erling SmørgravForces 62b39628e7SDag-Erling Smørgrav.Nm 63b39628e7SDag-Erling Smørgravto use IPv4 addresses only. 64b39628e7SDag-Erling Smørgrav.It Fl 6 65b39628e7SDag-Erling SmørgravForces 66b39628e7SDag-Erling Smørgrav.Nm 67b39628e7SDag-Erling Smørgravto use IPv6 addresses only. 68189da044SGarrett Wollman.It Fl A 69b39628e7SDag-Erling SmørgravDo not automatically follow ``temporary'' (302) redirects. 70b39628e7SDag-Erling SmørgravSome broken Web sites will return a redirect instead of a not-found 71b39628e7SDag-Erling Smørgraverror when the requested object does not exist. 722494e810SGarrett Wollman.It Fl a 732494e810SGarrett WollmanAutomatically retry the transfer upon soft failures. 74b39628e7SDag-Erling Smørgrav.It Fl B Ar bytes 75b39628e7SDag-Erling SmørgravSpecify the read buffer size in bytes. 76b39628e7SDag-Erling SmørgravThe default is 4096 bytes. 77b39628e7SDag-Erling SmørgravAttempts to set a buffer size lower than this will be silently 78b39628e7SDag-Erling Smørgravignored. 79b39628e7SDag-Erling SmørgravThe number of reads actually performed is reported at verbosity level 80b39628e7SDag-Erling Smørgravtwo or higher (see the 81b39628e7SDag-Erling Smørgrav.Fl v 82b39628e7SDag-Erling Smørgravflag). 8378be3199SGarrett Wollman.It Fl c Ar dir 8478be3199SGarrett WollmanThe file to retrieve is in directory 8578be3199SGarrett Wollman.Ar dir 8678be3199SGarrett Wollmanon the remote host. 87047843ddSDag-Erling SmørgravThis option is deprecated and is provided for backward compatibility 88047843ddSDag-Erling Smørgravonly. 89047843ddSDag-Erling Smørgrav.It Fl d 90047843ddSDag-Erling SmørgravUse a direct connection even if a proxy is configured. 91d6a8296aSBrian Feldman.It Fl F 92b39628e7SDag-Erling SmørgravIn combination with the 93d6a8296aSBrian Feldman.Fl r 94b39628e7SDag-Erling Smørgravflag, forces a restart even if the local and remote files have 95b39628e7SDag-Erling Smørgravdifferent modification times. 9678be3199SGarrett Wollman.It Fl f Ar file 9778be3199SGarrett WollmanThe file to retrieve is named 9878be3199SGarrett Wollman.Ar file 9978be3199SGarrett Wollmanon the remote host. 100047843ddSDag-Erling SmørgravThis option is deprecated and is provided for backward compatibility 101047843ddSDag-Erling Smørgravonly. 102b39628e7SDag-Erling Smørgrav.It Fl H 103b39628e7SDag-Erling SmørgravWhen using passive FTP, allocate a high port for the data connection. 104b39628e7SDag-Erling SmørgravSee 105b39628e7SDag-Erling Smørgrav.Xr ip 4 106b39628e7SDag-Erling Smørgravfor details on how to specify which port range this corresponds to. 10778be3199SGarrett Wollman.It Fl h Ar host 10878be3199SGarrett WollmanThe file to retrieve is located on the host 10978be3199SGarrett Wollman.Ar host . 110047843ddSDag-Erling SmørgravThis option is deprecated and is provided for backward compatibility 111047843ddSDag-Erling Smørgravonly. 11278be3199SGarrett Wollman.It Fl l 113b39628e7SDag-Erling SmørgravIf the target is a file-scheme URL, make a symbolic link to the target 114b39628e7SDag-Erling Smørgravrather than trying to copy it. 1157fefc698SJordan K. Hubbard.It Fl M 1167fefc698SJordan K. Hubbard.It Fl m 117b39628e7SDag-Erling SmørgravMirror mode: set the modification time of the local file to that of 118b39628e7SDag-Erling Smørgravthe remote file. 119b39628e7SDag-Erling SmørgravIf the file already exists locally and has the same size and 120b39628e7SDag-Erling Smørgravmodification time as the remote file, it will not be fetched. 1216b5c2db2SJordan K. Hubbard.It Fl n 122b39628e7SDag-Erling SmørgravDon't preserve the modtime of the transfered file, use the current 123b39628e7SDag-Erling Smørgravtime. 12478be3199SGarrett Wollman.It Fl o Ar file 12578be3199SGarrett WollmanSet the output file name to 12678be3199SGarrett Wollman.Ar file . 12778be3199SGarrett WollmanBy default, a ``pathname'' is extracted from the specified URI, and 128b39628e7SDag-Erling Smørgravits basename is used as the name of the output file. 129b39628e7SDag-Erling SmørgravA 13078be3199SGarrett Wollman.Ar file 13178be3199SGarrett Wollmanargument of 13278be3199SGarrett Wollman.Sq Li \&- 13378be3199SGarrett Wollmanindicates that results are to be directed to the standard output. 1347fefc698SJordan K. Hubbard.It Fl P 1357fefc698SJordan K. Hubbard.It Fl p 136b39628e7SDag-Erling SmørgravUse passive FTP. 137b39628e7SDag-Erling SmørgravThis is useful if you are behind a firewall which blocks incoming 138b39628e7SDag-Erling Smørgravconnections. 139b39628e7SDag-Erling SmørgravTry this flag if 140b39628e7SDag-Erling Smørgrav.Nm 141b39628e7SDag-Erling Smørgravseems to hang when retrieving FTP URLs. 14278be3199SGarrett Wollman.It Fl q 14387faa07bSSheldon HearnQuiet mode. 144b39628e7SDag-Erling SmørgravThis works by setting the verbosity level to zero; see the 145b39628e7SDag-Erling Smørgrav.Fl v 146b39628e7SDag-Erling Smørgravoption. 14778be3199SGarrett Wollman.It Fl R 148b39628e7SDag-Erling SmørgravThe output files are precious, and should not be deleted under any 149b39628e7SDag-Erling Smørgravcircumstances, even if the transfer failed or was incomplete. 15078be3199SGarrett Wollman.It Fl r 15178be3199SGarrett WollmanRestart a previously interrupted transfer. 1520637c2ccSJordan K. Hubbard.It Fl S Ar bytes 153b39628e7SDag-Erling SmørgravRequire the file size reported by the server to match the specified 154b39628e7SDag-Erling Smørgravvalue. 155b39628e7SDag-Erling SmørgravIf it does not, a message is printed and the file is not fetched. 156b39628e7SDag-Erling SmørgravIf the server does not support reporting file sizes, this option is 157b39628e7SDag-Erling Smørgravignored and the file is fetched unconditionally. 158b451f452SMartin Cracauer.It Fl s 159b39628e7SDag-Erling SmørgravPrint the size in bytes of each requested file, without fetching it. 160fc6fcbf9SJordan K. Hubbard.It Fl T Ar seconds 161fc6fcbf9SJordan K. HubbardSet timeout value to 162fc6fcbf9SJordan K. Hubbard.Ar seconds. 163a43a248cSPeter WemmOverrides the environment variables 164fc6fcbf9SJordan K. Hubbard.Ev FTP_TIMEOUT 165b39628e7SDag-Erling Smørgravfor FTP transfers or 166a43a248cSPeter Wemm.Ev HTTP_TIMEOUT 167b39628e7SDag-Erling Smørgravfor HTTP transfers if set. 1689f63f2aaSDag-Erling Smørgrav.It Fl t 1699f63f2aaSDag-Erling SmørgravWork around a different set of buggy 1709f63f2aaSDag-Erling Smørgrav.Tn TCP 1719f63f2aaSDag-Erling Smørgravimplementations. 1727ae26f14SJordan K. Hubbard.It Fl v 173b39628e7SDag-Erling SmørgravEach instance of this flag increases the verbosity level by one. 174b39628e7SDag-Erling SmørgravLevel one (the default) only gives a summary after each file; level 175b39628e7SDag-Erling Smørgravtwo show a running count during the transfer, provided that the 176b39628e7SDag-Erling Smørgravstandard output goes to a terminal; level three enables messages from 177b39628e7SDag-Erling Smørgravthe 178b39628e7SDag-Erling Smørgrav.Xr fetch 3 179b39628e7SDag-Erling Smørgravlibrary. 180b39628e7SDag-Erling Smørgrav.It Fl w Ar seconds 181b39628e7SDag-Erling SmørgravWhen the 182b39628e7SDag-Erling Smørgrav.Fl a 183b39628e7SDag-Erling Smørgravflag is specified, wait this many seconds between successive retries. 1847fefc698SJordan K. Hubbard.El 185b39628e7SDag-Erling Smørgrav.Sh DIAGNOSTICS 18676dafb89SGarrett WollmanThe 18776dafb89SGarrett Wollman.Nm 188b39628e7SDag-Erling Smørgravcommand returns zero on success, or one on failure. 189b39628e7SDag-Erling SmørgravIf multiple URLs are listed on the command line, 19076dafb89SGarrett Wollman.Nm 191b39628e7SDag-Erling Smørgravwill attempt to retrieve them each of them in turn, and return zero 192b39628e7SDag-Erling Smørgravonly if they were all successfully retrieved. 1937fefc698SJordan K. Hubbard.Sh ENVIRONMENT 19478be3199SGarrett Wollman.Bl -tag -width FTP_PASSIVE_MODE -offset indent 19578be3199SGarrett Wollman.It Ev FTP_TIMEOUT 19678be3199SGarrett Wollmanmaximum time, in seconds, to wait before aborting an 19778be3199SGarrett Wollman.Tn FTP 19878be3199SGarrett Wollmanconnection. 19976dafb89SGarrett Wollman.It Ev HTTP_TIMEOUT 20076dafb89SGarrett Wollmanmaximum time, in seconds, to wait before aborting an 20176dafb89SGarrett Wollman.Tn HTTP 20276dafb89SGarrett Wollmanconnection. 203b39628e7SDag-Erling Smørgrav.El 204b39628e7SDag-Erling Smørgrav.Pp 205b39628e7SDag-Erling SmørgravAll environment variables mentioned in the documentation for the 206b39628e7SDag-Erling Smørgrav.Xr fetch 3 207b39628e7SDag-Erling Smørgravlibrary are supported. 2087fefc698SJordan K. Hubbard.Sh SEE ALSO 209b39628e7SDag-Erling Smørgrav.Xr fetch 3 2107fefc698SJordan K. Hubbard.Sh HISTORY 2117fefc698SJordan K. HubbardThe 212b39628e7SDag-Erling Smørgrav.Nm 21385cf659aSMike Pritchardcommand appeared in 21485cf659aSMike Pritchard.Fx 2.1.5 . 215b39628e7SDag-Erling SmørgravThis implementation first appeared in 216b39628e7SDag-Erling Smørgrav.Fx 4.1 . 21778be3199SGarrett Wollman.Sh AUTHORS 21878be3199SGarrett WollmanThe original implementation of 21978be3199SGarrett Wollman.Nm 220306005e7SPhilippe Charnierwas done by 221306005e7SPhilippe Charnier.An Jean-Marc Zucconi . 222306005e7SPhilippe CharnierIt was extensively re-worked for 223bc5d5816SWolfram Schneider.Fx 2.2 224306005e7SPhilippe Charnierby 225b39628e7SDag-Erling Smørgrav.An Garrett Wollman , 226b39628e7SDag-Erling Smørgravand later completely rewritten to use the 227b39628e7SDag-Erling Smørgrav.Xr fetch 3 228b39628e7SDag-Erling Smørgravlibrary by 229b39628e7SDag-Erling Smørgrav.An Dag-Erling Sm�rgrav . 230b39628e7SDag-Erling Smørgrav.Sh NOTES 2312494e810SGarrett WollmanThe 2320c8cc99eSGarrett Wollman.Fl b 233b39628e7SDag-Erling Smørgravand 234b39628e7SDag-Erling Smørgrav.Fl t 235b39628e7SDag-Erling Smørgravoptions are no longer supported and will generate warnings. 236b39628e7SDag-Erling SmørgravThey were workarounds for bugs in other OSes which this implementation 237b39628e7SDag-Erling Smørgravdoes not trigger. 238c1468430SGarrett Wollman.Pp 239047843ddSDag-Erling SmørgravOne cannot both use the 240047843ddSDag-Erling Smørgrav.Fl h , 241047843ddSDag-Erling Smørgrav.Fl c and 242b39628e7SDag-Erling Smørgrav.Fl f 243047843ddSDag-Erling Smørgravoptions and specify URLs on the command line. 244