PR bin/50896: make shift with more than 1 arg give a usage message, from kre
This commit is contained in:
parent
9da4c9a5be
commit
bff14f8dfa
|
@ -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
|
* Copyright (c) 1991, 1993
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95";
|
static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95";
|
||||||
#else
|
#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
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
|
@ -335,6 +335,8 @@ shiftcmd(int argc, char **argv)
|
||||||
int n;
|
int n;
|
||||||
char **ap1, **ap2;
|
char **ap1, **ap2;
|
||||||
|
|
||||||
|
if (argc > 2)
|
||||||
|
error("Usage: shift [n]");
|
||||||
n = 1;
|
n = 1;
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
n = number(argv[1]);
|
n = number(argv[1]);
|
||||||
|
@ -347,7 +349,8 @@ shiftcmd(int argc, char **argv)
|
||||||
ckfree(*ap1);
|
ckfree(*ap1);
|
||||||
}
|
}
|
||||||
ap2 = shellparam.p;
|
ap2 = shellparam.p;
|
||||||
while ((*ap2++ = *ap1++) != NULL);
|
while ((*ap2++ = *ap1++) != NULL)
|
||||||
|
continue;
|
||||||
shellparam.optnext = NULL;
|
shellparam.optnext = NULL;
|
||||||
INTON;
|
INTON;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue