From 9f8a1826d043df4fe5e5992337b229e24c5070e4 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 21 Aug 2017 21:20:38 -0400 Subject: [PATCH] e2fsck: in ask_yn() fall back to English yes/no characters In the case of missing translations, if the translation for y/n is missing due to fuzzy transactions, such that user is told to use , those characters will work correctly. Addresses-Debian-Bug: #856586 Signed-off-by: Theodore Ts'o --- e2fsck/util.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/e2fsck/util.c b/e2fsck/util.c index 87d320b..43cb7a7 100644 --- a/e2fsck/util.c +++ b/e2fsck/util.c @@ -196,6 +196,9 @@ int ask_yn(e2fsck_t ctx, const char * string, int def) const char *short_yes = _("yY"); const char *short_no = _("nN"); const char *short_yesall = _("aA"); + const char *english_yes = "yY"; + const char *english_no = "nN"; + const char *english_yesall = "aA"; const char *yesall_prompt = _(" ('a' enables 'yes' to all) "); const char *extra_prompt = ""; static int yes_answers; @@ -244,19 +247,28 @@ int ask_yn(e2fsck_t ctx, const char * string, int def) return 0; } if (strchr(short_yes, (char) c)) { + do_yes: def = 1; if (yes_answers >= 0) yes_answers++; break; } else if (strchr(short_no, (char) c)) { + do_no: def = 0; yes_answers = -1; break; } else if (strchr(short_yesall, (char)c)) { + do_all: def = 2; yes_answers = -1; ctx->options |= E2F_OPT_YES; break; + } else if (strchr(english_yes, (char) c)) { + goto do_yes; + } else if (strchr(english_no, (char) c)) { + goto do_no; + } else if (strchr(english_yesall, (char) c)) { + goto do_all; } else if ((c == 27 || c == ' ' || c == '\n') && (def != -1)) { yes_answers = -1; break; -- 1.8.3.1