diff options
author | Oliver Kiddle <opk@users.sourceforge.net> | 2004-04-20 12:11:13 +0000 |
---|---|---|
committer | Oliver Kiddle <opk@users.sourceforge.net> | 2004-04-20 12:11:13 +0000 |
commit | ca0deae382e7798eeff829d9b93472cf876574a3 (patch) | |
tree | e5d49d22db9e4521ce70fadeaec7dbe4502728b1 /Src/hashtable.c | |
parent | 8c890ebe7fb9c9335b2433148dec0588f7fa3f7a (diff) | |
download | zsh-ca0deae382e7798eeff829d9b93472cf876574a3.tar.gz zsh-ca0deae382e7798eeff829d9b93472cf876574a3.tar.xz zsh-ca0deae382e7798eeff829d9b93472cf876574a3.zip |
19767, 19785: store flags for -z and -k options to autoload allowing the
completion system to be used with ksh_autoload set
Diffstat (limited to 'Src/hashtable.c')
-rw-r--r-- | Src/hashtable.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/Src/hashtable.c b/Src/hashtable.c index b09936fa8..8b310c516 100644 --- a/Src/hashtable.c +++ b/Src/hashtable.c @@ -863,7 +863,7 @@ static void printshfuncnode(HashNode hn, int printflags) { Shfunc f = (Shfunc) hn; - char *t; + char *t = 0; if ((printflags & PRINT_NAMEONLY) || ((printflags & PRINT_WHENCE_SIMPLE) && @@ -881,32 +881,35 @@ printshfuncnode(HashNode hn, int printflags) return; } - if (f->flags & PM_UNDEFINED) - t = tricat("builtin autoload -X", - ((f->flags & PM_UNALIASED)? "U" : ""), - ((f->flags & PM_TAGGED)? "t" : "")); - else { - if (!f->funcdef) - t = 0; - else - t = getpermtext(f->funcdef, NULL); - } - quotedzputs(f->nam, stdout); - if (t) { + if (f->funcdef || f->flags & PM_UNDEFINED) { printf(" () {\n\t"); if (f->flags & PM_UNDEFINED) printf("%c undefined\n\t", hashchar); + else + t = getpermtext(f->funcdef, NULL); if (f->flags & PM_TAGGED) printf("%c traced\n\t", hashchar); - zputs(t, stdout); - if (f->funcdef && (f->funcdef->flags & EF_RUN)) { - printf("\n\t"); - quotedzputs(f->nam, stdout); - printf(" \"$@\""); - } + if (!t) { + char *fopt = "Utkz"; + int flgs[] = { + PM_UNALIASED, PM_TAGGED, PM_KSHSTORED, PM_ZSHSTORED, 0 + }; + int fl;; + + zputs("builtin autoload -X", stdout); + for (fl=0;fopt[fl];fl++) + if (f->flags & flgs[fl]) putchar(fopt[fl]); + } else { + zputs(t, stdout); + zsfree(t); + if (f->funcdef->flags & EF_RUN) { + printf("\n\t"); + quotedzputs(f->nam, stdout); + printf(" \"$@\""); + } + } printf("\n}\n"); - zsfree(t); } else { printf(" () { }\n"); } |