summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-07-20 23:46:15 -0400
committerTavian Barnes <tavianator@tavianator.com>2017-07-20 23:46:15 -0400
commit49fa21d023feb89e236ad4d655d96dde3574560e (patch)
tree83ad421695a488680315847c76558d7d2d88049c /util.c
parentbcbdf3f2c90897769394d6d0d23e7714ec471d4f (diff)
downloadbfs-49fa21d023feb89e236ad4d655d96dde3574560e.tar.xz
main: Call setlocale() at startup to use the system locale
Diffstat (limited to 'util.c')
-rw-r--r--util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/util.c b/util.c
index 81eeda0..0d7e17d 100644
--- a/util.c
+++ b/util.c
@@ -373,6 +373,16 @@ static int xrpmatch(const char *response) {
ret = xrpregex(YESEXPR, response);
if (ret == 0) {
return 1;
+ } else if (ret != REG_NOMATCH) {
+ return -1;
+ }
+
+ // Failsafe: always handle y/n
+ char c = response[0];
+ if (c == 'n' || c == 'N') {
+ return 0;
+ } else if (c == 'y' || c == 'Y') {
+ return 1;
} else {
return -1;
}