From 8218dc5ff267a1066f10d1dc24a259770c7e1257 Mon Sep 17 00:00:00 2001 From: drochner Date: Fri, 8 Aug 2008 16:10:47 +0000 Subject: if initscr() fails, exit with a message rather than crash in the next curses call --- gomoku/bdisp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gomoku') 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 #include +#include #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); -- cgit v1.2.3-56-ge451