uniq: Fixup program usage and manpage

Remove -i as it is not required by POSIX.  We'll add it if we
hit scripts that require it.
This commit is contained in:
sin 2015-02-11 12:12:21 +00:00
parent 5836ef72e3
commit 5f06185b1b
3 changed files with 14 additions and 21 deletions

2
README
View File

@ -79,7 +79,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
=* tty yes none
=* uname yes none
#* unexpand yes none
= uniq no none
= uniq no [infile [outfile]]
=* unlink yes none
= uudecode no -o
= uuencode no -m

29
uniq.1
View File

@ -6,7 +6,10 @@
.Nd report or filter out repeated lines in a file
.Sh SYNOPSIS
.Nm
.Op Fl cdu
.Op Fl c
.Op Fl d | u
.Op Fl f Ar fields
.Op Fl s Ar chars
.Op Ar file
.Sh DESCRIPTION
.Nm
@ -26,20 +29,12 @@ Prefixes each line with a count of its consecutive occurrences in the input.
Suppresses non-duplicate lines (thus 'uniq -d' prints only duplicates).
.It Fl u
Suppresses non-unique lines (thus 'uniq -u' prints only uniques).
.It Fl f Ar fields
Ignore the first
.Ar fields
in each input line when doing comparisons.
.It Fl s Ar chars
Ignore the first
.Ar chars
characters in each input line when doing comparisons.
.El
.Sh BUGS
The original sbase implementation of
.Nm
supported multiple input-file arguments as e.g.
.Xr cat 1
and
.Xr grep 1
do.
Unfortunately, POSIX uniq treats its second argument (if present) as an
output filename and clobbers it. Since users and scripts which rely on
.Nm
supporting multiple input-file arguments would be at risk of data loss
if they ever ran into a POSIX-compatible
.Nm
, support for multiple input-file arguments was removed from this
implementation.

4
uniq.c
View File

@ -25,7 +25,7 @@ static long prevlinecount = 0;
static void
usage(void)
{
eprintf("usage: %s [-cdiu] [input]]\n", argv0);
eprintf("usage: %s [-cdufs] [file]\n", argv0);
}
int
@ -34,8 +34,6 @@ main(int argc, char *argv[])
FILE *fp;
ARGBEGIN {
case 'i':
eprintf("not implemented\n");
case 'c':
countfmt = "%7ld ";
break;