blob: 44396af925beecbc8ba5cf66d0a25de1ad2a66d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/* See LICENSE file for copyright and license details. */
#include <stdarg.h>
#include <ctype.h>
#include "../util.h"
int
confirm(const char *fmt, ...)
{
int c, ans;
va_list ap;
va_start(ap, fmt);
xvprintf(fmt, ap);
va_end(ap);
c = getchar();
ans = (c == 'y' || c == 'Y');
while (c != '\n' && c != EOF)
c = getchar();
return ans;
}
|