xref: /original-bsd/games/robots/query.c (revision 0f89e6eb)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  */
6 
7 #ifndef lint
8 static char sccsid[] = "@(#)query.c	5.1 (Berkeley) 05/30/85";
9 #endif not lint
10 
11 # include	"robots.h"
12 
13 /*
14  * query:
15  *	Ask a question and get a yes or no answer.  Default is "no".
16  */
17 query(prompt)
18 char	*prompt;
19 {
20 	register int	c, retval;
21 	register int	y, x;
22 
23 	getyx(stdscr, y, x);
24 	move(Y_PROMPT, X_PROMPT);
25 	addstr(prompt);
26 	clrtoeol();
27 	refresh();
28 	retval = ((c = getchar()) == 'y' || c == 'Y');
29 	move(Y_PROMPT, X_PROMPT);
30 	clrtoeol();
31 	move(y, x);
32 	return retval;
33 }
34