From: Theodore Ts'o Date: Tue, 22 Aug 2017 01:20:38 +0000 (-0400) Subject: e2fsck: in ask_yn() fall back to English yes/no characters X-Git-Tag: v1.43.6~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f8a1826d043df4fe5e5992337b229e24c5070e4;p=thirdparty%2Fe2fsprogs.git 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 --- diff --git a/e2fsck/util.c b/e2fsck/util.c index 87d320b99..43cb7a745 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;