1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-17 15:01:40 +02:00

zsh-workers/9318

This commit is contained in:
Tanaka Akira 2000-01-14 15:55:31 +00:00
parent c64a281a9b
commit 9fc3e9a8db
3 changed files with 15 additions and 10 deletions

View file

@ -1053,7 +1053,7 @@ execpline2(Pline pline, int how, int input, int output, int last1)
lineno = pline->left->lineno; lineno = pline->left->lineno;
if (pline_level == 1) { if (pline_level == 1) {
if (!sfcontext) if ((how & Z_ASYNC) || (!sfcontext && !sourcelevel))
strcpy(list_pipe_text, getjobtext((void *) pline->left)); strcpy(list_pipe_text, getjobtext((void *) pline->left));
else else
list_pipe_text[0] = '\0'; list_pipe_text[0] = '\0';
@ -1639,7 +1639,8 @@ execcmd(Cmd cmd, int input, int output, int how, int last1)
} }
/* Get the text associated with this command. */ /* Get the text associated with this command. */
if (!sfcontext && (jobbing || (how & Z_TIMED))) if ((how & Z_ASYNC) ||
(!sfcontext && !sourcelevel && (jobbing || (how & Z_TIMED))))
text = getjobtext((void *) cmd); text = getjobtext((void *) cmd);
else else
text = NULL; text = NULL;
@ -2854,7 +2855,7 @@ execshfunc(Cmd cmd, Shfunc shf, LinkList args)
{ {
LinkList last_file_list = NULL; LinkList last_file_list = NULL;
unsigned char *ocs; unsigned char *ocs;
int ocsp; int ocsp, osfc;
if (errflag) if (errflag)
return; return;
@ -2882,7 +2883,10 @@ execshfunc(Cmd cmd, Shfunc shf, LinkList args)
ocsp = cmdsp; ocsp = cmdsp;
cmdstack = (unsigned char *) zalloc(CMDSTACKSZ); cmdstack = (unsigned char *) zalloc(CMDSTACKSZ);
cmdsp = 0; cmdsp = 0;
if ((osfc = sfcontext) == SFC_NONE)
sfcontext = SFC_DIRECT;
doshfunc(shf->nam, shf->funcdef, args, shf->flags, 0); doshfunc(shf->nam, shf->funcdef, args, shf->flags, 0);
sfcontext = osfc;
free(cmdstack); free(cmdstack);
cmdstack = ocs; cmdstack = ocs;
cmdsp = ocsp; cmdsp = ocsp;

View file

@ -708,7 +708,7 @@ setupvals(void)
breaks = loops = 0; breaks = loops = 0;
lastmailcheck = time(NULL); lastmailcheck = time(NULL);
locallevel = sourcelevel = 0; locallevel = sourcelevel = 0;
sfcontext = SFC_DIRECT; sfcontext = SFC_NONE;
trapreturn = 0; trapreturn = 0;
noerrexit = -1; noerrexit = -1;
nohistsave = 1; nohistsave = 1;

View file

@ -850,12 +850,13 @@ struct shfunc {
/* Shell function context types. */ /* Shell function context types. */
#define SFC_DIRECT 0 /* called directly from the user */ #define SFC_NONE 0 /* no function running */
#define SFC_SIGNAL 1 /* signal handler */ #define SFC_DIRECT 1 /* called directly from the user */
#define SFC_HOOK 2 /* one of the special functions */ #define SFC_SIGNAL 2 /* signal handler */
#define SFC_WIDGET 3 /* user defined widget */ #define SFC_HOOK 3 /* one of the special functions */
#define SFC_COMPLETE 4 /* called from completion code */ #define SFC_WIDGET 4 /* user defined widget */
#define SFC_CWIDGET 5 /* new style completion widget */ #define SFC_COMPLETE 5 /* called from completion code */
#define SFC_CWIDGET 6 /* new style completion widget */
/* node in list of function call wrappers */ /* node in list of function call wrappers */