diff options
author | drochner <drochner@NetBSD.org> | 2008-08-08 16:10:47 +0000 |
---|---|---|
committer | drochner <drochner@NetBSD.org> | 2008-08-08 16:10:47 +0000 |
commit | 8218dc5ff267a1066f10d1dc24a259770c7e1257 (patch) | |
tree | 0cb722dff6cd475d71113cb6ee9ef928f9ee3b17 /phantasia | |
parent | 4ca7662068dbec217082e73d01ea38705f82833b (diff) | |
download | bsdgames-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 'phantasia')
-rw-r--r-- | phantasia/main.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/phantasia/main.c b/phantasia/main.c index 11dc6fb1..996622ed 100644 --- a/phantasia/main.c +++ b/phantasia/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.16 2006/05/13 22:29:53 christos Exp $ */ +/* $NetBSD: main.c,v 1.17 2008/08/08 16:10:47 drochner Exp $ */ /* * Phantasia 3.3.2 -- Interterminal fantasy game @@ -995,7 +995,10 @@ playinit() signal(SIGPIPE, ill_sig); #endif - initscr(); /* turn on curses */ + if (!initscr()) { /* turn on curses */ + fprintf(stderr, "couldn't initialize screen\n"); + exit (0); + } noecho(); /* do not echo input */ cbreak(); /* do not process erase, kill */ clear(); |