about summary refs log tree commit diff
path: root/stdlib/rpmatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/rpmatch.c')
-rw-r--r--stdlib/rpmatch.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/stdlib/rpmatch.c b/stdlib/rpmatch.c
index 0dcaa6dc87..4774e2cf45 100644
--- a/stdlib/rpmatch.c
+++ b/stdlib/rpmatch.c
@@ -30,7 +30,7 @@ rpmatch (response)
 {
   /* Match against one of the response patterns, compiling the pattern
      first if necessary.  */
-  inline int try (const int tag, const int match,
+  inline int try (const int tag, const int match, const int nomatch,
 		  const char **lastp, regex_t *re)
     {
       const char *pattern = nl_langinfo (tag);
@@ -50,13 +50,13 @@ rpmatch (response)
 	}
 
       /* Try the pattern.  */
-      return regexec (re, response, 0, NULL, 0) == 0 ? match : !match;
+      return regexec (re, response, 0, NULL, 0) == 0 ? match : nomatch;
     }
 
   /* We cache the response patterns and compiled regexps here.  */
   static const char *yesexpr, *noexpr;
   static regex_t yesre, nore;
 
-  return (try (YESEXPR, 1, &yesexpr, &yesre) ?:
-	  try (NOEXPR, 0, &noexpr, &nore));
+  return (try (YESEXPR, 1, 0, &yesexpr, &yesre) ?:
+	  try (NOEXPR, 0, -1, &noexpr, &nore));
 }