static int suspend_func (void *unused) { (void) unused; if (X_Suspend_Hook != NULL) (*X_Suspend_Hook) (); else sys_suspend(); return 0; }
static SIGTYPE interrupt_signal (int sig) { /* This function can call lisp */ /* #### we should NOT be calling lisp from a signal handler, boys and girls */ /* Must preserve main program's value of errno. */ int old_errno = errno; EMACS_REESTABLISH_SIGNAL (sig, interrupt_signal); /* with the macroized error-checking stuff, the garbage below may mess things up because XCONSOLE() and such can use and change global vars. */ #if ! (defined (ERROR_CHECK_TYPECHECK) && defined (MACROIZE_ERROR_CHECKING)) if (sigint_happened && CONSOLEP (Vcontrolling_terminal) && CONSOLE_LIVE_P (XCONSOLE (Vcontrolling_terminal)) && !emacs_is_blocking) { char c; fflush (stdout); reset_initial_console (); EMACS_UNBLOCK_SIGNAL (sig); #ifdef SIGTSTP /* Support possible in later USG versions */ /* * On systems which can suspend the current process and return to the original * shell, this command causes the user to end up back at the shell. * The "Auto-save" and "Abort" questions are not asked until * the user elects to return to emacs, at which point he can save the current * job and either dump core or continue. */ sys_suspend (); #else /* Perhaps should really fork an inferior shell? But that would not provide any way to get back to the original shell, ever. */ stdout_out ("No support for stopping a process on this operating system;\n"); stdout_out ("you can continue or abort.\n"); #endif /* not SIGTSTP */ stdout_out ("Auto-save? (y or n) "); if (((c = getc (stdin)) & ~040) == 'Y') Fdo_auto_save (Qnil, Qnil); while (c != '\n') c = getc (stdin); stdout_out ("Abort (and dump core)? (y or n) "); if (((c = getc (stdin)) & ~040) == 'Y') ABORT (); while (c != '\n') c = getc (stdin); stdout_out ("Continuing...\n"); reinit_initial_console (); MARK_FRAME_CHANGED (XFRAME (DEVICE_SELECTED_FRAME (XDEVICE (CONSOLE_SELECTED_DEVICE (XCONSOLE (Vcontrolling_terminal)))))); } else #endif /* ! (defined (ERROR_CHECKING) && defined (MACROIZE_ERROR_CHECKING)) */ { /* Else request quit when it's safe */ Vquit_flag = Qt; sigint_happened = 1; #ifdef HAVE_UNIXOID_EVENT_LOOP signal_fake_event (); #endif } errno = old_errno; SIGRETURN; }