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