summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-08-25 11:42:53 +0000
committerjilles <jilles@FreeBSD.org>2013-08-25 11:42:53 +0000
commit59cd1d2d278ce3afe7e2f3c1e7dd87f1e8e7a3fe (patch)
tree60e18123a1f3dda8b1ad4f3669d8d9f1079b7819 /bin/sh
parent768857b2f8f1c01fc5031d4f049eeb1576c12290 (diff)
downloadFreeBSD-src-59cd1d2d278ce3afe7e2f3c1e7dd87f1e8e7a3fe.zip
FreeBSD-src-59cd1d2d278ce3afe7e2f3c1e7dd87f1e8e7a3fe.tar.gz
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 "--".
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/alias.c8
1 files changed, 5 insertions, 3 deletions
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);
OpenPOWER on IntegriCloud