projects
/
libc-test
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
1a68cda
)
regex backref \0 regression test
author
Szabolcs Nagy
<nsz@port70.net>
Sun, 22 Mar 2015 00:24:15 +0000
(
00:24
+0000)
committer
Szabolcs Nagy
<nsz@port70.net>
Sun, 22 Mar 2015 00:24:15 +0000
(
00:24
+0000)
src/regression/regex-backref-0.c
[new file with mode: 0644]
patch
|
blob
diff --git a/src/regression/regex-backref-0.c
b/src/regression/regex-backref-0.c
new file mode 100644
(file)
index 0000000..
c5f20b5
--- /dev/null
+++ b/
src/regression/regex-backref-0.c
@@ -0,0
+1,20
@@
+// \0 is not a valid backref
+#include <regex.h>
+#include "test.h"
+
+int main(void)
+{
+ char buf[200];
+ char pat[] = "a\\0";
+ regex_t r;
+ int n;
+
+ n = regcomp(&r, pat, 0);
+ // standard allows REG_BADPAT for all pattern errors
+ if (n != REG_ESUBREG && n != REG_BADPAT) {
+ regerror(n, &r, buf, sizeof buf);
+ t_error("regcomp(%s) returned %d (%s) wanted REG_ESUBREG\n", pat, n, buf);
+ }
+
+ return t_status;
+}