|
|
1.1 ! root 1: #include "rc.h" ! 2: #include "exec.h" ! 3: #include "fns.h" ! 4: #include "io.h" ! 5: char *Signame[]; ! 6: void dotrap(void){ ! 7: register int i; ! 8: register struct var *trapreq; ! 9: register struct word *starval; ! 10: starval=vlook("*")->val; ! 11: while(ntrap) for(i=0;i!=NSIG;i++) while(trap[i]){ ! 12: --trap[i]; ! 13: --ntrap; ! 14: if(getpid()!=mypid) Exit(getstatus()); ! 15: trapreq=vlook(Signame[i]); ! 16: if(trapreq->fn){ ! 17: start(trapreq->fn, trapreq->pc, (struct var *)0); ! 18: runq->local=newvar(strdup("*"), runq->local); ! 19: runq->local->val=copywords(starval, (struct word *)0); ! 20: runq->local->changed=1; ! 21: runq->redir=runq->startredir=0; ! 22: } ! 23: else if(i==SIGINT || i==SIGQUIT){ ! 24: /* ! 25: * run the stack down until we uncover the ! 26: * command reading loop. Xreturn will exit ! 27: * if there is none (i.e. if this is not ! 28: * an interactive rc.) ! 29: */ ! 30: while(!runq->iflag) Xreturn(); ! 31: } ! 32: else Exit(getstatus()); ! 33: } ! 34: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.