Commit Graph

282 Commits

Author SHA1 Message Date
Ed Schouten
b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Ruslan Ermilov
8181961a73 Treat an empty argument as an error, instead of fetching the
contents of the root directory.

MFC after:	1 week
2009-12-30 23:01:49 +00:00
Xin LI
821df508e8 Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
Xin LI
6f2d322192 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00
Dag-Erling Smørgrav
3187195884 The FTP_TIMEOUT and HTTP_TIMEOUT environment variables were ignored because
T_secs already had a non-zero default.  Unbreak by moving the default to
ftp_timeout / http_timeout.

Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
MFC after:	2 weeks
2009-01-17 13:34:56 +00:00
Murray Stokely
e8f612b687 1. Update fetch to consistently return 1 on error, as the man page states,
rather than usually returning 1 but in a few instances using a sysexits(3)
   return value.

2. Remove a few unused variables from libfetch.

PR:		docs/122470  (1, only)
Reviewed by:	des
2008-12-17 18:00:18 +00:00
Murray Stokely
7f92799f67 Add support for HTTP 1.1 If-Modified-Since behavior.
fetch(1) accepts a new argument -i <file> that if specified will cause
the file to be downloaded only if it is more recent than the mtime of
<file>.

libfetch(3) accepts the mtime in the url structure and a flag to
indicate when this behavior is desired.

PR:		bin/87841
Submitted by:	Jukka A. Ukkonen <jau@iki.fi> (partially)
Reviewed by:	des, ru
MFC after:	3 weeks
2008-12-15 08:27:44 +00:00
Ruslan Ermilov
e801aa4856 Improve usage and sync SYNOPSIS with usage. 2008-12-13 17:48:06 +00:00
Dag-Erling Smørgrav
2b8907e7e2 Apply the same defaults to https as to http.
Submitted by:	Mike Tancsa <mike@sentex.net>
MFC after:	1 week
2008-12-11 06:54:36 +00:00
David E. O'Brien
8acee1c0ca Use the SCHEME_ knobs rather than knowing what they expand to.
Reviewed by:	des
2008-08-21 14:12:34 +00:00
Dag-Erling Smørgrav
0fc781ff32 List all environment variables supported by libfetch, along with a reference
to the fetch(3) man page.

MFC after:	1 week
2007-12-28 19:47:37 +00:00
Dag-Erling Smørgrav
1bac3abc07 Try to preserve ownership and permissions when replacing an existing file.
PR:		bin/104702
Submitted by:	Kevin Day <toasty@dragondata.com>
MFC after:	1 week
2006-11-10 22:05:41 +00:00
Joseph Koshy
ee8e4b36bb Fix a typo.
Submitted by:	Pawel Worach <pawel.worach at gmail dot com>
MFC after:	1 week
2006-04-22 03:04:24 +00:00
Ruslan Ermilov
e1fe3dba5c Reimplementation of world/kernel build options. For details, see:
http://lists.freebsd.org/pipermail/freebsd-current/2006-March/061725.html

The src.conf(5) manpage is to follow in a few days.

Brought to you by:	imp, jhb, kris, phk, ru (all bugs are mine)
2006-03-17 18:54:44 +00:00
Dag-Erling Smørgrav
15e2d64e15 Only clear sb.st_size if it is clearly wrong or meaningless. This fixes
mirror mode.

PR:		bin/86940
MFC after:	2 weeks
2005-12-30 23:36:26 +00:00
Dag-Erling Smørgrav
0c87874496 Reflect progress in process title.
Submitted by:	flz
MFC after:	2 weeks
2005-12-30 18:17:11 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ruslan Ermilov
6c7216df78 Sort sections. 2005-01-18 13:43:56 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Ruslan Ermilov
a216173556 NOCRYPT -> NO_CRYPT 2004-12-21 10:16:04 +00:00
Colin Percival
8c355b0889 Fix buffer overflow. This is FreeBSD-SA-04:16.fetch.
Approved by:	des
2004-11-18 12:01:30 +00:00
Dag-Erling Smørgrav
2cbbf9dac9 Update copyright years. 2004-09-21 18:35:21 +00:00
Dag-Erling Smørgrav
44336f2f9c The check for r_flag was accidentally removed in the previous commit.
Submitted by:	SANETO Takanori <sanewo@ba2.so-net.ne.jp>
MFC after:	3 days
2004-08-26 15:51:10 +00:00
Dag-Erling Smørgrav
13901dd25a Fix a couple of edge cases in which sb.st_size may be incorrect or
meaningless.  In particular, don't assume that it is left untouched if
stat(2) fails; that assumption happens to fail at high optimization
levels on some platforms.

MFC after:	1 week
2004-08-15 22:22:35 +00:00
Colin Percival
d37df47d31 Join the 21st century: Cryptography is no longer an optional component
of releases.  The -DNOCRYPT build option still exists for anyone who
really wants to build non-cryptographic binaries, but the "crypto"
release distribution is now part of "base", and anyone installing from a
release will get cryptographic binaries.

Approved by:	re (scottl), markm
Discussed on:	freebsd-current, in late April 2004
2004-08-06 07:27:08 +00:00
Colin Percival
fe6a04858c Document the behaviour of the "-o file" option when "file" is a directory
(downloaded file(s) are created inside the directory).

MFC after:	3 days
2004-07-30 08:43:16 +00:00
Dag-Erling Smørgrav
e9aa05f18c Don't strip trailing linear whitespace from passwords.
MFC after:	2 weeks
2004-07-27 11:34:25 +00:00
Dag-Erling Smørgrav
ebeb3bab5b Style nits. 2004-07-27 11:30:35 +00:00
Dag-Erling Smørgrav
c8488e24e7 Truncate long file names in stat_display(), as was originally intended.
MFC after:	1 week
2004-07-05 11:21:50 +00:00
Dag-Erling Smørgrav
adce61f9b4 The description of the -S option in the man page says we won't fail if the
remote size is unknown, but we do.  Resolve this in the man page's favor.

Requested by:   Andre Albsmeier <andre.albsmeier@siemens.com>
MFC after:	1 week
2004-06-24 13:43:57 +00:00
Lukas Ertl
be28a6af38 Fix integer overflow in the file size output when dealing with
large files (i.e. DVD images).

Reviewed by:  des@
2004-05-19 11:07:30 +00:00
Ruslan Ermilov
4bdd89ba98 Restore part of the word that got (accidentally) removed.
Removed whitespace at EOL.
2004-05-19 09:46:37 +00:00
Dag-Erling Smørgrav
3d49384208 Workaround for servers that ignore byte ranges when using chunked
encoding.

MFC after:	3 days
2004-04-06 12:24:26 +00:00
Dag-Erling Smørgrav
ac9fd74eb1 Remove EXAMPLES section which duplicates text in fetch(3). 2004-02-27 10:27:01 +00:00
Dag-Erling Smørgrav
5476ba5545 Use %zu for size_t, like God intended. 2004-02-18 21:51:02 +00:00
Dag-Erling Smørgrav
eae1afd9a2 Fix printf() format bug in previous commit (size_t != int).
Use %ju and an (uintmax_t) cast to print size_t values.
Use %jd and an (intmax_t) cast to print off_t values.
Use off_t variables to hold the difference between two off_t values.
Don't bother with unsigned char where char will do nicely.
2004-02-18 21:37:36 +00:00
Dag-Erling Smørgrav
3f59deafb3 Revamp the statistics code, and switch to a much more compact display
format.  The old code tried to produce the exact same output as the
pre-libfetch implementation, but I no longer see any value in this.
2004-02-18 15:12:00 +00:00
Wes Peters
fbcf5e6575 Remove the inadvertant HTML additions to this man page.
These appear to have been inserted in the PR text by gnatsweb.

Noticed by:		des (maintainer)
2004-01-28 18:51:24 +00:00
Wes Peters
09d2d42edd Revert changes of rev 1.55; replace with strong encouragement to
read fetch(3) as well.

Requested by:	des (maintainer)
2004-01-26 07:55:30 +00:00
Dag-Erling Smørgrav
90ffd7ea34 Previous commit did the reverse of what the log message said (and of
what I intended to do).  Really remove my middle name.
2004-01-26 07:09:12 +00:00
Dag-Erling Smørgrav
09e0653941 I don't normally use my middle name, so remove it from attributions in
man pages (though not from copyright notices).  While I'm here, add email
addresses where appropriate.
2004-01-25 11:39:42 +00:00
Wes Peters
cec5287b4d Document fetch(1) environment variables in fetch(1) man page, instead of
taking lazy users on the arduous journey through SEE ALSO to fetch(3).

PR:		docs/61759
Submitted by:	Christian S.J. Peron <maneo@bsdpro.com>
2004-01-23 04:50:48 +00:00
Ruslan Ermilov
6ce729e14d Finish the reversion of rev. 1.52. 2003-09-08 18:58:47 +00:00
Ruslan Ermilov
36317d686a Make sure the crypto versions of libfetch and fetch(1) appear in
the "crypto" distribution.

Approved by:	des
2003-07-22 13:54:31 +00:00
Tom Rhodes
fa676bbfc8 Revert 1.52. This should have been added to fetch.3.
Discussed with:	des, ru
2003-06-10 20:34:50 +00:00
Dag-Erling Smørgrav
7691f66abf Retire the useless NOSECURE knob.
Approved by:	re (scottl)
2003-05-19 15:52:01 +00:00
Tom Rhodes
ac6bad097f Add an EXAMPLES section.
Xref sh(1) as we use environment variables.

PR:		43899
Reviewed by:	des
2003-05-17 15:46:46 +00:00
Dag-Erling Smørgrav
b06d75fd43 Mark fetch(1) as c99- and WARNS6-clean. 2003-05-01 14:40:55 +00:00
Dag-Erling Smørgrav
b12d1620fb Use floating point arithmetic to compute the ETA to avoid integer overflow
during slow transfers of large files.
2003-03-11 21:33:43 +00:00
Dag-Erling Smørgrav
29568c0191 Clean up the ETA logic a bit and make sure it works for restarted transfers. 2003-03-11 08:21:51 +00:00
Dag-Erling Smørgrav
1bbb80b674 Clarify that -r implies -R. 2003-03-11 08:21:16 +00:00
Ruslan Ermilov
ace5be682d mdoc(7) police: Scheduled sweep. 2003-02-24 22:53:26 +00:00
Dag-Erling Smørgrav
32c8cd2915 Slight cleanup of the ETA / BPS code. Avoid a division by zero. 2003-01-23 13:06:13 +00:00
Dag-Erling Smørgrav
7dcb0a0e83 Document netrc support. 2003-01-22 18:35:20 +00:00
Dag-Erling Smørgrav
13da7d9934 Add -N option to specify a netrc file.
Fix handling of -v option.
Don't treat negative offsets as valid positive ones.
Clean up the ETA and transfer rate code.  Show transfer rate along with
ETA if the verbose level is higher than 1.
2003-01-22 18:33:39 +00:00
Dag-Erling Smørgrav
3d7c408ce4 Use the URL instead of the output file name when reporting errors relating
to the remote document.

PR:		33856
MFC after:	1 week
Approved by:	re
2002-11-27 20:52:07 +00:00
Dag-Erling Smørgrav
a6266f245c Don't set atime / mtime if we don't have an output file, which can happen
in certain failure scenarii (mostly DNS trouble).
2002-11-13 16:04:20 +00:00
Bill Fenner
f10d3c5113 Don't divide by zero to calculate the ETA, even if we haven't gotten
any data in 30 seconds.
2002-11-12 07:09:43 +00:00
Bill Fenner
05f45e0c2c Don't exit with success after timeout during authentication. 2002-11-07 22:16:45 +00:00
Dag-Erling Smørgrav
75c3973ab8 Clarify my feelings towards fetch / libfetch. 2002-10-30 04:53:58 +00:00
Dag-Erling Smørgrav
eb87c5a73a Don't complain about not knowing the remote file size when working in
quiet mode.

PR:		bin/37079
Submitted by:	Nicolas Rachinsky <list@rachinsky.de>
2002-10-27 17:33:08 +00:00
Dag-Erling Smørgrav
97727a7dc1 Whitespace and indentation cleanup. 2002-10-27 15:32:51 +00:00
Dag-Erling Smørgrav
0c6d34af10 Forgot to disable alarms after fetchXGet() in previous commit. 2002-10-27 15:32:06 +00:00
Dag-Erling Smørgrav
dc161d5582 Add an ETA timer that kicks in after 30 seconds.
Re-add alarm(2) calls around the calls to fetchStat(3) and fetchXGet(3),
since these calls can still time out on DNS lookups or TCP connect(2).

Remove the alarm(2) calls in the main loop, since all methods properly
handle transfer timeouts (as opposed to connection timeouts).

Set the sigalrm flag if a timeout occurs in the main loop.

Move the signal: label up a little so we still set the atime and mtime
when the transfer times out or is interrupted, so that restarted transfers
will work as expected (as long as the file still exists).

MFC after:	2 weeks
2002-10-27 15:15:13 +00:00
Dag-Erling Smørgrav
dacff75286 s/optarg/s/ (cut'n'paste braino)
Spotted by:	kris
2002-08-27 10:19:24 +00:00
Dag-Erling Smørgrav
35945a74ac fetch(1) is WARNS-5 clean (tested on i386 and Alpha) 2002-07-28 21:09:57 +00:00
Dag-Erling Smørgrav
32411a1b6f Use strtol(3) instead of a home-grown version, and fix a "possibly
unitialized variable" warning.
2002-07-28 21:09:25 +00:00
Dag-Erling Smørgrav
6414f0b970 Reorder LDADD to fix static linking. 2002-06-12 12:46:50 +00:00
Ruslan Ermilov
4093807dd9 libfetch now depends on libcrypto and libssl. 2002-06-06 13:45:46 +00:00
Dag-Erling Smørgrav
1bf28f7e94 Figures they had to call it NOCRYPT instead of NOCRYPTO. 2002-06-05 21:28:47 +00:00
Dag-Erling Smørgrav
d9615d7da4 During buildworld, "regular" libraries are built before crypto stuff, so
libfetch can't depend on lib{crypto,ssl}.  Move the dependency to fetch
until we can figure out how to fix this.
2002-06-05 21:25:33 +00:00
Dag-Erling Smørgrav
d397408818 Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.
2002-04-22 13:44:47 +00:00
Philippe Charnier
3898680cf7 Use `The .Nm utility' 2002-04-19 23:44:58 +00:00
Bruce Evans
05eb035898 Restored the part of 1.45 that was clobbered in rev.1.46:
#include <sys/time.h> instead of depending on namespace pollution in
<sys/stat.h> for the declaration of struct timeval.
2002-03-27 02:23:18 +00:00
Philippe Charnier
15baa31aad Add FBSDID. Remove unused include. Getopt returns -1 not EOF. 2002-03-26 12:09:49 +00:00
Bruce Evans
469a45700c #include <sys/time.h> instead of depending on namespace pollution in
<sys/stat.h> for the declaration of struct timeval.

Removed unused includes (<time.h> doesn't declare anything of interest;
only <sys/time.h> does).

Sorted includes a bit.
2002-02-25 05:00:39 +00:00
Dag-Erling Smørgrav
8e7cf3debf If downloading to a temporary file, set the timestamp on the temp file, not
on the file we're replacing.

PR:		bin/34992
Submitted by:	Shunichiro Ariura <syun1rou@blackshell.org>
MFC after:	1 week
2002-02-16 14:02:57 +00:00
Mark Murray
91bd71d206 Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.
2002-02-08 22:31:43 +00:00
Ruslan Ermilov
ab47d79913 Document fetch(1) reaction to SIGINFO.
PR:		docs/33640
Submitted by:	Maxim Konovalov <maxim@macomnet.ru>
Approved by:	des
2002-01-16 16:16:08 +00:00
Dag-Erling Smørgrav
62f6d0b88e Set fetchDebug if v_level is 3 or more.
PR:		bin/32615
MFC after:	1 week
2001-12-09 15:07:26 +00:00
Ian Dowse
650b9e0ed5 Remove an extraneous argument to fprintf that -Wformat noticed.
Reviewed by:	des
2001-11-10 18:39:54 +00:00
Dag-Erling Smørgrav
f2a871e75b Remove a debugging warnx() that got committed by mistake. 2001-11-03 01:31:46 +00:00
Dag-Erling Smørgrav
dbcc198301 Don't print running stats unless we're the foreground process.
PR:		30764
2001-09-23 22:03:39 +00:00
Mike Barcroft
1c93d61fcc Add a cast to silence a warning (error because of WARNS=2) on Alpha.
Discussed with:	des
2001-09-10 17:23:57 +00:00
Dag-Erling Smørgrav
e9dc4f3b74 If the local file does not exist, or is a regular file, and we're not trying
to resume a transfer, download the requested document into a temporary file
which we later rename.  This avoids leaving half-completed files around in
case of a crash (it'll still leave a half-completed file, but with a  hope-
fully non-conflicting name), and should reduce the need for human inter-
vention on ports-building machines.

The temporary file name for "foo/bar" is constructed by invoking mkstemps()
with the pattern "foo/.fetch.XXXXXX.bar"

Requested by:	obrien
2001-09-08 15:17:15 +00:00
Dag-Erling Smørgrav
eab5a80417 Remove a blank line that snuck in with the previous commit.
Set the default timeout to 120 seconds instead of 0 (no timeout).
2001-08-18 10:48:55 +00:00
Dag-Erling Smørgrav
db695db7f0 Add some comments. 2001-08-17 22:22:45 +00:00
Stefan Eßer
6d64e93980 Include value of command line argument that causes an error message or
warning in said message, since fetch may be run from a makefile or script
which does not print the command line.

Approved by:	des
2001-07-28 21:34:56 +00:00
Dag-Erling Smørgrav
04d12c9900 If we're writing to stdout, we don't care about the size.
Submitted by:	wollman
2001-07-17 21:23:43 +00:00
Dag-Erling Smørgrav
91404f38f0 WARNS cleanup + remove an unused macro and an unused function argument. 2001-07-17 21:22:32 +00:00
Dima Dorfman
f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Dag-Erling Smørgrav
74bd3d7698 Fix an embarassing if-test-reversal bug that broke scheme guessing. 2001-07-08 15:17:26 +00:00
Dag-Erling Smørgrav
1a4a063934 Don't try to print a completion percentage for zero-size files.
PR:		27780
Submitted by:	Craig Leres <leres@ee.lbl.gov>
2001-06-01 10:24:58 +00:00
Dag-Erling Smørgrav
5ef824ed2b Damn. Fix typo in previous commit. 2001-05-27 10:46:19 +00:00
Dag-Erling Smørgrav
0d60c7099d When running on a tty, install an authentication callback. 2001-05-26 19:51:05 +00:00
Dag-Erling Smørgrav
dde0dff6dc Bring the usage message in synch with reality.
PR:		bin/26160
2001-03-28 21:01:07 +00:00
Dag-Erling Smørgrav
7c480c6c77 Now that libfetch uses the high port range by default, add a -U option to
make it use the low (default) port range instead.
2001-03-24 00:32:11 +00:00
Dag-Erling Smørgrav
cd400b67a4 If SIGINFO is received during the transfer, print a status line similar
to the summary shown at the end of the transfer.

Some days, I really hate Unix...

Suggested by:	cracauer
2001-03-07 05:33:50 +00:00
Dag-Erling Smørgrav
150fb21bf8 Fix a formatting bug (MFC candidate) 2001-03-07 03:22:11 +00:00
Ruslan Ermilov
d0353b836e mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:38:02 +00:00