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 "--".
This commit is contained in:
Jilles Tjoelker 2013-08-25 11:42:53 +00:00
parent e27c6c9fa2
commit 71828da5ff
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=254849
2 changed files with 9 additions and 3 deletions

View File

@ -237,17 +237,19 @@ printaliases(void)
} }
int int
aliascmd(int argc, char **argv) aliascmd(int argc __unused, char **argv __unused)
{ {
char *n, *v; char *n, *v;
int ret = 0; int ret = 0;
struct alias *ap; struct alias *ap;
if (argc == 1) { nextopt("");
if (*argptr == NULL) {
printaliases(); printaliases();
return (0); return (0);
} }
while ((n = *++argv) != NULL) { while ((n = *argptr++) != NULL) {
if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */ if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */
if ((ap = lookupalias(n, 0)) == NULL) { if ((ap = lookupalias(n, 0)) == NULL) {
warning("%s: not found", n); warning("%s: not found", n);

View File

@ -0,0 +1,4 @@
# $FreeBSD$
unalias -a
alias --