From 1f31b8058c9cfccc0dc2dc2b6e52b76683433c30 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Thu, 7 Sep 2000 09:34:01 +0000 Subject: [PATCH] Make the use of nl_langinfo(YESEXPR/NOEXPR) more robust. Problem noted by Wolfgang Baumann . --- curs_lib.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/curs_lib.c b/curs_lib.c index 6cec10875..9e75a9015 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -151,13 +151,22 @@ int mutt_yesorno (const char *msg, int def) char *no = _("no"); #ifdef HAVE_LANGINFO_YESEXPR + char *expr; regex_t reyes; regex_t reno; - int reyes_ok = ! regcomp (& reyes, nl_langinfo (YESEXPR), REG_NOSUB); - int reno_ok = ! regcomp (& reno, nl_langinfo (NOEXPR), REG_NOSUB); + int reyes_ok = 0; + int reno_ok = 0; char answer[2]; answer[1] = 0; + + if ((expr = nl_langinfo (YESEXPR)) && *expr && + !regcomp (&reyes, expr, REG_NOSUB)) + reyes_ok = 1; + + if ((expr = nl_langinfo (NOEXPR)) && *expr && + !regcomp (&reno, expr, REG_NOSUB)) + reno_ok = 1; #endif CLEARLINE(LINES-1); -- 2.40.0