Blame src/regression/regex-backref-0.c
|
Szabolcs Nagy |
ca5901 |
// \0 is not a valid backref, it is undefined by the standard
|
|
Szabolcs Nagy |
ca5901 |
// we treat such cases as literal char
|
|
Szabolcs Nagy |
7b4404 |
#include <regex.h>
|
|
Szabolcs Nagy |
7b4404 |
#include "test.h"
|
|
Szabolcs Nagy |
7b4404 |
|
|
Szabolcs Nagy |
7b4404 |
int main(void)
|
|
Szabolcs Nagy |
7b4404 |
{
|
|
Szabolcs Nagy |
7b4404 |
char buf[200];
|
|
Szabolcs Nagy |
7b4404 |
char pat[] = "a\\0";
|
|
Szabolcs Nagy |
7b4404 |
regex_t r;
|
|
Szabolcs Nagy |
7b4404 |
int n;
|
|
Szabolcs Nagy |
7b4404 |
|
|
Szabolcs Nagy |
7b4404 |
n = regcomp(&r, pat, 0);
|
|
Szabolcs Nagy |
ca5901 |
if (n) {
|
|
Szabolcs Nagy |
7b4404 |
regerror(n, &r, buf, sizeof buf);
|
|
Szabolcs Nagy |
ca5901 |
t_error("regcomp(%s) returned %d (%s) wanted 0\n", pat, n, buf);
|
|
Szabolcs Nagy |
ca5901 |
}
|
|
Szabolcs Nagy |
ca5901 |
n = regexec(&r, "a0", 0, 0, 0);
|
|
Szabolcs Nagy |
ca5901 |
if (n) {
|
|
Szabolcs Nagy |
ca5901 |
regerror(n, &r, buf, sizeof buf);
|
|
Szabolcs Nagy |
ca5901 |
t_error("regexec(/%s/ ~ \"a0\") returned %d (%s), wanted 0\n",
|
|
Szabolcs Nagy |
ca5901 |
pat, n, buf);
|
|
Szabolcs Nagy |
7b4404 |
}
|
|
Szabolcs Nagy |
7b4404 |
|
|
Szabolcs Nagy |
7b4404 |
return t_status;
|
|
Szabolcs Nagy |
7b4404 |
}
|