Source-Changes-HG archive

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

[src/trunk]: src/bin/sh Oops, the previous didn't do what was promised. Rath...



details:   https://anonhg.NetBSD.org/src/rev/e1758059f66a
branches:  trunk
changeset: 744543:e1758059f66a
user:      kre <kre%NetBSD.org@localhost>
date:      Wed Feb 05 14:56:25 2020 +0000

description:
Oops, the previous didn't do what was promised.  Rather that ignoring
just "--" for exec & "." it ignored any first arg starting '-'.
Do it properly.

diffstat:

 bin/sh/options.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r e8c73edbe9a5 -r e1758059f66a bin/sh/options.c
--- a/bin/sh/options.c  Wed Feb 05 14:56:04 2020 +0000
+++ b/bin/sh/options.c  Wed Feb 05 14:56:25 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: options.c,v 1.54 2020/02/04 16:06:59 kre Exp $ */
+/*     $NetBSD: options.c,v 1.55 2020/02/05 14:56:25 kre Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c  8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: options.c,v 1.54 2020/02/04 16:06:59 kre Exp $");
+__RCSID("$NetBSD: options.c,v 1.55 2020/02/05 14:56:25 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -616,6 +616,8 @@
                argptr++;
                if (p[0] == '-' && p[1] == '\0')        /* check for "--" */
                        return '\0';
+               if (optstring == NULL)  /* not processing the "option" */
+                       argptr--;       /* so make it be an arg again */
        }
        if (optstring == NULL)
                return '\0';



Home | Main Index | Thread Index | Old Index