summaryrefslogtreecommitdiffstats
path: root/exec.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-07-15 22:56:11 -0400
committerTavian Barnes <tavianator@tavianator.com>2017-07-15 22:56:11 -0400
commitdb2fa0e1059a2426a1afa4fc0c97d6f85f176641 (patch)
treebc3684b2e776af6ab55560aa0174c099c7f01196 /exec.c
parent7b1adcebf65d2131c4d324e73a3e3eace6b2ec28 (diff)
downloadbfs-db2fa0e1059a2426a1afa4fc0c97d6f85f176641.tar.xz
Handle yes/no prompts correctly according to the locale
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/exec.c b/exec.c
index 3178dbe..62eeaee 100644
--- a/exec.c
+++ b/exec.c
@@ -342,14 +342,8 @@ static int bfs_exec_spawn(const struct bfs_exec *execbuf) {
fprintf(stderr, "%s ", execbuf->argv[i]);
}
fprintf(stderr, "? ");
- fflush(stderr);
- int c = getchar();
- bool exec = c == 'y' || c == 'Y';
- while (c != '\n' && c != EOF) {
- c = getchar();
- }
- if (!exec) {
+ if (ynprompt() <= 0) {
errno = 0;
return -1;
}