]> granicus.if.org Git - mutt/commitdiff
Make the use of nl_langinfo(YESEXPR/NOEXPR) more robust. Problem
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 7 Sep 2000 09:34:01 +0000 (09:34 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 7 Sep 2000 09:34:01 +0000 (09:34 +0000)
noted by Wolfgang Baumann <baumann@zib.de>.

curs_lib.c

index 6cec10875eb5113a1c10bc6415d4ba9696f441f8..9e75a90151654c20e8d62aedbded1646ae656720 100644 (file)
@@ -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);