History log of /freebsd-10.1-release/bin/cat/cat.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 249804 23-Apr-2013 eadler

- Add the __dead2 attribute since it is a function that never returns
- Add an empty line in usage() according to style(9)

PR: bin/177076
Submitted by: Fernando <fernando.apesteguia@gmail.com>
Approved by: cperciva (mentor)


# 246083 29-Jan-2013 brooks

Add -l option to cat(1). This option causes cat(1) to use fcntl(2) to
set an exclusive advisory lock on stdout. This will be used to guarantee
orderly writing to METALOG.

Sponsored by: DARPA, AFRL
Obtained from: NetBSD (mason)


# 238653 20-Jul-2012 jh

Use proper error message when fstat(2) fails on stdout.

PR: bin/159746
Submitted by: Alex K.


# 238652 20-Jul-2012 jh

style(9).


# 226961 31-Oct-2011 ed

Put some static keywords in the source code.

For these simple utilities, it doesn't harm to make all global variables
static. In fact, this allows the compiler to perform better forms of
optimisation and analysis.


# 184471 30-Oct-2008 ivoras

Teach cat(1) and cp(1) to use a larger buffer if enough memory is present
in the system. A simple heuristics is used to detect what is "enough"
memory: if number of physmem pages is greater than 32k (equalling 128 MB
on machines with 4 kB pages).

Typical immediate result of these changes is reduction in context switches
and the goal is to increase efficiency by using large buffers:
before: /usr/bin/time -hlp cat file1 > file2
...
163 voluntary context switches
11194 involuntary context switches
after: /usr/bin/time -hlp ./cat file1 > file2
...
417 voluntary context switches
272 involuntary context switches

Reviewed by: hackers@ (no objections to earlier version of cat patch)
Approved by: gnn (mentor)
MFC after: 4 months


# 139969 10-Jan-2005 imp

/*- or .\"- or #- to begin license clauses.


# 132433 20-Jul-2004 tjr

Use warn() instead of perror().


# 127958 06-Apr-2004 markm

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# 114301 30-Apr-2003 obrien

We have to hide copyright[] for gcc33. :-(


# 105781 23-Oct-2002 markm

Be consistent about declaring a function "static", and consistent
about the type of argv.


# 101092 31-Jul-2002 markm

Give lint a small bit of help.


# 99109 30-Jun-2002 obrien

Consistently use __FBSDID


# 99022 29-Jun-2002 tjr

Avoid truncating the pathname to UNIX Domain Sockets with snprintf(),
giving a more sensible warning when the (relatively meagre) sun_path
limit is exceeded.


# 98216 14-Jun-2002 jmallett

Use an usage() rather than doing the fprintf inside option parsing.


# 98169 13-Jun-2002 tjr

Print the "$" symbol on blank lines when the -s and -e options are used
together.

Obtained from: OpenBSD (millert, Denis Afonin)


# 98168 13-Jun-2002 tjr

Remove bogus "-" operand from usage message. There is no restriction on
where it may be placed, it is treated the same as the file arguments.


# 91079 22-Feb-2002 markm

Fix warnings inspired by lint, a commercial lint and WARNS=4.


# 90106 02-Feb-2002 imp

Drag cat(1) kicking and screaming into the late 1980's:

o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.

Approved by: arch@, new style(9)


# 83962 26-Sep-2001 ru

WARNSify.


# 83961 26-Sep-2001 ru

The "cat - -" feature was broken by the last commit.
Restore the code that avoided closing and reopening
stdin. This is also required by POSIX. As a bonus,
enable multiple stdin reads with the -benstv flags,
by resetting the EOF condition on stdin.


# 83482 14-Sep-2001 dillon

Give /bin/cat the ability to connect to and read unix-domain sockets

MFC after: 1 week


# 78732 24-Jun-2001 dd

Include missing header files which define functions for which gcc has
builtins (e.g., exit, strcmp).


# 59239 14-Apr-2000 asmodai

Sync us up to OpenBSD's cat.1 v1.18 and cat.c v1.9.

This gets rid of a bogus cast of NULL in setbuf().
Lets us know the buffer malloc failed.

Reworks the manpage a bit to make it more mdoc(7) compliant, adds
examples.


# 50471 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 39138 13-Sep-1998 imp

Fix minor style bugs noticed by the Bruce Filter.[tm]

Bruce-Filter-By: bde


# 39065 11-Sep-1998 imp

Silence -Wall -W -Wkitchen-sink. Use ssize_t in preference to int,
make a char * const that should have been. Use new style function
declaration for main. Mostly a Bruce Filter[tm] test commit.


# 36000 13-May-1998 charnier

Restore Lite2 sccsids by removing `const'. Improve documentation a little.
Suggested by: Bruce


# 35772 06-May-1998 charnier

Correct use of .Nm, .An and other cosmetics. Add rcsid. Remove unused #inc.


# 24348 28-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# 22988 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 20412 14-Dec-1996 steve

Merge Lite2 mods and -Wall cleaning.


# 18578 30-Sep-1996 ache

Activate LC_CTYPE locale and additionly use !isprint() for 8bit characters


# 18546 28-Sep-1996 imp

Merge in the NetBSD changes to cat.c. These appear to have come from
the 4.4 lite 2 tape as well. There are now only two diffs between
NetBSD's cat and FreeBSD's cat:
getopt return value is -1 on NetBSD and EOF on FreeBSD.
NetBSD has added setlocale calls before anything else.


# 11145 03-Oct-1995 bde

Fix exit status. `cat no-such-file >/dev/null' exited with status 0.
This has been broken since cat's own err() function was sloppily
replaced by the library functions warn() and err().


# 3044 24-Sep-1994 dg

Added $Id$


# 1557 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1556,
which included commits to RCS files with non-trunk default branches.


# 1556 26-May-1994 rgrimes

BSD 4.4 Lite bin Sources