Commit Graph

53 Commits

Author SHA1 Message Date
ache
0cc78f7ab0 Add SIZE_MAX overflow check 2010-03-09 21:06:01 +00:00
ache
b17e796fd7 1) Reimplement (differently) unlimited line length restricted in prev.
commit.

2) Honor missing the very last \n (if absent) on output.
2010-03-08 19:40:22 +00:00
ache
f28c83324f Remove vestiges of old %-format which prevents build on amd64 2010-03-06 22:38:38 +00:00
ache
85448eebc0 1) Rewrite input processing to not exit with error on the first EILSEQ found
in the input data but fallback to "binary equal" check instead.

POSIX says: "The input file shall be a text file", nothing more,
so the text file with illegal sequence is valid input.
BTW, GNU sort does not fails on EILSEQ too.

2) Speedup input processing a bit in complex cases like skipping fields,
chars or ignore case.

3) Enforce the implied LINE_MAX limit (from POSIX definition of "text file"
and POSIX uniq(1) description).
2010-03-06 19:21:57 +00:00
jh
060a87e0f5 Sync getline() with comm(1):
- 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-17 17:03:47 +00:00
jh
4491896aee The input line length limit mentioned on the manual page was removed by
r176119.

Approved by:	trasz (mentor)
2009-12-17 16:59:19 +00:00
ghelmer
56c7e4a9b4 Fix truncation of lines at LINE_MAX characters by dynamically
extending line buffers.

PR:		bin/76578
2008-02-08 23:04:13 +00:00
jmallett
c449c9befa Fix typo. 2007-05-17 00:19:56 +00:00
jmallett
070c749233 o) Correct for missing whitespace.
o) We don't need to check if ifp == stdin to give the filename, since we already
   know that ifn will be "stdin" if it is.
2007-05-17 00:18:01 +00:00
jmallett
4f0511a3a8 Fix confusing misindentation of a closing-brace. (It goes with the switch, not
with the while.)
2007-05-17 00:11:58 +00:00
keramida
92bee7e5d8 Document that uniq(1) limits input line length to LINE_MAX characters.
PR:		docs/107578
Submitted by:	Jan Schaumann, jschauma.at.netmeister.org
MFC after:	3 days
2007-01-15 23:25:51 +00:00
ru
6cc4b6c220 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
tjr
d7872e5e5f Remove a bogus check that caused empty lines not to be counted when the
-c option was given.

Noticed by:	sf
2004-09-14 12:01:18 +00:00
tjr
ab71ec88b7 Add support for multibyte characters. 2004-07-02 23:43:05 +00:00
ru
fb1d8b3724 Mechanically kill hard sentence breaks. 2004-07-02 22:22:35 +00:00
tjr
2a2e19c40b Document the fact that uniq(1) does not recognize multibyte characters. 2004-06-24 16:29:28 +00:00
tjr
4f4d51b92e Mention the environment variables that affect the execution of uniq.
Of particular interest is the fact that LC_COLLATE affects how uniq
determines whether lines are equal. This was the subject of a fairly heated
debate a year or so ago, and it turns out that the current behaviour is
correct and that the standard contained an error.

Now that the standard has been corrected by Cor. 1-2002, refer to 1003.1-2001
instead of the 1992 edition in the Standards section.
2003-04-12 04:17:14 +00:00
ru
b67068895d mdoc(7) police: markup polishing.
Approved by:	re
2002-11-26 17:33:37 +00:00
dwmalone
b4339b74ad ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.

Reviewed by:	md5
2002-09-04 23:29:10 +00:00
tjr
8fe7f967d2 Correct the History section; uniq(1) appeared at least as early as V3.
Move the section to after Standards.
2002-07-05 09:44:47 +00:00
tjr
5fe78a36e5 Remove redundant description of input_file and output_file arguments. 2002-07-05 09:37:34 +00:00
tjr
3594350f00 Use err instead of errx when malloc fails. "malloc" is not a helpful
error message.
2002-07-05 09:28:13 +00:00
tjr
37c7624aa9 Skip fields in the manner required by POSIX, and the way V7 did it.
MFC after:	1 week
2002-06-21 07:59:31 +00:00
tjr
61c21ff1cf Newline characters should not participate in line comparisons. Only apparent
when -s is used or the last line of the file is missing a newline.
Noticed by the textutils test suite.

MFC after:	1 week
2002-06-21 07:08:34 +00:00
jmallett
241a475e6f Note that this appeared at least as early as PWB UNIX.
Use the literal string 'PWB UNIX', as we still have no .At macro for it.
2002-06-10 22:59:59 +00:00
ache
37d7c3a7df Back out rev 1.19 because
1) It breaks uniq for real life languages when "substitute" directive used in
the collating table.
2) It breaks uniq usage in tool chain with other localized utilities which
use collate.
3) To follow LC_COLLATE it is directly allowed for uniq
by POSIX P1003.1 Draft7 (7.3.2). It means that rev 1.19 gains no additional
POSIX conformance.
2002-06-06 13:44:14 +00:00
tjr
264da240fc Compare lines with strcmp(), not strcoll(). We are interested only in
equality, not ordering.
2002-06-06 03:13:08 +00:00
tjr
050d703846 Sync usage() with manual page synopsis. 2002-06-06 03:05:30 +00:00
tjr
60d1ab01d7 Accept an input file name of "-" to mean standard input, as required by
P1003.2.
2002-05-30 00:07:14 +00:00
tjr
2d9a2285ef Fields should be separated by <blank>s, not <space>s according to P1003.2. 2002-05-29 23:55:44 +00:00
tjr
31d09977d0 Don't bother trying to handle "-" arguments ourselves, getopt(3) already
does this for us.
2002-05-29 23:52:55 +00:00
trhodes
2cd0ea3f3a Add the word ``fields'' to the description, and change an instance from
fields to num in the SYNOPSIS

Noticed by:	keramida
2002-05-24 19:12:02 +00:00
trhodes
a1b38ab0e2 Reword a small part of the uniq(1) manual page to help reduce word
duplication (ie: fields fields).

PR:		38161
Reviewed by:	keramida
MFC after:	3 days
2002-05-21 16:54:58 +00:00
ache
ef9121555f Use LC_ALL to pick collate
Noticed by:	tjr
2002-04-19 08:16:01 +00:00
imp
0b20191705 remove __P 2002-03-22 01:42:45 +00:00
markm
a71a530c96 WARNS=2 is going to become the default, so remove it from here. 2001-12-11 23:27:23 +00:00
dwmalone
d9613ea383 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
dwmalone
383583bd4f Warns cleanups. Add FreeBSD ID to Makefile. 2001-12-03 21:37:35 +00:00
ru
bde8ec1b70 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
charnier
42d5955dc9 Add DIAGNOSTICS section name 2000-03-26 15:06:46 +00:00
ache
91440b61a3 fix fatal typo 1999-12-10 13:06:53 +00:00
ache
25e78d8b60 toupper -> tolower to match changed behaviour of new grep case fold 1999-10-29 05:11:06 +00:00
ache
d8f93ede38 Cosmetique: use standard prototypes scheme
Back out prev. change: toupper is more compatible with sort -f
1999-10-24 04:41:31 +00:00
ache
c870ad3624 toupper->tolower to match what strcasecmp does 1999-10-24 04:21:42 +00:00
ache
9fbc2f9470 Use strcoll to provide the same results as sort and comm
Use LINE_MAX for max line size (as comm does)
1999-10-24 04:08:15 +00:00
peter
3b842d34e8 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
billf
b37be6fe9b Grammar nits, double negatives
PR:		docs/10491
Submitted By:	Tom Hukins <tom@eborcom.com>
1999-03-15 02:57:29 +00:00
ache
81b26c0896 Localize it 1998-03-08 20:56:43 +00:00
joerg
caa2e7e2da 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
charnier
16f9b719d4 Use err(3) instead of local redefinition. 1997-08-21 06:51:10 +00:00