-/* $NetBSD: signal.c,v 1.6 1997/10/18 20:03:50 christos Exp $ */
+/* $NetBSD: signal.c,v 1.9 2012/06/19 05:30:44 dholland Exp $ */
/* "Larn is copyrighted 1986 by Noah Morgan.\n" */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: signal.c,v 1.6 1997/10/18 20:03:50 christos Exp $");
+__RCSID("$NetBSD: signal.c,v 1.9 2012/06/19 05:30:44 dholland Exp $");
#endif /* not lint */
-#include <stdio.h>
#include <signal.h>
+#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "header.h"
#include "extern.h"
-static void s2choose __P((void));
-static void cntlc __P((int));
-static void sgam __P((int));
-static void tstop __P((int));
-static void sigpanic __P((int));
+static void s2choose(void);
+static void cntlc(int);
+static void sgam(int);
+static void tstop(int);
+static void sigpanic(int);
#define BIT(a) (1<<((a)-1))
static void
-s2choose()
+s2choose(void)
{ /* text to be displayed if ^C during intro
* screen */
cursor(1, 24);
}
static void
-cntlc(n)
- int n;
+cntlc(int n)
{ /* what to do for a ^C */
if (nosignal)
return; /* don't do anything if inhibited */
* subroutine to save the game if a hangup signal
*/
static void
-sgam(n)
- int n;
+sgam(int n)
{
savegame(savefilename);
wizard = 1;
#ifdef SIGTSTP
static void
-tstop(n)
- int n;
+tstop(int n)
{ /* control Y */
if (nosignal)
return; /* nothing if inhibited */
* subroutine to issue the needed signal traps called from main()
*/
void
-sigsetup()
+sigsetup(void)
{
signal(SIGQUIT, cntlc);
signal(SIGINT, cntlc);
* routine to process a fatal error signal
*/
static void
-sigpanic(sig)
- int sig;
+sigpanic(int sig)
{
char buf[128];
signal(sig, SIG_DFL);
- sprintf(buf, "\nLarn - Panic! Signal %d received [SIG%s]", sig, sys_signame[sig]);
+ snprintf(buf, sizeof(buf),
+ "\nLarn - Panic! Signal %d received [SIG%s]", sig,
+ sys_signame[sig]);
write(2, buf, strlen(buf));
sleep(2);
sncbr();