summaryrefslogtreecommitdiff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-09-16 15:02:01 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-09-16 15:02:01 +0000
commit2920c227d3f8e6d8af1f2b0c3163badb95cde9b5 (patch)
tree854021a4e3cfa7a72bf67a364ce55e6803ca800b /Src/exec.c
parent14905ddc74f78b54c75434c8a4d7e029b1933280 (diff)
downloadzsh-2920c227d3f8e6d8af1f2b0c3163badb95cde9b5.tar.gz
zsh-2920c227d3f8e6d8af1f2b0c3163badb95cde9b5.zip
25677: add %x and %I prompt escapes for shell source code debugging
tidy up interface to doshfunc()
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/Src/exec.c b/Src/exec.c
index a8098e5f8..781598cc1 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -518,7 +518,7 @@ commandnotfound(char *arg0, LinkList args)
return 127;
pushnode(args, arg0);
- return doshfunc(shf->node.nam, shf->funcdef, args, shf->node.flags, 1);
+ return doshfunc(shf, args, shf->node.flags, 1);
}
/* execute an external command */
@@ -4064,7 +4064,7 @@ execshfunc(Shfunc shf, LinkList args)
cmdsp = 0;
if ((osfc = sfcontext) == SFC_NONE)
sfcontext = SFC_DIRECT;
- doshfunc(shf->node.nam, shf->funcdef, args, shf->node.flags, 0);
+ doshfunc(shf, args, shf->node.flags, 0);
sfcontext = osfc;
free(cmdstack);
cmdstack = ocs;
@@ -4200,18 +4200,20 @@ loadautofn(Shfunc shf, int fksh, int autol)
/**/
mod_export int
-doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
+doshfunc(Shfunc shfunc, LinkList doshargs, int flags, int noreturnval)
{
char **tab, **x, *oargv0;
int oldzoptind, oldlastval, oldoptcind, oldnumpipestats, ret;
int *oldpipestats = NULL;
- char saveopts[OPT_SIZE], *oldscriptname = scriptname, *fname = dupstring(name);
+ char saveopts[OPT_SIZE], *oldscriptname = scriptname;
+ char *name = shfunc->node.nam;
+ char *fname = dupstring(name);
int obreaks, saveemulation ;
+ Eprog prog;
struct funcstack fstack;
#ifdef MAX_FUNCTION_DEPTH
static int funcdepth;
#endif
- Shfunc shf;
pushheap();
@@ -4291,14 +4293,10 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
fstack.tp = FS_FUNC;
funcstack = &fstack;
- if ((shf = (Shfunc) shfunctab->getnode(shfunctab, name))) {
- fstack.flineno = shf->lineno;
- fstack.filename = dupstring(shf->filename);
- } else {
- fstack.flineno = 0;
- fstack.filename = dupstring(fstack.caller);
- }
+ fstack.flineno = shfunc->lineno;
+ fstack.filename = dupstring(shfunc->filename);
+ prog = shfunc->funcdef;
if (prog->flags & EF_RUN) {
Shfunc shf;