summaryrefslogtreecommitdiffstats
path: root/gomoku
diff options
context:
space:
mode:
authordrochner <drochner@NetBSD.org>2008-08-08 16:10:47 +0000
committerdrochner <drochner@NetBSD.org>2008-08-08 16:10:47 +0000
commit8218dc5ff267a1066f10d1dc24a259770c7e1257 (patch)
tree0cb722dff6cd475d71113cb6ee9ef928f9ee3b17 /gomoku
parent4ca7662068dbec217082e73d01ea38705f82833b (diff)
downloadbsdgames-darwin-8218dc5ff267a1066f10d1dc24a259770c7e1257.tar.gz
bsdgames-darwin-8218dc5ff267a1066f10d1dc24a259770c7e1257.tar.zst
bsdgames-darwin-8218dc5ff267a1066f10d1dc24a259770c7e1257.zip
if initscr() fails, exit with a message rather than crash in the
next curses call
Diffstat (limited to 'gomoku')
-rw-r--r--gomoku/bdisp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gomoku/bdisp.c b/gomoku/bdisp.c
index 522d92f1..b1f18033 100644
--- a/gomoku/bdisp.c
+++ b/gomoku/bdisp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bdisp.c,v 1.8 2003/08/07 09:37:16 agc Exp $ */
+/* $NetBSD: bdisp.c,v 1.9 2008/08/08 16:10:47 drochner Exp $ */
/*
* Copyright (c) 1994
@@ -37,12 +37,13 @@
#if 0
static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95";
#else
-__RCSID("$NetBSD: bdisp.c,v 1.8 2003/08/07 09:37:16 agc Exp $");
+__RCSID("$NetBSD: bdisp.c,v 1.9 2008/08/08 16:10:47 drochner Exp $");
#endif
#endif /* not lint */
#include <curses.h>
#include <string.h>
+#include <stdlib.h>
#include "gomoku.h"
#define SCRNH 24 /* assume 24 lines for the moment */
@@ -61,7 +62,10 @@ void
cursinit()
{
- initscr();
+ if (!initscr()) {
+ fprintf(stderr, "couldn't initialize screen\n");
+ exit (0);
+ }
noecho();
cbreak();
leaveok(stdscr, TRUE);