Mon Mar 29 02:21:04 2010 UTC ()
Don't exit(0) on failure. Use errx() instead of fprintf.


(dholland)
diff -r1.12 -r1.13 src/games/gomoku/bdisp.c

cvs diff -r1.12 -r1.13 src/games/gomoku/bdisp.c (expand / switch to unified diff)

--- src/games/gomoku/bdisp.c 2009/07/13 19:05:40 1.12
+++ src/games/gomoku/bdisp.c 2010/03/29 02:21:04 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bdisp.c,v 1.12 2009/07/13 19:05:40 roy Exp $ */ 1/* $NetBSD: bdisp.c,v 1.13 2010/03/29 02:21:04 dholland Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1994 4 * Copyright (c) 1994
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell. 8 * Ralph Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,54 +27,54 @@ @@ -27,54 +27,54 @@
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE. 32 * SUCH DAMAGE.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36#ifndef lint 36#ifndef lint
37#if 0 37#if 0
38static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95"; 38static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95";
39#else 39#else
40__RCSID("$NetBSD: bdisp.c,v 1.12 2009/07/13 19:05:40 roy Exp $"); 40__RCSID("$NetBSD: bdisp.c,v 1.13 2010/03/29 02:21:04 dholland Exp $");
41#endif 41#endif
42#endif /* not lint */ 42#endif /* not lint */
43 43
44#include <curses.h> 44#include <curses.h>
45#include <string.h> 45#include <string.h>
46#include <stdlib.h> 46#include <stdlib.h>
 47#include <err.h>
47#include "gomoku.h" 48#include "gomoku.h"
48 49
49#define SCRNH 24 /* assume 24 lines for the moment */ 50#define SCRNH 24 /* assume 24 lines for the moment */
50#define SCRNW 80 /* assume 80 chars for the moment */ 51#define SCRNW 80 /* assume 80 chars for the moment */
51 52
52static int lastline; 53static int lastline;
53static char pcolor[] = "*O.?"; 54static char pcolor[] = "*O.?";
54 55
55extern int interactive; 56extern int interactive;
56extern char *plyr[]; 57extern char *plyr[];
57 58
58/* 59/*
59 * Initialize screen display. 60 * Initialize screen display.
60 */ 61 */
61void 62void
62cursinit(void) 63cursinit(void)
63{ 64{
64 65
65 if (!initscr()) { 66 if (!initscr()) {
66 fprintf(stderr, "couldn't initialize screen\n"); 67 errx(EXIT_FAILURE, "Couldn't initialize screen");
67 exit (0); 
68 } 68 }
69 noecho(); 69 noecho();
70 cbreak(); 70 cbreak();
71 leaveok(stdscr, TRUE); 71 leaveok(stdscr, TRUE);
72} 72}
73 73
74/* 74/*
75 * Restore screen display. 75 * Restore screen display.
76 */ 76 */
77void 77void
78cursfini(void) 78cursfini(void)
79{ 79{
80 80