/* quit.h -- How to handle SIGINT gracefully. */
-/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2013 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#if !defined (_QUIT_H_)
#define _QUIT_H_
-/* Non-zero means SIGINT has already ocurred. */
-extern volatile int interrupt_state;
-extern volatile int terminating_signal;
+#include "sig.h" /* for sig_atomic_t */
+
+/* Non-zero means SIGINT has already occurred. */
+extern volatile sig_atomic_t interrupt_state;
+extern volatile sig_atomic_t terminating_signal;
/* Macro to call a great deal. SIGINT just sets the interrupt_state variable.
When it is safe, put QUIT in the code, and the "interrupt" will take
if (interrupt_state) throw_to_top_level (); \
} while (0)
+#define CHECK_ALRM \
+ do { \
+ if (sigalrm_seen) \
+ longjmp (alrmbuf, 1); \
+ } while (0)
+
#define SETINTERRUPT interrupt_state = 1
#define CLRINTERRUPT interrupt_state = 0
if (terminating_signal) termsig_handler (terminating_signal); \
} while (0)
+#define LASTSIG() \
+ (terminating_signal ? terminating_signal : (interrupt_state ? SIGINT : 0))
+
+#define CHECK_WAIT_INTR \
+ do { \
+ if (wait_signal_received && this_shell_builtin && (this_shell_builtin == wait_builtin)) \
+ longjmp (wait_intr_buf, 1); \
+ } while (0)
+
+#define RESET_SIGTERM \
+ do { \
+ sigterm_received = 0; \
+ } while (0)
+
+#define CHECK_SIGTERM \
+ do { \
+ if (sigterm_received) termsig_handler (SIGTERM); \
+ } while (0)
#endif /* _QUIT_H_ */