summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>1998-08-29 23:19:13 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>1998-08-29 23:19:13 +0000
commite0f0fc164b9c4554dbca60b9c1df8c30d35598d7 (patch)
treea9316c29ee265dbad182830818e649ea82303e18
parent48adb27998c1144d802791e25c55bed63e44d7f1 (diff)
use names rather than numbers in signals, errors, etc; NetBSD PR6058; jsm28@cam.ac.uk
-rw-r--r--games/backgammon/backgammon/main.c6
-rw-r--r--games/backgammon/common_source/save.c11
-rw-r--r--games/backgammon/teachgammon/teach.c6
3 files changed, 11 insertions, 12 deletions
diff --git a/games/backgammon/backgammon/main.c b/games/backgammon/backgammon/main.c
index a890a53b050..76847637b8a 100644
--- a/games/backgammon/backgammon/main.c
+++ b/games/backgammon/backgammon/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.4 1998/03/19 11:13:07 pjanzen Exp $ */
+/* $OpenBSD: main.c,v 1.5 1998/08/29 23:19:07 pjanzen Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.4 1998/03/19 11:13:07 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.5 1998/08/29 23:19:07 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -113,7 +113,7 @@ main (argc,argv)
/* initialization */
bflag = 2; /* default no board */
- signal(2, getout); /* trap interrupts */
+ signal(SIGINT, getout); /* trap interrupts */
if (tcgetattr(0, &old) == -1) /* get old tty mode */
errexit("backgammon(gtty)");
noech = old;
diff --git a/games/backgammon/common_source/save.c b/games/backgammon/common_source/save.c
index 6fbce3089c9..1c65c5dd33a 100644
--- a/games/backgammon/common_source/save.c
+++ b/games/backgammon/common_source/save.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: save.c,v 1.3 1998/03/19 11:13:25 pjanzen Exp $ */
+/* $OpenBSD: save.c,v 1.4 1998/08/29 23:19:09 pjanzen Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -37,14 +37,13 @@
#if 0
static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: save.c,v 1.3 1998/03/19 11:13:25 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: save.c,v 1.4 1998/08/29 23:19:09 pjanzen Exp $";
#endif
#endif /* not lint */
+#include <errno.h>
#include "back.h"
-extern int errno;
-
static char confirm[] = "Are you sure you want to leave now?";
static char prompt[] = "Enter a file name: ";
static char exist1[] = "The file '";
@@ -93,7 +92,7 @@ save(n)
writec(*fs++);
}
*fs = '\0';
- if ((fdesc = open(fname, 2)) == -1 && errno == 2) {
+ if ((fdesc = open(fname, O_RDWR)) == -1 && errno == ENOENT) {
if ((fdesc = creat(fname, 0600)) != -1)
break;
}
@@ -153,7 +152,7 @@ recover(s)
{
int fdesc;
- if ((fdesc = open(s, 0)) == -1)
+ if ((fdesc = open(s, O_RDONLY)) == -1)
norec(s);
read(fdesc, board, sizeof(board));
read(fdesc, off, sizeof(off));
diff --git a/games/backgammon/teachgammon/teach.c b/games/backgammon/teachgammon/teach.c
index 624683d5491..3531a04db28 100644
--- a/games/backgammon/teachgammon/teach.c
+++ b/games/backgammon/teachgammon/teach.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: teach.c,v 1.4 1998/03/19 11:13:31 pjanzen Exp $ */
+/* $OpenBSD: teach.c,v 1.5 1998/08/29 23:19:12 pjanzen Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: teach.c,v 1.4 1998/03/19 11:13:31 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: teach.c,v 1.5 1998/08/29 23:19:12 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -76,7 +76,7 @@ main(argc, argv)
setegid(getgid());
setgid(getgid());
- signal(2, getout);
+ signal(SIGINT, getout);
if (tcgetattr(0, &old) == -1) /* get old tty mode */
errexit("teachgammon(gtty)");
noech = old;