History log of /freebsd-current/lib/libfetch/file.c
Revision Date Author Comments
# a2f733ab 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

lib: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 5e53a4f9 25-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

lib: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# 65380b5f 25-May-2016 Don Lewis <truckman@FreeBSD.org>

Call closedir() before returning from fetchListFile() to avoid a leak.

Reported by: Coverity
CID: 1016697
MFC after: 1 week


# 88190032 15-Oct-2015 Dag-Erling Smørgrav <des@FreeBSD.org>

Use fopen()'s newfangled "e" flag instead of explicit fcntl() calls.

PR: 199801
Submitted by: Jukka Ukkonen <jau@iki.fi>
MFC after: 1 week


# 42415fcb 13-Sep-2012 Eitan Adler <eadler@FreeBSD.org>

Adding missing return statements during error conditions.

PR: kern/171187
Submitted by: Mark Johnston <markjdb@gmail.com>
Reviewed by: des
Approved by: cperciva
MFC after: 2 weeks


# 578153f1 19-Oct-2011 Dag-Erling Smørgrav <des@FreeBSD.org>

latin1 -> utf8


# 6337341d 27-Sep-2011 Dag-Erling Smørgrav <des@FreeBSD.org>

Update copyright dates and strip my middle name.


# 15b68c63 13-May-2011 Dag-Erling Smørgrav <des@FreeBSD.org>

Mark all socket and file descriptors close-on-exec.

PR: bin/151866
MFC after: 3 weeks


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# a1b37df2 14-Dec-2007 Dag-Erling Smørgrav <des@FreeBSD.org>

Clean up namespace violations.

MFC after: 1 week


# 2cbbf9da 21-Sep-2004 Dag-Erling Smørgrav <des@FreeBSD.org>

Update copyright years.


# 930105c1 28-Jan-2003 Dag-Erling Smørgrav <des@FreeBSD.org>

style(9): add parentheses to sizeof even when not strictly required.

MFC after: 3 days


# e19e6098 05-Feb-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Reindent, and add parentheses to return statements. Some functions in
ftp.c and http.c now have exceedingly long lines due to deep nesting;
this will be corrected by reorganizing the code in a later revision.


# cecb889f 30-Sep-2001 Matthew Dillon <dillon@FreeBSD.org>

Add __FBSDID()s to libfetch


# 98b8c4cb 04-Sep-2001 Dag-Erling Smørgrav <des@FreeBSD.org>

Use fseeko() instead of fseek() (u->offset is already an off_t), and mark
some function arguments as unused.


# 2b26f942 26-May-2001 Dag-Erling Smørgrav <des@FreeBSD.org>

MAXPATHLEN -> PATH_MAX


# 38c7e4a6 23-Apr-2001 Archie Cobbs <archie@FreeBSD.org>

Apply 'const' liberally.

Fix some other minor glitches.


# d74a913b 29-Oct-2000 Dag-Erling Smørgrav <des@FreeBSD.org>

Use CHECK_FLAG


# 1a5faa10 17-Jul-2000 Dag-Erling Smørgrav <des@FreeBSD.org>

Introduce fetchXGet*(), which combine the functionalities of fetchGet*() and
fetchStat*(). In most cases, either fetchGet*() or fetchXGet*() is a wrapper
around the other; in all cases, calling fetchGet*() is identical to calling
fetchXGet*() with the second argument set to NULL.


# 7a5b4b1b 15-May-2000 Dag-Erling Smørgrav <des@FreeBSD.org>

Initialize the struct url_stat at the beginning of _fetch_stat_file().


# 5ff28c82 07-May-2000 Dag-Erling Smørgrav <des@FreeBSD.org>

Implement restart


# f5f109a0 07-Jan-2000 Dag-Erling Smørgrav <des@FreeBSD.org>

Patches I've had lying around for several months:
* Add the 'h' ftp flag (allocate local port in high range)
* Add the 'd' flag (use direct connection even if proxy is defined)
* Make sure flags != NULL before calling strchr().
* Minor changes to some comments.


# 7f3dea24 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# ce71b736 21-Dec-1998 Dag-Erling Smørgrav <des@FreeBSD.org>

Implement and document file list retrieval.


# 0fba3a00 16-Dec-1998 Dag-Erling Smørgrav <des@FreeBSD.org>

Add verbose flag, and support functions.
Brucify the Makefile.
Differentiate atime and mtime in fetch*Stat().
Fix a few pointer bugs.
Tweak some error messages.
Don't #include sys/param.h and stdio.h in fetch.h.
Document that sys/param.h and stdio.h must be #included before fetch.h.


# d8acd8dc 06-Nov-1998 Dag-Erling Smørgrav <des@FreeBSD.org>

Second of a series of cleanups to libfetch.

This commit introduces the following features:

a) the fetchStat*() functions, which return meta-information for a
document, such as size, modification time, etc.

b) the use of the com_err(3) facilities to report errors.

It also fixes a bunch of style bugs and a few logic bugs and somewhat
improves the man page.

Changed files, in alphabetical order:

Makefile:
Don't generate macros in {ftp,http}err.c.

Generate category fields for the error message lists.

Compile the error table.

Install fetch_err.h along with fetch.h.

common.c:
Remove the _netdb_errstring() macro, and add FETCH_ERR_NETDB to the
error code in the _netdb_seterr() macro.

Add categories to the _netdb_errlist table.

Report errors through the Common Error library.

common.h:
Add the DEBUG macros.

Add prototype for fetchConnect().

Remove the prototype for _fetch_errstring(), which is local to common.c

Add a categroy field to struct fetcherr, and define constants for
error categories.

Define macros for _{url,netdb,ftp,http}_seterr().

errors.et: (new file)
List error categories.

fetch.3:
Document the fetchStat*() functions.

Move the "unimplemented functionality" comments from NOTES to BUGS.

Document that applications which use libfetch must also use
libcom_err, and list existing error codes.

Undocument fetchLastErr{Code,String}.

Remove the (empty) DIAGNOSTICS section.

Mention Eugene Skepner in the AUTHORS section.

fetch.c:
Move the DEBUG macros to common.c

Add fetchStat() and fetchStatURL().

Generate error messages for URL parser errors, and fix a minor bug
in the parser.

Use 'struct url' instead of 'url_t'.

Remove fetchLastErr{Code,String}.

fetch.h:
Use 'struct url' instead of 'url_t', and remove the typedef.

Define struct url_stat (used by fetchStat()).

Add prototypes for fetchStat*().

Remove the declarations for fetchLastErr{Code,String}.

Include fetch_err.h.

fetch_err.et: (new file)
Error table for libfetch.

file.c:
Add fetchStatFile().

Use 'struct url' instead of 'url_t'.

ftp.c:
Add fetchStatFTP().

Use 'struct url' instead of 'url_t'.

Don't use fetchLastErrCode.

ftp.errors:
Add categories to all error messages.

http.c:
Add fetchStatHTTP().

Use 'struct url' instead of 'url_t'.

Don't use fetchLastErr{Code,Text}.

http.errors:
Add categories to all error messages.

Prompted by: jkh and Eugene Skepner
Numerous sugestions from: Garett Wollman and Eugene Skepner


# 4ca1ab94 09-Jul-1998 Dag-Erling Smørgrav <des@FreeBSD.org>

Imported libfetch into the tree. It compiles, but there's still some
work to do. I especially need help with the man page.