summaryrefslogtreecommitdiff
path: root/Src/Zle/computil.c
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-08-14 08:16:45 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-08-14 08:16:45 +0000
commit90c6d73b568cd48c9cad0ae511c5605a9f4c1203 (patch)
tree695dbfd2932de638fe949aac6ef55e6df704de47 /Src/Zle/computil.c
parent135b181aa6428bafa62b5029bfd944e88a20fa9c (diff)
downloadzsh-90c6d73b568cd48c9cad0ae511c5605a9f4c1203.tar.gz
zsh-90c6d73b568cd48c9cad0ae511c5605a9f4c1203.zip
make all builtins in computil test if they were called from a completion function (12610)
Diffstat (limited to 'Src/Zle/computil.c')
-rw-r--r--Src/Zle/computil.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index fcc79b2c4..b42e2a4c5 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -2587,6 +2587,10 @@ bin_compquote(char *nam, char **args, char *ops, int func)
struct value vbuf;
Value v;
+ if (incompfunc != 1) {
+ zwarnnam(nam, "can only be called from completion function", NULL, 0);
+ return 1;
+ }
/* Anything to do? */
if (!compqstack || !*compqstack)
@@ -3547,6 +3551,10 @@ cf_remove_other(char **names, char *pre, int *amb)
static int
bin_compfiles(char *nam, char **args, char *ops, int func)
{
+ if (incompfunc != 1) {
+ zwarnnam(nam, "can only be called from completion function", NULL, 0);
+ return 1;
+ }
if (**args != '-') {
zwarnnam(nam, "missing option: %s", *args, 0);
return 1;
@@ -3640,6 +3648,10 @@ bin_compgroups(char *nam, char **args, char *ops, int func)
Heap oldheap;
char *n;
+ if (incompfunc != 1) {
+ zwarnnam(nam, "can only be called from completion function", NULL, 0);
+ return 1;
+ }
SWITCHHEAPS(oldheap, compheap) {
while ((n = *args++)) {
endcmgroup(NULL);