Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/stdlib Fix '-' handling. POSIX only recognizes "--"...



details:   https://anonhg.NetBSD.org/src/rev/c7cbe79cd6bd
branches:  trunk
changeset: 532716:c7cbe79cd6bd
user:      wiz <wiz%NetBSD.org@localhost>
date:      Thu Jun 13 20:49:00 2002 +0000

description:
Fix '-' handling. POSIX only recognizes "--" as end-of-options.
Problem noted in lib/17248 by David Laight, including a patch.
Part of this patch was used.

diffstat:

 lib/libc/stdlib/getopt.c |  10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diffs (31 lines):

diff -r cc18d871c944 -r c7cbe79cd6bd lib/libc/stdlib/getopt.c
--- a/lib/libc/stdlib/getopt.c  Thu Jun 13 18:02:38 2002 +0000
+++ b/lib/libc/stdlib/getopt.c  Thu Jun 13 20:49:00 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getopt.c,v 1.21 2001/04/24 09:07:43 joda Exp $ */
+/*     $NetBSD: getopt.c,v 1.22 2002/06/13 20:49:00 wiz Exp $  */
 
 /*
  * Copyright (c) 1987, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)getopt.c   8.3 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: getopt.c,v 1.21 2001/04/24 09:07:43 joda Exp $");
+__RCSID("$NetBSD: getopt.c,v 1.22 2002/06/13 20:49:00 wiz Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -96,12 +96,6 @@
        }                                       /* option letter okay? */
        if ((optopt = (int)*place++) == (int)':' ||
            !(oli = strchr(ostr, optopt))) {
-               /*
-                * if the user didn't specify '-' as an option,
-                * assume it means -1.
-                */
-               if (optopt == (int)'-')
-                       return (-1);
                if (!*place)
                        ++optind;
                if (opterr && *ostr != ':')



Home | Main Index | Thread Index | Old Index