From 1ba2fac03d611ca2955e1c019c9cc9189fd2920b Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 2 Sep 2015 15:33:22 +0000 Subject: 36403: type -w += suffix alias This makes 'type -w' distinguish suffix aliases from regular aliases, like bare 'type' already does. Use-case: detecting programmatically whether the command word is indeed a valid command word (see ) --- ChangeLog | 5 +++++ Src/hashtable.c | 5 ++++- Test/A02alias.ztst | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6d4d061a1..bf10cbdac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-09-03 Daniel Shahaf + + * 36403: Src/hashtable.c Test/A02alias.ztst: type -w += + suffix alias + 2015-09-02 Barton E. Schaefer * unposted: Test/A05execution.ztst: test for 36393 diff --git a/Src/hashtable.c b/Src/hashtable.c index 90739a882..2d1ff87cb 100644 --- a/Src/hashtable.c +++ b/Src/hashtable.c @@ -1234,7 +1234,10 @@ printaliasnode(HashNode hn, int printflags) } if (printflags & PRINT_WHENCE_WORD) { - printf("%s: alias\n", a->node.nam); + if (a->node.flags & ALIAS_SUFFIX) + printf("%s: suffix alias\n", a->node.nam); + else + printf("%s: alias\n", a->node.nam); return; } diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst index b294e65ca..389617898 100644 --- a/Test/A02alias.ztst +++ b/Test/A02alias.ztst @@ -91,5 +91,8 @@ 0:unalias -a alias -s foo=print + type bar.foo; type -w bar.foo unalias -as 0:unalias -as +>foo is a suffix alias for print +>foo: suffix alias -- cgit 1.4.1