xref: /original-bsd/games/hangman/main.c (revision a5e8528f)
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.3 (Berkeley) 06/01/90";
16 #endif /* not lint */
17 
18 # include	"hangman.h"
19 
20 /*
21  * This game written by Ken Arnold.
22  */
23 main()
24 {
25 	initscr();
26 	signal(SIGINT, die);
27 	setup();
28 	for (;;) {
29 		Wordnum++;
30 		playgame();
31 		Average = (Average * (Wordnum - 1) + Errors) / Wordnum;
32 	}
33 	/* NOTREACHED */
34 }
35 
36 /*
37  * die:
38  *	Die properly.
39  */
40 die()
41 {
42 	mvcur(0, COLS - 1, LINES - 1, 0);
43 	endwin();
44 	putchar('\n');
45 	exit(0);
46 }
47