regex backref \0 regression test
[libc-test] / src / regression / regex-backref-0.c
1 // \0 is not a valid backref
2 #include <regex.h>
3 #include "test.h"
4
5 int main(void)
6 {
7         char buf[200];
8         char pat[] = "a\\0";
9         regex_t r;
10         int n;
11
12         n = regcomp(&r, pat, 0);
13         // standard allows REG_BADPAT for all pattern errors
14         if (n != REG_ESUBREG && n != REG_BADPAT) {
15                 regerror(n, &r, buf, sizeof buf);
16                 t_error("regcomp(%s) returned %d (%s) wanted REG_ESUBREG\n", pat, n, buf);
17         }
18
19         return t_status;
20 }