mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-11 13:01:28 +02:00
properly restore scriptname in doshfunc() (10620)
This commit is contained in:
parent
36b410a6f9
commit
802ae96cf9
2 changed files with 8 additions and 6 deletions
|
@ -1,5 +1,7 @@
|
||||||
2000-04-10 Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
|
2000-04-10 Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
|
||||||
|
|
||||||
|
* 10620: Src/exec.c: properly restore scriptname in doshfunc()
|
||||||
|
|
||||||
* users/3019: Completion/Core/_path_files: use special-dirs with
|
* users/3019: Completion/Core/_path_files: use special-dirs with
|
||||||
_path_files -g
|
_path_files -g
|
||||||
|
|
||||||
|
|
10
Src/exec.c
10
Src/exec.c
|
@ -3249,7 +3249,7 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
|
||||||
{
|
{
|
||||||
char **tab, **x, *oargv0;
|
char **tab, **x, *oargv0;
|
||||||
int oldzoptind, oldlastval, oldoptcind;
|
int oldzoptind, oldlastval, oldoptcind;
|
||||||
char saveopts[OPT_SIZE], *oldscriptname = NULL, *fname = dupstring(name);
|
char saveopts[OPT_SIZE], *oldscriptname = scriptname, *fname = dupstring(name);
|
||||||
int obreaks;
|
int obreaks;
|
||||||
struct funcstack fstack;
|
struct funcstack fstack;
|
||||||
#ifdef MAX_FUNCTION_DEPTH
|
#ifdef MAX_FUNCTION_DEPTH
|
||||||
|
@ -3267,10 +3267,8 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
|
||||||
starttrapscope();
|
starttrapscope();
|
||||||
|
|
||||||
tab = pparams;
|
tab = pparams;
|
||||||
if (!(flags & PM_UNDEFINED)) {
|
if (!(flags & PM_UNDEFINED))
|
||||||
oldscriptname = scriptname;
|
|
||||||
scriptname = dupstring(name);
|
scriptname = dupstring(name);
|
||||||
}
|
|
||||||
oldzoptind = zoptind;
|
oldzoptind = zoptind;
|
||||||
zoptind = 1;
|
zoptind = 1;
|
||||||
oldoptcind = optcind;
|
oldoptcind = optcind;
|
||||||
|
@ -3308,6 +3306,8 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
|
||||||
if(++funcdepth > MAX_FUNCTION_DEPTH)
|
if(++funcdepth > MAX_FUNCTION_DEPTH)
|
||||||
{
|
{
|
||||||
zerr("maximum nested function level reached", NULL, 0);
|
zerr("maximum nested function level reached", NULL, 0);
|
||||||
|
scriptname = oldscriptname;
|
||||||
|
popheap();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3328,6 +3328,7 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
|
||||||
if (!noreturnval)
|
if (!noreturnval)
|
||||||
lastval = 1;
|
lastval = 1;
|
||||||
popheap();
|
popheap();
|
||||||
|
scriptname = oldscriptname;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
prog = shf->funcdef;
|
prog = shf->funcdef;
|
||||||
|
@ -3349,7 +3350,6 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
|
||||||
pparams = tab;
|
pparams = tab;
|
||||||
optcind = oldoptcind;
|
optcind = oldoptcind;
|
||||||
zoptind = oldzoptind;
|
zoptind = oldzoptind;
|
||||||
if (oldscriptname)
|
|
||||||
scriptname = oldscriptname;
|
scriptname = oldscriptname;
|
||||||
|
|
||||||
if (isset(LOCALOPTIONS)) {
|
if (isset(LOCALOPTIONS)) {
|
||||||
|
|
Loading…
Reference in a new issue