xref: /csrg-svn/games/robots/query.c (revision 33690)
121471Smckusick /*
221471Smckusick  * Copyright (c) 1980 Regents of the University of California.
3*33690Sbostic  * All rights reserved.
4*33690Sbostic  *
5*33690Sbostic  * Redistribution and use in source and binary forms are permitted
6*33690Sbostic  * provided that this notice is preserved and that due credit is given
7*33690Sbostic  * to the University of California at Berkeley. The name of the University
8*33690Sbostic  * may not be used to endorse or promote products derived from this
9*33690Sbostic  * software without specific prior written permission. This software
10*33690Sbostic  * is provided ``as is'' without express or implied warranty.
1121471Smckusick  */
1221471Smckusick 
1321471Smckusick #ifndef lint
14*33690Sbostic static char sccsid[] = "@(#)query.c	5.2 (Berkeley) 03/09/88";
15*33690Sbostic #endif /* not lint */
1621471Smckusick 
1721471Smckusick # include	"robots.h"
1821471Smckusick 
1921471Smckusick /*
2021471Smckusick  * query:
2121471Smckusick  *	Ask a question and get a yes or no answer.  Default is "no".
2221471Smckusick  */
2321471Smckusick query(prompt)
2421471Smckusick char	*prompt;
2521471Smckusick {
2621471Smckusick 	register int	c, retval;
2721471Smckusick 	register int	y, x;
2821471Smckusick 
2921471Smckusick 	getyx(stdscr, y, x);
3021471Smckusick 	move(Y_PROMPT, X_PROMPT);
3121471Smckusick 	addstr(prompt);
3221471Smckusick 	clrtoeol();
3321471Smckusick 	refresh();
3421471Smckusick 	retval = ((c = getchar()) == 'y' || c == 'Y');
3521471Smckusick 	move(Y_PROMPT, X_PROMPT);
3621471Smckusick 	clrtoeol();
3721471Smckusick 	move(y, x);
3821471Smckusick 	return retval;
3921471Smckusick }
40