void exitshell(int status) { struct jmploc loc1, loc2; char *p; TRACE(("pid %d, exitshell(%d)\n", getpid(), status)); if (setjmp(loc1.loc)) { goto l1; } if (setjmp(loc2.loc)) { goto l2; } handler = &loc1; if ((p = trap[0]) != NULL && *p != '\0') { trap[0] = NULL; evalstring(p, 0); } l1: handler = &loc2; /* probably unnecessary */ flushall(); #if JOBS setjobctl(0); #endif l2: _exit(status); /* NOTREACHED */ }
void exitshell(void) { struct jmploc loc; char *p; savestatus = exitstatus; TRACE(("pid %d, exitshell(%d)\n", getpid(), savestatus)); if (setjmp(loc.loc)) goto out; handler = &loc; if ((p = trap[0])) { trap[0] = NULL; evalskip = 0; evalstring(p, 0); } out: /* * Disable job control so that whoever had the foreground before we * started can get it back. */ if (likely(!setjmp(loc.loc))) setjobctl(0); flushall(); _exit(savestatus); /* NOTREACHED */ }
void exitshell(void) { struct jmploc loc; char *p; volatile int status; #ifdef HETIO hetio_reset_term(); #endif status = exitstatus; TRACE(("pid %d, exitshell(%d)\n", getpid(), status)); if (setjmp(loc.loc)) { if (exception == EXEXIT) status = exitstatus; goto out; } handler = &loc; if ((p = trap[0])) { trap[0] = NULL; evalskip = 0; evalstring(p, 0); } out: /* * Disable job control so that whoever had the foreground before we * started can get it back. */ if (likely(!setjmp(loc.loc))) setjobctl(0); flushall(); _exit(status); /* NOTREACHED */ }
SH_NORETURN_1 void exitshell(shinstance *psh, int status) { struct jmploc loc1, loc2; char *p; TRACE((psh, "pid %d, exitshell(%d)\n", sh_getpid(psh), status)); if (setjmp(loc1.loc)) { goto l1; } if (setjmp(loc2.loc)) { goto l2; } psh->handler = &loc1; if ((p = psh->trap[0]) != NULL && *p != '\0') { psh->trap[0] = NULL; evalstring(psh, p, 0); } l1: psh->handler = &loc2; /* probably unnecessary */ output_flushall(psh); #if JOBS setjobctl(psh, 0); #endif l2: sh__exit(psh, status); /* NOTREACHED */ }
void optschanged(void) { setinteractive(iflag); #ifndef NO_HISTORY histedit(); #endif setjobctl(mflag); }
void optschanged(void) { setinteractive(iflag); #ifndef SMALL histedit(); #endif setjobctl(mflag); }
void optschanged(void) { #ifdef DEBUG opentrace(); #endif setinteractive(iflag); #ifndef SMALL histedit(); #endif setjobctl(mflag); }
void exitshell_savedstatus(void) { struct jmploc loc1, loc2; char *p; int sig = 0; sigset_t sigs; if (!exiting) { if (in_dotrap && last_trapsig) { sig = last_trapsig; exiting_exitstatus = sig + 128; } else exiting_exitstatus = oexitstatus; } exitstatus = oexitstatus = exiting_exitstatus; if (setjmp(loc1.loc)) { goto l1; } if (setjmp(loc2.loc)) { goto l2; } handler = &loc1; if ((p = trap[0]) != NULL && *p != '\0') { /* * Reset evalskip, or the trap on EXIT could be * interrupted if the last command was a "return". */ evalskip = 0; trap[0] = NULL; evalstring(p, 0); } l1: handler = &loc2; /* probably unnecessary */ flushall(); #if JOBS setjobctl(0); #endif l2: if (sig != 0 && sig != SIGSTOP && sig != SIGTSTP && sig != SIGTTIN && sig != SIGTTOU) { signal(sig, SIG_DFL); sigemptyset(&sigs); sigaddset(&sigs, sig); sigprocmask(SIG_UNBLOCK, &sigs, NULL); kill(getpid(), sig); /* If the default action is to ignore, fall back to _exit(). */ } _exit(exiting_exitstatus); }
void exitshell_savedstatus(void) { struct jmploc loc; char *p; volatile int sig = 0; int s; sigset_t sigs; CTRACE(DBG_ERRS|DBG_PROCS|DBG_CMDS|DBG_TRAP, ("pid %d: exitshell_savedstatus()%s $?=%d xs=%d dt=%d ts=%d\n", getpid(), exiting ? " exiting" : "", exitstatus, exiting_status, in_dotrap, last_trapsig)); if (!exiting) { if (in_dotrap && last_trapsig) { sig = last_trapsig; exiting_status = sig + 128; } else exiting_status = exitstatus; } exitstatus = exiting_status; if (!setjmp(loc.loc)) { handler = &loc; if (!traps_invalid && (p = trap[0]) != NULL && *p != '\0') { reset_eval(); trap[0] = NULL; VTRACE(DBG_TRAP, ("exit trap: \"%s\"\n", p)); evalstring(p, 0); } } INTOFF; /* we're done, no more interrupts. */ if (!setjmp(loc.loc)) { handler = &loc; /* probably unnecessary */ flushall(); #if JOBS setjobctl(0); #endif } if ((s = sig) != 0 && s != SIGSTOP && s != SIGTSTP && s != SIGTTIN && s != SIGTTOU) { struct rlimit nocore; /* * if the signal is of the core dump variety, don't... */ nocore.rlim_cur = nocore.rlim_max = 0; (void) setrlimit(RLIMIT_CORE, &nocore); signal(s, SIG_DFL); sigemptyset(&sigs); sigaddset(&sigs, s); sigprocmask(SIG_UNBLOCK, &sigs, NULL); kill(getpid(), s); } _exit(exiting_status); /* NOTREACHED */ }