[hackers] [sbase] uniq: Fixup program usage and manpage || sin

From: <git_AT_suckless.org>
Date: Wed, 11 Feb 2015 13:20:36 +0100 (CET)

commit 62e56c31a27f84ab2389bca79bf2e7aade789517
Author: sin <sin_AT_2f30.org>
Date: Wed Feb 11 12:12:21 2015 +0000

    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.

diff --git a/README b/README
index 8325742..2b1c4a7 100644
--- a/README
+++ b/README
_AT_@ -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
diff --git a/uniq.1 b/uniq.1
index 433053f..08d190b 100644
--- a/uniq.1
+++ b/uniq.1
_AT_@ -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
_AT_@ -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.
diff --git a/uniq.c b/uniq.c
index 5791cc0..5b217e3 100644
--- a/uniq.c
+++ b/uniq.c
_AT_@ -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
_AT_@ -34,8 +34,6 @@ main(int argc, char *argv[])
         FILE *fp;
 
         ARGBEGIN {
- case 'i':
- eprintf("not implemented\n");
         case 'c':
                 countfmt = "%7ld ";
                 break;
Received on Wed Feb 11 2015 - 13:20:36 CET

This archive was generated by hypermail 2.3.0 : Wed Feb 11 2015 - 13:24:10 CET