From 2920c227d3f8e6d8af1f2b0c3163badb95cde9b5 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 16 Sep 2008 15:02:01 +0000 Subject: 25677: add %x and %I prompt escapes for shell source code debugging tidy up interface to doshfunc() --- Src/Zle/compcore.c | 6 +++--- Src/Zle/compctl.c | 12 ++++++------ Src/Zle/zle_main.c | 5 ++--- Src/Zle/zle_misc.c | 6 +++--- 4 files changed, 14 insertions(+), 15 deletions(-) (limited to 'Src/Zle') diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index e66cf8890..9f97779ff 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -540,13 +540,13 @@ static int parwb, parwe, paroffs; static void callcompfunc(char *s, char *fn) { - Eprog prog; + Shfunc shfunc; int lv = lastval; char buf[20]; METACHECK(); - if ((prog = getshfunc(fn)) != &dummy_eprog) { + if ((shfunc = getshfunc(fn))) { char **p, *tmp; int aadd = 0, usea = 1, icf = incompfunc, osc = sfcontext; unsigned int rset, kset; @@ -814,7 +814,7 @@ callcompfunc(char *s, char *fn) while (*p) addlinknode(largs, dupstring(*p++)); } - doshfunc(fn, prog, largs, 0, 0); + doshfunc(shfunc, largs, 0, 0); cfret = lastval; lastval = olv; } OLDHEAPS; diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c index 57bfccd49..9d03635ff 100644 --- a/Src/Zle/compctl.c +++ b/Src/Zle/compctl.c @@ -3635,12 +3635,12 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd) } if (cc->func) { /* This handles the compctl -K flag. */ - Eprog prog; + Shfunc shfunc; char **r; int lv = lastval; /* Get the function. */ - if ((prog = getshfunc(cc->func)) != &dummy_eprog) { + if ((shfunc = getshfunc(cc->func))) { /* We have it, so build a argument list. */ LinkList args = newlinklist(); int osc = sfcontext; @@ -3664,7 +3664,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd) incompctlfunc = 1; sfcontext = SFC_COMPLETE; /* Call the function. */ - doshfunc(cc->func, prog, args, 0, 1); + doshfunc(shfunc, args, 0, 1); sfcontext = osc; incompctlfunc = 0; /* And get the result from the reply parameter. */ @@ -3809,12 +3809,12 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd) /* generate the user-defined display list: if anything fails, * * we silently allow the normal completion list to be used. */ char **yaptr = NULL, *uv = NULL; - Eprog prog; + Shfunc shfunc; if (cc->ylist[0] == '$' || cc->ylist[0] == '(') { /* from variable */ uv = cc->ylist + (cc->ylist[0] == '$'); - } else if ((prog = getshfunc(cc->ylist)) != &dummy_eprog) { + } else if ((shfunc = getshfunc(cc->ylist))) { /* from function: pass completions as arg list */ LinkList args = newlinklist(); LinkNode ln; @@ -3839,7 +3839,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd) if (incompfunc != 1) incompctlfunc = 1; sfcontext = SFC_COMPLETE; - doshfunc(cc->ylist, prog, args, 0, 1); + doshfunc(shfunc, args, 0, 1); sfcontext = osc; incompctlfunc = 0; uv = "reply"; diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 4bccf2d46..dc6e07f2b 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -1304,9 +1304,8 @@ execzlefunc(Thingy func, char **args, int set_bindk) r = 1; } else { Shfunc shf = (Shfunc) shfunctab->getnode(shfunctab, w->u.fnnam); - Eprog prog = (shf ? shf->funcdef : &dummy_eprog); - if(prog == &dummy_eprog) { + if (!shf) { /* the shell function doesn't exist */ char *nm = nicedup(w->u.fnnam, 0); char *msg = tricat("No such shell function `", nm, "'"); @@ -1330,7 +1329,7 @@ execzlefunc(Thingy func, char **args, int set_bindk) makezleparams(0); sfcontext = SFC_WIDGET; opts[XTRACE] = 0; - ret = doshfunc(w->u.fnnam, prog, largs, shf->node.flags, 1); + ret = doshfunc(shf, largs, shf->node.flags, 1); opts[XTRACE] = oxt; sfcontext = osc; endparamscope(); diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c index a6f7e803b..c34db2970 100644 --- a/Src/Zle/zle_misc.c +++ b/Src/Zle/zle_misc.c @@ -1358,9 +1358,9 @@ mod_export void iremovesuffix(ZLE_INT_T c, int keep) { if (suffixfunc) { - Eprog prog = getshfunc(suffixfunc); + Shfunc shfunc = getshfunc(suffixfunc); - if (prog != &dummy_eprog) { + if (shfunc) { LinkList args = newlinklist(); char buf[20]; int osc = sfcontext; @@ -1384,7 +1384,7 @@ iremovesuffix(ZLE_INT_T c, int keep) startparamscope(); makezleparams(0); sfcontext = SFC_COMPLETE; - doshfunc(suffixfunc, prog, args, 0, 1); + doshfunc(shfunc, args, 0, 1); sfcontext = osc; endparamscope(); -- cgit 1.4.1