]> diplodocus.org Git - nmh/blob - sbr/read_yes_or_no_if_tty.c
8d7dac6eb901aff64e9b09715ea639b0eca4d0ee
[nmh] / sbr / read_yes_or_no_if_tty.c
1 /* read_yes_or_no_if_tty.c -- get a yes/no answer from the user
2 *
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
6 */
7
8 #include "h/mh.h"
9
10
11 int
12 read_yes_or_no_if_tty (const char *prompt)
13 {
14 static int interactive = -1;
15
16 if (interactive < 0)
17 interactive = isatty (fileno (stdin));
18
19 return interactive ? read_switch(prompt, anoyes) : 1;
20 }