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