Home | History | Annotate | only in /src/bin/cat
History log of /src/bin/cat
RevisionDateAuthorComments
 1.12 18-May-2003  lukem branches: 1.12.98;
Now that <bsd.prog.mk> DTRT if HOSTPROG is defined (i.e, it is a no-op),
there's no need to special-case .include-ing it.
 1.11 10-Jun-2002  mason Add wrapper around bsd.prog.mk include in preparation for this becoming a
host tool.
 1.10 03-Nov-2001  lukem branches: 1.10.2;
change from WARNS?=1 to WARNS?=2 for bin/
 1.9 08-Jul-1999  christos Make this compile with WARNS = 2
 1.8 20-Jul-1997  christos Remove WARNS=1 from all the subdirectory Makefiles, and add it to Makefile.inc
now that all /bin has been cleaned.
 1.7 20-Jul-1997  thorpej Add WARNS.
 1.6 23-Apr-1995  cgd clean up RCS Ids slightly, etc.
 1.5 20-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 20-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.10.2.1 11-Jun-2002  lukem Pull up revision 1.11 (requested by mason in ticket #244):
Add wrapper around bsd.prog.mk include in preparation for this becoming a
host tool.
 1.12.98.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.12.98.1 21-Apr-2020  martin Sync with HEAD
 1.41 02-Oct-2017  wiz branches: 1.41.4;
Add cross reference to tac(1).
 1.40 04-Jul-2017  wiz Use Ex.
 1.39 03-Jul-2017  wiz Remove workaround for ancient HTML generation code.
 1.38 15-Jun-2014  wiz Bump date for previous.
 1.37 15-Jun-2014  dbj update list of flags which are extensions to the specification
 1.36 10-Nov-2012  wiz branches: 1.36.8;
Sort options (no-argument ones first, then argument-taking ones).
 1.35 10-Nov-2012  christos Add an option to read with a different buffer size, and document the
buffer size we use. This allows us to cat -B 10000000 /proc/<pid>/maps
for example which cannot handle seeking.
 1.34 09-Aug-2012  dholland branches: 1.34.2;
Use "e.g.", not "i.e.", to introduce an example.
 1.33 06-Apr-2012  wiz Describe behaviour when no arguments are given.
Add comma.
Bump date.

From Bug Hunting.
 1.32 23-Sep-2006  wiz branches: 1.32.40;
Use macro for HTML output.
 1.31 23-Sep-2006  elad PR/16827: Giorgos Keramidas: addition of EXAMPLES section to
basesrc/bin/cat.1
Applied patch, thanks!
 1.30 27-Aug-2003  junyoung Add missing "."
 1.29 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.28 25-Sep-2002  wiz New policy: New sentences start on a new line.
Patches by Robert Elz <kre at munnari oz au>, with minimal changes by me.
 1.27 03-Jul-2002  enami The el option is an extention.
 1.26 10-Jun-2002  mason Add -l option to cat(1), as discussed on tech-userlevel. This option
causes cat(1) to use fcntl(2) to set an exclusive advisory lock on stdout.
While being useful in its own right, this will shortly be used to
guarantee orderly writing to METALOG in the case of unprivileged builds
with NBUILDJOBS > 1.
 1.25 15-May-2002  kleink branches: 1.25.2;
Consistent wording: `regular' files, not `plain' ones; from Giorgos
Keramidas in PR bin/16824.
 1.24 08-Feb-2002  ross Generate <>& symbolically. I'm avoiding .../dist/... directories for now.
 1.23 20-Dec-2001  wiz Sort sections, drop unnecessary .Pps.
 1.22 20-Dec-2001  wiz Whitespace nits.
 1.21 04-Sep-2000  kleink For commands and utilities, use EXIT STATUS rather than RETURN VALUES as
appropriate (and documented in mdoc(7)).
 1.20 28-Aug-2000  hubertf Add 'RETURN VALUE' section header.
 1.19 02-Aug-2000  jwise Use .At v1 macro instead of spelling out AT&T Unix version 1.
 1.18 15-Jan-2000  christos branches: 1.18.4;
Add a -f fflag that makes sure that we only try to read from plain files
so that there is no chance to block.
 1.17 09-Jan-2000  abs Slightly modified small fixes from Richard Rauch in PR bin/9150
 1.16 22-Mar-1999  garbled More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages. Many more to
come.
 1.15 11-Mar-1999  fair Patch from PR#5156 to adjust buffer size to match filesystem block size
when "-u" option used, plus some additional documentation.
 1.14 28-Apr-1998  fair Change occurrences of "UNIX" to .Ux or .At as appropriate.
 1.13 20-Oct-1997  enami Fix .Nm usage.
 1.12 27-Sep-1995  cgd kill an extr space in a (literally-printed) example
 1.11 07-Sep-1995  jtc Sync with 4.4lite2
 1.10 25-Jul-1995  jtc Use "utility" instead of "command". Modern definitions of these terms
are distinct (See POSIX.2 glossary).

A utility is a executable, script or shell builtin; while a command
can be any of those things plus lists, pipelines, compound commands
(if, for, while) and shell function definitions.
 1.9 21-Mar-1995  cgd convert to new RCS id conventions.
 1.8 04-Nov-1994  cgd bugs don't get any dumber than this.
 1.7 20-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.6 30-Nov-1993  jtc Use ".At v6" macro instead of spelling out "Version 6 AT&T UNIX".
 1.5 16-Aug-1993  jtc Document the fact that cat is a superset of 1003.2's cat.
 1.4 01-Aug-1993  mycroft Add RCS indentifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 07-Sep-1995  jtc imported from 44lite2
 1.1.1.2 20-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.18.4.1 28-Aug-2000  hubertf Pull up to netbsd-1-5 branch, OK'd by thorpej:

Log Message:
> Add 'RETURN VALUE' section header.

Files & Revisionis:
> cvs rdiff -r1.19 -r1.20 basesrc/bin/cat/cat.1
> cvs rdiff -r1.12 -r1.13 basesrc/bin/chmod/chmod.1
> cvs rdiff -r1.14 -r1.15 basesrc/bin/cp/cp.1
> cvs rdiff -r1.8 -r1.9 basesrc/bin/dd/dd.1
> cvs rdiff -r1.9 -r1.10 basesrc/bin/echo/echo.1
> cvs rdiff -r1.11 -r1.12 basesrc/bin/expr/expr.1
> cvs rdiff -r1.25 -r1.26 basesrc/bin/ls/ls.1
> cvs rdiff -r1.10 -r1.11 basesrc/bin/mkdir/mkdir.1
> cvs rdiff -r1.23 -r1.24 basesrc/bin/mt/mt.1
> cvs rdiff -r1.12 -r1.13 basesrc/bin/mv/mv.1
> cvs rdiff -r1.16 -r1.17 basesrc/bin/pwd/pwd.1
> cvs rdiff -r1.9 -r1.10 basesrc/bin/rm/rm.1
> cvs rdiff -r1.11 -r1.12 basesrc/bin/rmdir/rmdir.1
> cvs rdiff -r1.35 -r1.36 basesrc/bin/sh/sh.1
> cvs rdiff -r1.11 -r1.12 basesrc/bin/sleep/sleep.1
> cvs rdiff -r1.20 -r1.21 basesrc/bin/stty/stty.1
 1.25.2.2 24-Sep-2003  tron Pull up revision 1.30 (requested by junyoung in ticket #1469):
Add missing "."
 1.25.2.1 11-Jun-2002  lukem Pull up revision 1.26 (requested by mason in ticket #243):
Add -l option to cat(1), as discussed on tech-userlevel. This option
causes cat(1) to use fcntl(2) to set an exclusive advisory lock on stdout.
While being useful in its own right, this will shortly be used to
guarantee orderly writing to METALOG in the case of unprivileged builds
with NBUILDJOBS > 1.
 1.32.40.3 16-Jan-2013  yamt sync with (a bit old) head
 1.32.40.2 30-Oct-2012  yamt sync with head
 1.32.40.1 17-Apr-2012  yamt sync with head
 1.34.2.2 19-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.34.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.36.8.1 10-Aug-2014  tls Rebase.
 1.41.4.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.41.4.1 21-Apr-2020  martin Sync with HEAD
 1.60 10-Dec-2023  rillig cat: repeat storage class 'static' for local functions

No binary change.
 1.59 07-Dec-2023  rillig cat: reduce visibility of local functions

No functional change.
 1.58 19-May-2023  rillig cat: fix misleading indentation

Found by indent, but not by GCC 10.

No binary change.
 1.57 16-Jun-2016  sevan branches: 1.57.16;
When invoked with -se, print a '$' on blank lines
Obtained from OpenBSD r1.13 of src/bin/cat/cat.c

Closes PR bin/51250
Reviewed by Christos@
 1.56 16-Jun-2016  sevan Revert previous change made by me in r1.55
 1.55 25-Jul-2015  sevan Drop the case '?' which is defined after case 'default'.
case 'default' statement introduced in the last commit to cat.c in the CSRG archive.
Obtained from OpenBSD bin/cat/cat.c r1.3.
 1.54 08-Dec-2013  spz branches: 1.54.4;
more complete fix for Coverity issue 976653
 1.53 03-Dec-2013  spz Coverity complaint fixes:
bin/cat/cat.c 976654 Argument cannot be negative
(missing check for fileno result, stdout)
bin/cat/cat.c 976653 Improper use of negative value
(missing check for fileno result, stdin)
 1.52 19-Nov-2012  christos only allocate if it would not fit in our buffer.
 1.51 19-Nov-2012  christos fix bogus warning for zero-sized files.
 1.50 10-Nov-2012  wiz Sync usage with man page.
 1.49 10-Nov-2012  christos Add an option to read with a different buffer size, and document the
buffer size we use. This allows us to cat -B 10000000 /proc/<pid>/maps
for example which cannot handle seeking.
 1.48 17-Mar-2012  christos branches: 1.48.2;
fix signed blksize_t lossage.
 1.47 20-Jul-2008  lukem branches: 1.47.2; 1.47.20;
Remove the \n and tabs from the __COPYRIGHT() strings.
 1.46 13-Jan-2007  cbiere branches: 1.46.12;
- Applied patch from PR bin/35408 by Andreas Wiese.
- Use EXIT_FAILURE instead of 1.
- Use return instead of exit() at the end of main().
- Use sizeof() instead of BUFSIZ.
 1.45 08-Oct-2006  elad PR/32759: Ulrich Heilmann: Output of cat -s -n is wrong

Applied patch from David A. Holland, thanks!
 1.44 26-Feb-2006  christos PR/32931: Johan Veenhuizen: cat(1) does not clear the EOF indicator for
stdin in cooked mode.
 1.43 04-Jan-2004  jschauma Remove unused code left over from temporary printescaped functionality.
Noted by Jeff Ito in PR bin/23966.
 1.42 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.41 14-Sep-2003  jschauma Following private discussion with kleink@ and hubertf@ and public discussion
on tech-userlevel@, back out printescaped() functionality.
kleink: ``We sell rope.''
 1.40 27-Aug-2003  uwe Include "config.h" if building as a host program.
Need this to get SIZE_MAX defintion from compat_defs.h on FreeBSD.
 1.39 25-Aug-2003  kleink This is a host tool, so for the time being change SIZE_T_MAX to the
more portable SIZE_MAX; partially addresses PR toolchain/22504 from
Christian Limpach.
 1.38 13-Aug-2003  itojun use bounded string op
 1.37 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.36 04-Aug-2003  jschauma As discusses a little while back on tech-userlevel:

If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.

While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.
 1.35 13-Sep-2002  thorpej Don't use MAX(); not all systems have it, and this is a host tool.
 1.34 11-Jun-2002  bjh21 Rather than (ab)using the standard error message for EFTYPE, print our own
message when "cat -f" is used on a non-regular file. This is necessary to
make cat(1) portable to systems that don't have EFTYPE (like Linux).
 1.33 11-Jun-2002  bjh21 Only use __RCSID() and __COPYRIGHT() if they're defined.
 1.32 10-Jun-2002  mason Add -l option to cat(1), as discussed on tech-userlevel. This option
causes cat(1) to use fcntl(2) to set an exclusive advisory lock on stdout.
While being useful in its own right, this will shortly be used to
guarantee orderly writing to METALOG in the case of unprivileged builds
with NBUILDJOBS > 1.
 1.31 09-May-2002  simonb branches: 1.31.2;
Simplify previous - sbuf.st_blksize is a uint32_t, so just use
bsize = MAX(sbuf.st_blksize, BUFSIZ);
and skip playing with SSIZE_MAX altogether.
 1.30 09-May-2002  thorpej Fix oversight in last.
 1.29 09-May-2002  thorpej Skip a check that is always true if _LP64 is defined.
 1.28 16-Sep-2001  wiz Some KNF, via patch by Petri Koistinen in private mail.
 1.27 29-Jul-2001  wiz Some style improvements. [Nearly] #13592 by Petri Koistinen.
 1.26 03-Jan-2001  mjl Un-__P and ANSIfy
 1.25 03-Jan-2001  mjl Sync usage w/ options, remove bogus cast.
 1.24 31-Jul-2000  christos don't use the "f" flag to fopen when -f is not specified (from Chuck Cranor)
 1.23 14-Apr-2000  simonb Don't declare 'extern opt*' getopt variables.
 1.22 15-Jan-2000  christos Add a -f fflag that makes sure that we only try to read from plain files
so that there is no chance to block.
 1.21 08-Jul-1999  christos Make this compile with WARNS = 2
 1.20 26-Apr-1999  hannken Fix buffer allocation in function `raw_cat'. It was possible to get a
buffer size of zero if stdout has a block size of 0.
The command `rsh <host> cat <files>' gives no output and no error.

- Allocate a minimum of BUFSIZ bytes for buffer.
- Use a static buffer if either `fstat' or `malloc' fails.
- Do the allocation once since stdout will not change block size.
 1.19 11-Mar-1999  fair branches: 1.19.2;
Patch from PR#5156 to adjust buffer size to match filesystem block size
when "-u" option used, plus some additional documentation.
 1.18 28-Jul-1998  mycroft Delint.
 1.17 27-Jan-1998  kleink Fix the EOL-indicators ('$') toggled by the `-e' option to be lined up
correctly when used in conjunction with the `-b' option; from Giles Lean
in PR bin/4841, modified by me to retain the line-counting semantics of `-b'.
 1.16 05-Nov-1997  cgd lint
 1.15 20-Jul-1997  thorpej branches: 1.15.2;
__COPYRIGHT()/__RCSID()/prototype police.
 1.14 26-Jun-1997  kleink When allocating a buffer failed, don't fail silently.
 1.13 27-Apr-1997  kleink Indicate file handling failures by exit codes >0; fixes PR/3538 from
David Eckhardt <davide@piper.nectar.cs.cmu.edu>.
 1.12 09-Jan-1997  tls kill use of register
 1.11 07-Sep-1995  jtc Sync with 4.4lite2
 1.10 21-Mar-1995  cgd convert to new RCS id conventions.
 1.9 20-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.8 19-Nov-1993  jtc POSIX.2 utilities must call setlocale(LC_ALL, "");
 1.7 10-Sep-1993  jtc Too few arguments for err() format specification.
 1.6 01-Aug-1993  mycroft Add RCS identifiers.
 1.5 11-Jul-1993  cgd fix the cat bug found by mycroft in a more asthetically pleasing
way... also turn "Header" into "Id" for RCS...
 1.4 11-Jul-1993  mycroft Work correctly if a write() comes up short.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 07-Sep-1995  jtc imported from 44lite2
 1.1.1.2 20-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.15.2.1 08-Feb-1998  mellon Pull up 1.16 and 1.17 (kleink)
 1.19.2.1 26-Apr-1999  perry pullup 1.19->1.20 (Juergen Hannken-Illjes)
 1.31.2.3 16-Jun-2004  jmc Missing config.h bring-in. Add for PR#24481
 1.31.2.2 03-Nov-2002  he Pull up revision 1.35 (requested by thorpej in ticket #793):
Don't use MAX(); not all systems have it, and this is a host
tool.
 1.31.2.1 11-Jun-2002  lukem Pull up revision 1.32 (requested by mason in ticket #243):
Add -l option to cat(1), as discussed on tech-userlevel. This option
causes cat(1) to use fcntl(2) to set an exclusive advisory lock on stdout.
While being useful in its own right, this will shortly be used to
guarantee orderly writing to METALOG in the case of unprivileged builds
with NBUILDJOBS > 1.
 1.46.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.47.20.1 25-Mar-2017  snj Pull up following revision(s) (requested by sevan in ticket #1387):
bin/cat/cat.c: revision 1.57
When invoked with -se, print a '$' on blank lines
Obtained from OpenBSD r1.13 of src/bin/cat/cat.c
Closes PR bin/51250
Reviewed by Christos@
 1.47.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.47.2.2 16-Jan-2013  yamt sync with (a bit old) head
 1.47.2.1 17-Apr-2012  yamt sync with head
 1.48.2.3 19-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.48.2.2 25-Feb-2013  tls resync with head
 1.48.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.54.4.1 05-Jul-2016  snj Pull up following revision(s) (requested by sevan in ticket #1182):
bin/cat/cat.c: revision 1.57
distrib/sets/lists/tests/mi: revision 1.675
tests/bin/cat/Makefile: revision 1.2
tests/bin/cat/d_se_output.in: revision 1.1
tests/bin/cat/d_se_output.out: revision 1.1
tests/bin/cat/t_cat.sh: revision 1.3
When invoked with -se, print a '$' on blank lines
Obtained from OpenBSD r1.13 of src/bin/cat/cat.c
Closes PR bin/51250
Reviewed by Christos@
--
Add a unit test for PR bin/51250 called se_output. se_output checks
the output of cat when invoked with '-se', to ensure that a '$' is
printed on blank lines.
--
Add input/output files for new test case - fix build
 1.57.16.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.57.16.1 21-Apr-2020  martin Sync with HEAD

RSS XML Feed