summaryrefslogtreecommitdiff
path: root/src/utils.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-04 20:46:08 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-04 20:46:08 -0400
commit863b5d814443eb791c2dd07250ac0ae29054adb0 (patch)
treec7c1f0e284c4589c510d8d1efedc18045481bedd /src/utils.cc
parent04ac5ffcb4ae27ad85f9ab31227d16770d8f7e6e (diff)
downloadfork-ledger-863b5d814443eb791c2dd07250ac0ae29054adb0.tar.gz
fork-ledger-863b5d814443eb791c2dd07250ac0ae29054adb0.tar.bz2
fork-ledger-863b5d814443eb791c2dd07250ac0ae29054adb0.zip
Added proper handling of SIGINT (C-c) and SIGPIPE (pager quits).
Diffstat (limited to 'src/utils.cc')
-rw-r--r--src/utils.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/utils.cc b/src/utils.cc
index 74a8ea6c..d4b05fec 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -628,6 +628,23 @@ void finish_timer(const char * name)
/**********************************************************************
*
+ * Signal handlers
+ */
+
+caught_signal_t caught_signal = NONE_CAUGHT;
+
+void sigint_handler(int sig)
+{
+ caught_signal = INTERRUPTED;
+}
+
+void sigpipe_handler(int sig)
+{
+ caught_signal = PIPE_CLOSED;
+}
+
+/**********************************************************************
+ *
* General utility functions
*/