1 /*- 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 05/31/93"; 10 #endif /* not lint */ 11 12 # include "hangman.h" 13 14 /* 15 * setup: 16 * Set up the strings on the screen. 17 */ 18 setup() 19 { 20 register char **sp; 21 static struct stat sbuf; 22 23 noecho(); 24 crmode(); 25 26 mvaddstr(PROMPTY, PROMPTX, "Guess:"); 27 mvaddstr(GUESSY, GUESSX, "Guessed:"); 28 mvaddstr(NUMBERY, NUMBERX, "Word #:"); 29 mvaddstr(AVGY, AVGX, "Current Average:"); 30 mvaddstr(AVGY + 1, AVGX, "Overall Average:"); 31 mvaddstr(KNOWNY, KNOWNX, "Word: "); 32 33 for (sp = Noose_pict; *sp != NULL; sp++) { 34 move(sp - Noose_pict, 0); 35 addstr(*sp); 36 } 37 38 srand(time(NULL) + getpid()); 39 if ((Dict = fopen(_PATH_DICT, "r")) == NULL) { 40 perror(_PATH_DICT); 41 endwin(); 42 exit(1); 43 } 44 fstat(fileno(Dict), &sbuf); 45 Dict_size = sbuf.st_size; 46 } 47