From 59cd1d2d278ce3afe7e2f3c1e7dd87f1e8e7a3fe Mon Sep 17 00:00:00 2001 From: jilles Date: Sun, 25 Aug 2013 11:42:53 +0000 Subject: sh: Recognize "--" as end of options in alias builtin. Aliases starting with "-" (which are non-POSIX) will need to be preceded by an alias not starting with "-" or the newly added "--". --- bin/sh/alias.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/sh/alias.c b/bin/sh/alias.c index da995bb..044c869 100644 --- a/bin/sh/alias.c +++ b/bin/sh/alias.c @@ -237,17 +237,19 @@ printaliases(void) } int -aliascmd(int argc, char **argv) +aliascmd(int argc __unused, char **argv __unused) { char *n, *v; int ret = 0; struct alias *ap; - if (argc == 1) { + nextopt(""); + + if (*argptr == NULL) { printaliases(); return (0); } - while ((n = *++argv) != NULL) { + while ((n = *argptr++) != NULL) { if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */ if ((ap = lookupalias(n, 0)) == NULL) { warning("%s: not found", n); -- cgit v1.1