Replace use of signal() by sigaction(). signal() is not very consistent.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@91 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Jilles Tjoelker 2004-01-05 16:10:30 +00:00
parent 9939fa7365
commit 6820e56684
1 changed files with 8 additions and 3 deletions

View File

@ -20,7 +20,7 @@
* This program can be used instead of nethack to test dgamelaunch. * This program can be used instead of nethack to test dgamelaunch.
*/ */
static const char rcsid[] = "$Id: nethackstub.c,v 1.1 2004/01/05 14:01:03 jilles Exp $"; static const char rcsid[] = "$Id: nethackstub.c,v 1.2 2004/01/05 16:10:30 jilles Exp $";
#include <sys/types.h> #include <sys/types.h>
@ -51,6 +51,7 @@ main(int argc, char *argv[])
{ {
char buf[256]; char buf[256];
int showusage = 1, n, i; int showusage = 1, n, i;
struct sigaction SA;
#define S "nethackstub started with arguments:\n" #define S "nethackstub started with arguments:\n"
write(STDOUT_FILENO, S, -1 + sizeof S); write(STDOUT_FILENO, S, -1 + sizeof S);
@ -63,8 +64,12 @@ main(int argc, char *argv[])
#undef S #undef S
} }
signal(SIGHUP, sighup); sigemptyset(&SA.sa_mask);
signal(SIGTERM, sigterm); SA.sa_flags = 0;
SA.sa_handler = sighup;
sigaction(SIGHUP, &SA, NULL);
SA.sa_handler = sigterm;
sigaction(SIGTERM, &SA, NULL);
for (;;) for (;;)
{ {