Commit Graph

58 Commits

Author SHA1 Message Date
Eitan Adler
e99f8bc02e - 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)
2013-04-23 13:03:11 +00:00
Joel Dahl
e38120d46f Fix date. 2013-01-29 20:01:47 +00:00
Brooks Davis
aece80a2e8 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)
2013-01-29 18:19:40 +00:00
Kevin Lo
d11ed2f6de Use "e.g.", not "i.e.", to introduce an example.
Obtained from:	NetBSD
2012-09-07 09:00:25 +00:00
Jaakko Heinonen
e3481b298a Use proper error message when fstat(2) fails on stdout.
PR:		bin/159746
Submitted by:	Alex K.
2012-07-20 08:33:23 +00:00
Jaakko Heinonen
67bf019b10 style(9). 2012-07-20 08:31:36 +00:00
Ed Schouten
f9d4afb439 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.
2011-10-31 08:59:17 +00:00
Ruslan Ermilov
92573623b9 Removed redundant WARNS setting.
Submitted by:	Ulrich Spörlein
2009-10-15 18:17:29 +00:00
Dag-Erling Smørgrav
ed53753dac cat(1) compiles fine at WARNS level 6. 2009-03-16 12:16:17 +00:00
Ivan Voras
e9cbc9a770 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
2008-10-30 14:05:57 +00:00
Ruslan Ermilov
d2b53efbb9 One more nit. 2006-12-23 09:25:23 +00:00
Ruslan Ermilov
17bba29b9b Fix markup. 2006-12-23 09:22:06 +00:00
Ruslan Ermilov
6fca4c7c3f Add the new standard EXIT STATUS section where appropriate.
Sort standard sections in the (documented) preferred order.
2005-01-16 16:41:59 +00:00
Ruslan Ermilov
6a5796e734 Eliminate macro calls inside literal displays. 2005-01-15 12:28:01 +00:00
Warner Losh
9ddb49cbe4 /*- or .\"- or #- to begin license clauses. 2005-01-10 08:39:26 +00:00
Tim J. Robbins
2c61418d05 Use warn() instead of perror(). 2004-07-20 05:52:00 +00:00
Mark Murray
6195fb4102 Remove clause 3 from the UCB licenses.
OK'ed by:	imp, core
2004-04-06 20:06:54 +00:00
Tim J. Robbins
744e4bba0e Reduce redundancy in the description of the -u option. 2004-03-21 11:04:59 +00:00
Tim J. Robbins
f74d4353ce Document incorrect handling of multibyte characters when -t and -v options
are used.
2004-03-21 11:02:40 +00:00
David E. O'Brien
0d22cdf040 We have to hide copyright[] for gcc33. :-( 2003-04-30 17:40:28 +00:00
Mark Murray
9d32ecfcdf Be consistent about declaring a function "static", and consistent
about the type of argv.
2002-10-23 10:23:38 +00:00
Mark Murray
9f82c1d3b1 Give lint a small bit of help. 2002-07-31 16:50:21 +00:00
David E. O'Brien
5eb43ac2f7 Consistently use __FBSDID 2002-06-30 05:13:54 +00:00
Tim J. Robbins
88485b4a2f Avoid truncating the pathname to UNIX Domain Sockets with snprintf(),
giving a more sensible warning when the (relatively meagre) sun_path
limit is exceeded.
2002-06-29 04:52:33 +00:00
Juli Mallett
ca2be2ff45 Use an usage() rather than doing the fprintf inside option parsing. 2002-06-14 09:54:48 +00:00
Tim J. Robbins
bf5f0c446e Print the "$" symbol on blank lines when the -s and -e options are used
together.

Obtained from:	OpenBSD (millert, Denis Afonin)
2002-06-13 14:05:26 +00:00
Tim J. Robbins
99cc224074 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.
2002-06-13 13:45:14 +00:00
Mark Murray
9afa09cd0e Fix warnings inspired by lint, a commercial lint and WARNS=4. 2002-02-22 20:51:00 +00:00
Warner Losh
78a3801de3 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)
2002-02-02 06:10:01 +00:00
David E. O'Brien
a748290789 Default to WARNS=2. Binary builds that cannot handle this must explicitly
set WARNS=0.

Reviewed by:	mike
2001-12-04 01:57:47 +00:00
Ruslan Ermilov
43e09ab2db WARNSify. 2001-09-26 11:34:14 +00:00
Ruslan Ermilov
1b00c916a1 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.
2001-09-26 11:32:23 +00:00
Ruslan Ermilov
0ec8be8404 mdoc(7) police: fixed markup. 2001-09-25 18:10:18 +00:00
Matthew Dillon
cbf2d71f0d Give /bin/cat the ability to connect to and read unix-domain sockets
MFC after:	1 week
2001-09-15 00:39:14 +00:00
Ruslan Ermilov
d628d776c4 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
Dima Dorfman
cafefe8c1b Include missing header files which define functions for which gcc has
builtins (e.g., exit, strcmp).
2001-06-24 23:04:23 +00:00
Dima Dorfman
0f77799115 Xref zcat(1). 2001-06-18 20:00:39 +00:00
Ruslan Ermilov
12e720d78b Prepare for mdoc(7)NG. 2000-12-15 17:37:31 +00:00
Ruslan Ermilov
be8b149795 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 11:39:41 +00:00
Sheldon Hearn
5091080e15 Use Dq Li (double-quoted literal) instead of Ic (internal command) to
mark up a sample invocation, since it is not a command internal to the
described utility.

Do not use Ar (argument) to mark up something which is not an argument
to the utility or one of its internal commands.
2000-06-27 18:22:13 +00:00
Jeroen Ruigrok van der Werven
2192b407ac 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.
2000-04-14 21:01:35 +00:00
Jeroen Ruigrok van der Werven
347b695801 Remove unnecessary empty line.
Remove trailing whitespace.
2000-04-13 19:31:46 +00:00
Peter Wemm
2a4562393f $Id$ -> $FreeBSD$ 1999-08-27 23:15:48 +00:00
Kris Kennaway
46be34b902 Various spelling/formatting changes.
Submitted by: Philippe Charnier <charnier@xp11.frmug.org>
1999-05-08 10:22:15 +00:00
Warner Losh
d1762d1fbe Fix minor style bugs noticed by the Bruce Filter.[tm]
Bruce-Filter-By: bde
1998-09-13 19:54:54 +00:00
Warner Losh
a5da09996c 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.
1998-09-11 05:48:06 +00:00
Philippe Charnier
12f93eb9b1 Restore Lite2 sccsids by removing `const'. Improve documentation a little.
Suggested by:	Bruce
1998-05-13 07:16:37 +00:00
Philippe Charnier
4c95995fe0 Correct use of .Nm, .An and other cosmetics. Add rcsid. Remove unused #inc. 1998-05-06 06:49:16 +00:00
Warner Losh
93ef08af3e compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-28 15:24:41 +00:00
Peter Wemm
b97fa2ef50 Revert $FreeBSD$ to $Id$ 1997-02-22 14:13:04 +00:00