Mercurial > hg > Applications > mh
diff sbr/getanswer.c @ 0:bce86c4163a3
Initial revision
author | kono |
---|---|
date | Mon, 18 Apr 2005 23:46:02 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sbr/getanswer.c Mon Apr 18 23:46:02 2005 +0900 @@ -0,0 +1,16 @@ +/* getanswer.c - get a yes/no answer from the user */ + +#include "../h/mh.h" +#include <stdio.h> + + +int getanswer (prompt) +register char *prompt; +{ + static int interactive = NOTOK; + + if (interactive < OK) + interactive = isatty (fileno (stdin)) ? DONE : OK; + + return (interactive ? gans (prompt, anoyes) : DONE); +}