Lines Matching defs:shp

63 	register Shell_t	*shp = sh_getinterp();
66 register struct checkpt *pp = (struct checkpt*)shp->jmplist;
82 shp->winch++;
85 if(shp->savesig)
88 shp->savesig = sig;
91 trap = shp->st.trapcom[sig];
92 if(sig==SIGALRM && shp->bltinfun==b_sleep)
96 shp->trapnote |= SH_SIGTRAP;
97 shp->sigflag[sig] |= SH_SIGTRAP;
101 if(shp->subshell && sig!=SIGINT && sig!=SIGQUIT && sig!=SIGWINCH && sig!=SIGCONT)
103 shp->exitval = SH_EXITSIG|sig;
105 shp->exitval = 0;
111 flag = shp->sigflag[sig]&~SH_SIGOFF;
114 if(sig==SIGINT && (shp->trapnote&SH_SIGIGNORE))
121 if((flag&SH_SIGINTERACTIVE) && sh_isstate(SH_INTERACTIVE) && !sh_isstate(SH_FORKED) && ! shp->subshell)
125 shp->trapnote |= SH_SIGTERM;
128 shp->lastsig = sig;
138 if(!shp->subshell)
139 sh_done(shp,sig);
143 shp->trapnote |= SH_SIGSET;
144 if(sig <= shp->sigmax)
145 shp->sigflag[sig] |= SH_SIGSET;
161 shp->lastsig = sig;
173 shp->lastsig = sig;
178 shp->trapnote |= SH_SIGTSTP;
189 if((error_info.flags&ERROR_NOTIFY) && shp->bltinfun)
190 action = (*shp->bltinfun)(-sig,(char**)0,(void*)0);
194 if(shp->bltinfun && shp->bltindata.notify)
196 shp->bltindata.sigset = 1;
199 shp->trapnote |= flag;
200 if(sig <= shp->sigmax)
201 shp->sigflag[sig] |= flag;
216 Shell_t *shp = (Shell_t*)ptr;
224 shp->sigruntime[SH_SIGRTMIN] = n;
225 shp->sigruntime[SH_SIGRTMAX] = sig;
235 sig = shp->sigruntime[sig];
241 shp->sigmax = n++;
242 shp->st.trapcom = (char**)calloc(n,sizeof(char*));
243 shp->sigflag = (unsigned char*)calloc(n,1);
244 shp->sigmsg = (char**)calloc(n,sizeof(char*));
248 if((sig &= ((1<<SH_SIGBITS)-1)) > (shp->sigmax+1))
252 sig = shp->sigruntime[sig];
255 shp->sigflag[sig] = n;
257 shp->sigmsg[sig] = (char*)tp->sh_value;
437 Shell_t *shp = sh_getinterp();
438 int jmpval, savxit = shp->exitval;
447 memcpy(ifstable,shp->ifstable,sizeof(ifstable));
450 shp->intrap++;
474 savxit = shp->exitval;
479 shp->intrap--;
480 sfsync(shp->outpool);
481 if(!shp->indebug && jmpval!=SH_JMPEXIT && jmpval!=SH_JMPFUN)
482 shp->exitval=savxit;
485 memcpy(shp->ifstable,ifstable,sizeof(ifstable));
491 if(jmpval>SH_JMPTRAP && (((struct checkpt*)shp->jmpbuffer)->prev || ((struct checkpt*)shp->jmpbuffer)->mode==SH_JMPSCRIPT))
492 siglongjmp(*shp->jmplist,jmpval);
493 return(shp->exitval);
501 Shell_t *shp = &sh;
502 register struct checkpt *pp = (struct checkpt*)shp->jmplist;
505 shp->exitval=xno;
507 shp->exitval |= (sig=shp->lastsig);
509 if(shp->trapnote&SH_SIGTSTP)
512 shp->trapnote = 0;
513 shp->sigflag[SIGTSTP] = 0;
514 if(!shp->subshell && sh_isstate(SH_MONITOR) && !sh_isstate(SH_STOPOK))
519 shp->lastsig = 0;
522 shp->trapnote = 0;
523 if(!shp->subshell && (sig=sh_fork(0,NIL(int*))))
529 shp->sigflag[SIGTSTP] = 0;
531 shp->exitval = (SH_EXITSIG|SIGTSTP);
537 if(shp->subshell)
542 shp->sigflag[SIGTSTP] = 0;
547 shp->forked = 1;
548 shp->exitval = (xno&SH_EXITMASK);
555 if(!(pool=sfpool(NIL(Sfio_t*),shp->outpool,SF_WRITE)))
556 pool = shp->outpool; /* can't happen? */
559 if(shp->lastsig==SIGPIPE)
564 sh_done(shp,sig);
565 shp->prefix = 0;
567 shp->mktype = 0;
570 sh_done(shp,sig);
589 Shell_t *shp = (Shell_t*)ptr;
591 register int savxit = shp->exitval;
592 shp->trapnote = 0;
596 if(shp->userinit)
597 (*shp->userinit)(shp, -1);
598 if(t=shp->st.trapcom[0])
600 shp->st.trapcom[0]=0; /*should free but not long */
601 shp->oldexit = savxit;
603 savxit = shp->exitval;
611 nv_scan(shp->var_tree,array_notify,(void*)0,NV_ARRAY,NV_ARRAY);
612 sh_freeup(shp);
621 if((sh_isoption(SH_INTERACTIVE) && shp->login_sh) || (!sh_isoption(SH_INTERACTIVE) && (sig==SIGHUP)))
624 job_close(shp);
625 if(nv_search("VMTRACE", shp->var_tree,0))
628 sfsync((Sfio_t*)shp->outpool);
642 kiaclose((Lex_t*)shp->lex_context);