1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-27 04:40:59 +01:00

19767, 19785: store flags for -z and -k options to autoload allowing the

completion system to be used with ksh_autoload set
This commit is contained in:
Oliver Kiddle 2004-04-20 12:11:13 +00:00
parent 8c890ebe7f
commit ca0deae382
13 changed files with 116 additions and 80 deletions

View file

@ -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");
}