From ca0deae382e7798eeff829d9b93472cf876574a3 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 20 Apr 2004 12:11:13 +0000 Subject: 19767, 19785: store flags for -z and -k options to autoload allowing the completion system to be used with ksh_autoload set --- Src/hashtable.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'Src/hashtable.c') 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"); } -- cgit 1.4.1