Commit Graph

29 Commits

Author SHA1 Message Date
Baptiste Daroussin
a43d43d574 Remove usage of _WITH_GETLINE from usr.bin 2016-07-30 01:07:47 +00:00
Ed Schouten
8d34a0b7bc Mark global functions and/or variables in comm(1) static where possible.
This allows compilers and static analyzers to more thorough analysis.
2011-11-06 18:49:10 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Andrey A. Chernov
0100f0ddf7 Add SIZE_MAX overflow check 2010-03-09 21:06:17 +00:00
Andrey A. Chernov
8f82dfe5d1 Rewrite input processing to not exit with error on the first EILSEQ found
in the input data but fallback to "binary comparison" instead.

POSIX says: "The input files shall be text files", nothing more,
so the text file with illegal sequence is valid input.
BTW, GNU sort does not fails on EILSEQ too.
2010-03-08 22:27:46 +00:00
Jaakko Heinonen
e8861840c8 - Prevent overflowing of the buffer length variable in getline() by
limiting its maximum value.
- Exit if reallocf(3) fails in getline(). Failure was silently
  considered as end-of-file.

Reviewed by:	ghelmer
Approved by:	trasz (mentor)
2009-12-16 14:34:48 +00:00
Jaakko Heinonen
d8eba599f5 Don't read the newline character to line buffer because lines are passed
to wcscoll(3). Newline characters could cause incorrect results when
comparing lines.

Also, if an input line didn't contain a newline character, it was
omitted from the output. According to my interpretation, SUSv3 requires
that the newline is always printed.

Add regression tests for the cases. [1]

PR:		bin/140976
Submitted by:	D'Arcy Cain (original version) [1]
Approved by:	trasz (mentor)
2009-12-12 18:18:46 +00:00
Guy Helmer
16f53ec4b7 Similar to changes previously made to src/usr.bin/uniq/uniq.c,
fix truncation of lines at LINE_MAX characters by dynamically
extending line buffers.
2008-05-28 14:13:35 +00:00
Tim J. Robbins
e9fbd31a8c Add support for multibyte characters. 2004-07-02 22:48:29 +00:00
David Malone
19817b8518 ANSIify function definitions to avoid a warning.
Minor constness changes.
2002-07-28 15:28:38 +00:00
Tim J. Robbins
fc7f17b1fe No need to handle '-' explicitly in getopt() loop.
Obtained from:	NetBSD
2002-05-28 09:26:08 +00:00
Warner Losh
f1bb2cd2aa remove __P 2002-03-22 01:22:50 +00:00
Andrey A. Chernov
6d994e13c8 Use LC_ALL to pick LC_COLLATE too (for strcoll()) 2001-12-30 19:30:10 +00:00
David Malone
9f5b04e925 Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.
2001-12-10 21:13:08 +00:00
Mark Murray
9240706953 Use __FBSDID(). 2001-12-02 23:52:47 +00:00
Mark Murray
bcdc82df70 WARNS=2 fixup. 2001-12-02 13:18:59 +00:00
Dima Dorfman
7a19d1bbb9 Include missing header files which define functions for which gcc has
builtins (e.g., exit, strcmp).
2001-06-24 19:50:42 +00:00
Philippe Charnier
3a87eff1cf Rework diagnostics text
Remove unused #include
2001-02-06 20:01:40 +00:00
Andrey A. Chernov
6604897c78 fix the same typo as in uniq 1999-12-10 13:27:02 +00:00
Andrey A. Chernov
ff6a49c924 toupper -> tolower to match changed behaviour of new grep case fold 1999-10-29 05:11:06 +00:00
Andrey A. Chernov
fe6e52a784 Cosmetique: use standard prototypes scheme
Back out prev change: toupper is more compatible with sort -f
1999-10-24 04:47:57 +00:00
Andrey A. Chernov
4346bfd3f0 toupper->tolower to match what strcasecmp does 1999-10-24 04:21:42 +00:00
Andrey A. Chernov
2c2b14e162 Localize it
PR:		11221
Submitted by:	Grigoriy Strokin <grg@philol.msu.ru>
1999-10-24 03:42:35 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Archie Cobbs
fa146c5335 Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]). 1998-12-06 22:58:23 +00:00
Joerg Wunsch
2ca7dc1598 Teach comm(1) and uniq(1) about an option for case-insensitive work.
PR:		3042
Submitted by:	graphix@iastate.edu (Kent Vander Velden)
1997-09-07 15:09:22 +00:00
Philippe Charnier
0e25805f2f Use err(3). Add DIAGNOSTIC section name in man page. 1997-06-30 06:40:16 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Peter Wemm
0da30e9aa7 Import some parts of CSRG 4.4BSD-Lite2 usr.bin sources to fix tree build. 1997-03-11 13:08:12 +00:00