xref: /original-bsd/games/hangman/main.c (revision e59fb703)
1 /*
2  * Copyright (c) 1983 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 char copyright[] =
10 "@(#) Copyright (c) 1983 Regents of the University of California.\n\
11  All rights reserved.\n";
12 #endif /* not lint */
13 
14 #ifndef lint
15 static char sccsid[] = "@(#)main.c	5.4 (Berkeley) 02/28/91";
16 #endif /* not lint */
17 
18 # include	"hangman.h"
19 
20 /*
21  * This game written by Ken Arnold.
22  */
23 main()
24 {
25 	void die();
26 
27 	initscr();
28 	signal(SIGINT, die);
29 	setup();
30 	for (;;) {
31 		Wordnum++;
32 		playgame();
33 		Average = (Average * (Wordnum - 1) + Errors) / Wordnum;
34 	}
35 	/* NOTREACHED */
36 }
37 
38 /*
39  * die:
40  *	Die properly.
41  */
42 void
43 die()
44 {
45 	mvcur(0, COLS - 1, LINES - 1, 0);
46 	endwin();
47 	putchar('\n');
48 	exit(0);
49 }
50