File: getanswer.c

package info (click to toggle)
nmh 1.0.2-9
  • links: PTS
  • area: main
  • in suites: potato
  • size: 3,172 kB
  • ctags: 4,449
  • sloc: ansic: 50,696; sh: 1,799; makefile: 1,192; awk: 74; sed: 17
file content (19 lines) | stat: -rw-r--r-- 295 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

/*
 * getanswer.c -- get a yes/no answer from the user
 */

#include <h/mh.h>
#include <stdio.h>


int
getanswer (char *prompt)
{
    static int interactive = -1;

    if (interactive < 0)
	interactive = isatty (fileno (stdin)) ? 1 : 0;

    return (interactive ? gans (prompt, anoyes) : 1);
}