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:
parent
e27c6c9fa2
commit
71828da5ff
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=254849
@ -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);
|
||||||
|
4
tools/regression/bin/sh/builtins/alias4.0
Normal file
4
tools/regression/bin/sh/builtins/alias4.0
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
unalias -a
|
||||||
|
alias --
|
Loading…
Reference in New Issue
Block a user