Module Name:    src
Committed By:   uwe
Date:           Tue Apr 23 14:40:12 UTC 2019

Modified Files:
        src/usr.bin/uniq: uniq.c

Log Message:
Don't pass '-' to getopt(3).  My guess is that *very* old getopt
didn't handle "--" terminator, so this code was working around it and
not quite correctly at that.

Fixes weird output from

  $ uniq --long-option
  uniq: uniq: No such file or directory

(for more fun, run that command from /usr/bin as root).

Pointed out by Andreas Krey.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/uniq/uniq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/uniq/uniq.c
diff -u src/usr.bin/uniq/uniq.c:1.20 src/usr.bin/uniq/uniq.c:1.21
--- src/usr.bin/uniq/uniq.c:1.20	Sun Oct 16 06:17:51 2016
+++ src/usr.bin/uniq/uniq.c	Tue Apr 23 14:40:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uniq.c,v 1.20 2016/10/16 06:17:51 abhinav Exp $	*/
+/*	$NetBSD: uniq.c,v 1.21 2019/04/23 14:40:12 uwe Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)uniq.c	8.3 (Berkeley) 5/4/95";
 #endif
-__RCSID("$NetBSD: uniq.c,v 1.20 2016/10/16 06:17:51 abhinav Exp $");
+__RCSID("$NetBSD: uniq.c,v 1.21 2019/04/23 14:40:12 uwe Exp $");
 #endif /* not lint */
 
 #include <err.h>
@@ -75,11 +75,8 @@ main (int argc, char *argv[])
 	setprogname(argv[0]);
 	ifp = ofp = NULL;
 	obsolete(argv);
-	while ((ch = getopt(argc, argv, "-cdf:s:u")) != -1)
+	while ((ch = getopt(argc, argv, "cdf:s:u")) != -1)
 		switch (ch) {
-		case '-':
-			--optind;
-			goto done;
 		case 'c':
 			cflag = 1;
 			break;

Reply via email to