History log of /freebsd-11-stable/bin/cat/cat.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 337733 14-Aug-2018 kevans

MFC r322325: cat: fix build with -DNO_UDOM_SUPPORT

PR: 230489


# 331722 29-Mar-2018 eadler

Revert r330897:

This was intended to be a non-functional change. It wasn't. The commit
message was thus wrong. In addition it broke arm, and merged crypto
related code.

Revert with prejudice.

This revert skips files touched in r316370 since that commit was since
MFCed. This revert also skips files that require $FreeBSD$ property
changes.

Thank you to those who helped me get out of this mess including but not
limited to gonzo, kevans, rgrimes.

Requested by: gjb (re)


# 330897 14-Mar-2018 eadler

Partial merge of the SPDX changes

These changes are incomplete but are making it difficult
to determine what other changes can/should be merged.

No objections from: pfg


# 330738 10-Mar-2018 eadler

Revert MFC of r323865

While this behavior can be viewed as a bug fix, due to the fundamental
nature of cat(1), leave this change only for a major version.

PR: 210607
Requested by: sevan


# 330640 08-Mar-2018 eadler

MFC r327672:

stddef.h is not used by cat.c, remove the include.


# 330638 08-Mar-2018 eadler

MFC r323865:

Ammend bin/cat/cat.c so the output is the same aside
from blank lines being numbered or unnumbered, depending on whether cat
was invoked with -ne or -be.

At present, when cat is invoked with -be, there is an aditional
difference that the '$' on blank lines is placed on the far left of the
output.

Discussed in bug 210607.

While here, revert the workaround from r304035 which skipped the unit test for
this issue previously.

PR: 210607


# 306201 22-Sep-2016 ache

MFC r305841

Implement multibyte encoding support for -v with fallback


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

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


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 288645 03-Oct-2015 sbruno

Initialize fd to -1 so that gcc doesn't emit an unitialized warning.


# 288630 03-Oct-2015 bdrewery

Make GCC happy


# 288602 03-Oct-2015 hrs

Use getaddrinfo() to fill struct sockaddr_un. It now supports
SOCK_DGRAM and SOCK_SEQPACKET in addition to SOCK_STREAM.


# 260544 11-Jan-2014 adrian

Close the newly-created FD if the pathname is too long.

Coverity: CID 1007204
Sponsored by: Netflix, Inc.


# 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