xref: /csrg-svn/games/robots/query.c (revision 60840)
121471Smckusick /*
2*60840Sbostic  * Copyright (c) 1980, 1993
3*60840Sbostic  *	The Regents of the University of California.  All rights reserved.
433690Sbostic  *
542589Sbostic  * %sccs.include.redist.c%
621471Smckusick  */
721471Smckusick 
821471Smckusick #ifndef lint
9*60840Sbostic static char sccsid[] = "@(#)query.c	8.1 (Berkeley) 05/31/93";
1033690Sbostic #endif /* not lint */
1121471Smckusick 
1221471Smckusick # include	"robots.h"
1321471Smckusick 
1421471Smckusick /*
1521471Smckusick  * query:
1621471Smckusick  *	Ask a question and get a yes or no answer.  Default is "no".
1721471Smckusick  */
query(prompt)1821471Smckusick query(prompt)
1921471Smckusick char	*prompt;
2021471Smckusick {
2121471Smckusick 	register int	c, retval;
2221471Smckusick 	register int	y, x;
2321471Smckusick 
2421471Smckusick 	getyx(stdscr, y, x);
2521471Smckusick 	move(Y_PROMPT, X_PROMPT);
2621471Smckusick 	addstr(prompt);
2721471Smckusick 	clrtoeol();
2821471Smckusick 	refresh();
2921471Smckusick 	retval = ((c = getchar()) == 'y' || c == 'Y');
3021471Smckusick 	move(Y_PROMPT, X_PROMPT);
3121471Smckusick 	clrtoeol();
3221471Smckusick 	move(y, x);
3321471Smckusick 	return retval;
3421471Smckusick }
35