+/*
+ * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include "handleSignal.h"
#include <iostream>
#include <signal.h>
+#include <stdlib.h>
/// ***** Private Method Headers *****
-void sighandler( int sig );
+static void sighandler( int iSig );
/// ***** Public Methods *****
void installSignal()
{
+#ifndef __WIN32__
// register signal handler
struct sigaction sa;
sigemptyset( &sa.sa_mask );
{
std::cerr << "could not install SIGINT handler" << std::endl;
}
+#endif // __WIN32__
}
/// ***** Private Methods *****
// signal handler function
-void sighandler( int sig )
+void sighandler( int iSig )
{
- switch(sig)
+#ifndef __WIN32__
+ switch(iSig)
{
case SIGINT:
std::cerr << "SIGINT caught" << std::endl;
}
// normally an abort is better ... but this is just SIGINT
- exit(sig);
+ exit(iSig);
+#endif // __WIN32__
}