Source-Changes-HG archive

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

[src/trunk]: src/bin/sh PR bin/50896: make shift with more than 1 arg give a ...



details:   https://anonhg.NetBSD.org/src/rev/1f3731faa6e1
branches:  trunk
changeset: 343985:1f3731faa6e1
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Mar 08 14:08:39 2016 +0000

description:
PR bin/50896: make shift with more than 1 arg give a usage message, from kre

diffstat:

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

diffs (37 lines):

diff -r 1167ef9e7fcc -r 1f3731faa6e1 bin/sh/options.c
--- a/bin/sh/options.c  Tue Mar 08 09:51:15 2016 +0000
+++ b/bin/sh/options.c  Tue Mar 08 14:08:39 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: options.c,v 1.44 2016/02/24 14:38:40 christos Exp $    */
+/*     $NetBSD: options.c,v 1.45 2016/03/08 14:08:39 christos 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.44 2016/02/24 14:38:40 christos Exp $");
+__RCSID("$NetBSD: options.c,v 1.45 2016/03/08 14:08:39 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -335,6 +335,8 @@
        int n;
        char **ap1, **ap2;
 
+       if (argc > 2)
+               error("Usage: shift [n]");
        n = 1;
        if (argc > 1)
                n = number(argv[1]);
@@ -347,7 +349,8 @@
                        ckfree(*ap1);
        }
        ap2 = shellparam.p;
-       while ((*ap2++ = *ap1++) != NULL);
+       while ((*ap2++ = *ap1++) != NULL)
+               continue;
        shellparam.optnext = NULL;
        INTON;
        return 0;



Home | Main Index | Thread Index | Old Index