Commit | Line | Data |
---|---|---|
dcacd52b KM |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
4cd7a139 KB |
3 | * All rights reserved. |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
6 | * provided that this notice is preserved and that due credit is given | |
7 | * to the University of California at Berkeley. The name of the University | |
8 | * may not be used to endorse or promote products derived from this | |
9 | * software without specific prior written permission. This software | |
10 | * is provided ``as is'' without express or implied warranty. | |
dcacd52b KM |
11 | */ |
12 | ||
13 | #ifndef lint | |
4cd7a139 KB |
14 | static char sccsid[] = "@(#)query.c 5.2 (Berkeley) %G%"; |
15 | #endif /* not lint */ | |
dcacd52b KM |
16 | |
17 | # include "robots.h" | |
18 | ||
19 | /* | |
20 | * query: | |
21 | * Ask a question and get a yes or no answer. Default is "no". | |
22 | */ | |
23 | query(prompt) | |
24 | char *prompt; | |
25 | { | |
26 | register int c, retval; | |
27 | register int y, x; | |
28 | ||
29 | getyx(stdscr, y, x); | |
30 | move(Y_PROMPT, X_PROMPT); | |
31 | addstr(prompt); | |
32 | clrtoeol(); | |
33 | refresh(); | |
34 | retval = ((c = getchar()) == 'y' || c == 'Y'); | |
35 | move(Y_PROMPT, X_PROMPT); | |
36 | clrtoeol(); | |
37 | move(y, x); | |
38 | return retval; | |
39 | } |