regex backref \0 regression test
[libc-test.git] / src / regression / regex-backref-0.c
blobc5f20b5615d9e0eb35a8bf8497cdbe464d133bbb
1 // \0 is not a valid backref
2 #include <regex.h>
3 #include "test.h"
5 int main(void)
7 char buf[200];
8 char pat[] = "a\\0";
9 regex_t r;
10 int n;
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);
19 return t_status;