aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/lib.c7
-rw-r--r--lib/lib.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 282e16d3..ab66b66e 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -819,11 +819,16 @@ void base64_init(char *p)
int yesno(int def)
{
+ return fyesno(stdin, def);
+}
+
+int fyesno(FILE *in, int def)
+{
char buf;
fprintf(stderr, " (%c/%c):", def ? 'Y' : 'y', def ? 'n' : 'N');
fflush(stderr);
- while (fread(&buf, 1, 1, stdin)) {
+ while (fread(&buf, 1, 1, in)) {
int new;
// The letter changes the value, the newline (or space) returns it.
diff --git a/lib/lib.h b/lib/lib.h
index 25417105..6d63bb09 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -250,6 +250,7 @@ void replace_tempfile(int fdin, int fdout, char **tempname);
void crc_init(unsigned int *crc_table, int little_endian);
void base64_init(char *p);
int yesno(int def);
+int fyesno(FILE *fp, int def);
int qstrcmp(const void *a, const void *b);
void create_uuid(char *uuid);
char *show_uuid(char *uuid);