From d065bae323838734556de2693b6b004c98c95092 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 15 Feb 2011 16:11:24 +0200 Subject: Ctrl+C handling on POSIX, some commands for server and other tweaking --- src/porting.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src/porting.cpp') diff --git a/src/porting.cpp b/src/porting.cpp index 592636336..f92b291ac 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -29,6 +29,53 @@ with this program; if not, write to the Free Software Foundation, Inc., namespace porting { +/* + Signal handler (grabs Ctrl-C on POSIX systems) +*/ + +#if !defined(_WIN32) // POSIX + #include + +bool g_killed = false; + +void sigint_handler(int sig) +{ + if(g_killed == false) + { + dstream<