diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2007-11-14 16:25:50 -0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2007-11-14 16:25:50 -0800 |
commit | 18d767fb17ec197d3ed24ec27a5364ee84b612ca (patch) | |
tree | 73f664a55c8a42afd3b72bb33ff5b389ad63905f /pcomplete.c | |
parent | bff0c156047ae6ca0bb9a5e04587ebe1d1ef5249 (diff) | |
download | vyatta-bash-18d767fb17ec197d3ed24ec27a5364ee84b612ca.tar.gz vyatta-bash-18d767fb17ec197d3ed24ec27a5364ee84b612ca.zip |
* add restricted modes ("output" and "full").
* support "root-level" programmable completion in restricted modes.
Diffstat (limited to 'pcomplete.c')
-rw-r--r-- | pcomplete.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/pcomplete.c b/pcomplete.c index ee462dc..74dad05 100644 --- a/pcomplete.c +++ b/pcomplete.c @@ -1353,15 +1353,20 @@ programmable_completions (cmd, word, start, end, foundp) STRINGLIST *ret; char **rmatches, *t; - /* We look at the basename of CMD if the full command does not have - an associated COMPSPEC. */ - cs = progcomp_search (cmd); - if (cs == 0) - { - t = strrchr (cmd, '/'); - if (t) - cs = progcomp_search (++t); - } + if (in_vyatta_restricted_mode(OUTPUT) && strcmp(cmd, word) == 0) { + /* command completion */ + cs = progcomp_search(""); + } else { + /* We look at the basename of CMD if the full command does not have + an associated COMPSPEC. */ + cs = progcomp_search (cmd); + if (cs == 0) + { + t = strrchr (cmd, '/'); + if (t) + cs = progcomp_search (++t); + } + } if (cs == 0) { if (foundp) |