(_) [!_]: Define it.
(try): Add RESPONSE parameter.
(rpmatch): Update caller.
Change the regular expressions to be ^[yY] and ^[nN].
# include <config.h>
#endif
# include <config.h>
#endif
+#if STDC_HEADERS || _LIBC
+# include <stdlib.h>
+#endif
+
+#ifndef _
+# define _(String) String
+#endif
-try (tag, match, nomatch, lastp, re)
+try (response, pattern, match, nomatch, lastp, re)
+ const char *response;
const char *pattern;
const int match;
const int nomatch;
const char *pattern;
const int match;
const int nomatch;
+ /* See if the regular expression matches RESPONSE. */
return regexec (re, response, 0, NULL, 0) == 0 ? match : nomatch;
}
return regexec (re, response, 0, NULL, 0) == 0 ? match : nomatch;
}
static regex_t yesre, nore;
int result;
static regex_t yesre, nore;
int result;
- return ((result = try (_("[yY][[:alpha:]]"), 1, 0, &yesexpr, &yesre))
+ return ((result = try (response, _("^[yY]"), 1, 0,
+ &yesexpr, &yesre))
- : try (_("[nN][[:alpha:]]"), 0, -1, &noexpr, &nore));
+ : try (response, _("^[nN]"), 0, -1, &noexpr, &nore));