f38a834fec668d30186a97ca6916783149764bb1
[mmh] / sbr / getanswer.c
1
2 /*
3  * getanswer.c -- get a yes/no answer from the user
4  */
5
6 #include <h/mh.h>
7 #include <stdio.h>
8
9
10 int
11 getanswer (char *prompt)
12 {
13     static int interactive = -1;
14
15     if (interactive < 0)
16         interactive = isatty (fileno (stdin)) ? 1 : 0;
17
18     return (interactive ? gans (prompt, anoyes) : 1);
19 }