xref: /original-bsd/games/robots/query.c (revision efe8c834)
1 /*
2  * Copyright (c) 1980, 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[] = "@(#)query.c	8.1 (Berkeley) 05/31/93";
10 #endif /* not lint */
11 
12 # include	"robots.h"
13 
14 /*
15  * query:
16  *	Ask a question and get a yes or no answer.  Default is "no".
17  */
18 query(prompt)
19 char	*prompt;
20 {
21 	register int	c, retval;
22 	register int	y, x;
23 
24 	getyx(stdscr, y, x);
25 	move(Y_PROMPT, X_PROMPT);
26 	addstr(prompt);
27 	clrtoeol();
28 	refresh();
29 	retval = ((c = getchar()) == 'y' || c == 'Y');
30 	move(Y_PROMPT, X_PROMPT);
31 	clrtoeol();
32 	move(y, x);
33 	return retval;
34 }
35