aboutsummaryrefslogtreecommitdiff
path: root/posix/bug-regex11.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-09-28 20:51:17 +0000
committerRoland McGrath <roland@gnu.org>2002-09-28 20:51:17 +0000
commitab635ab25481454112d91125998d0fbc65bfb2b8 (patch)
treeb8382d2d4a285265311be58dfaadb368332458d1 /posix/bug-regex11.c
parent100a05053c84983ee366900018fe4241ef572483 (diff)
downloadglibc-ab635ab25481454112d91125998d0fbc65bfb2b8.tar
glibc-ab635ab25481454112d91125998d0fbc65bfb2b8.tar.gz
glibc-ab635ab25481454112d91125998d0fbc65bfb2b8.tar.bz2
glibc-ab635ab25481454112d91125998d0fbc65bfb2b8.zip
2002-09-28 Jakub Jelinek <jakub@redhat.com>
* posix/bug-regex11.c (tests): Add flags field. (main): Avoid warnings. Use test[i].flags. Return nonzero if any of the tests failed. * posix/bug-regex12.c: New file. * posix/Makefile (tests): Add bug-regex12.
Diffstat (limited to 'posix/bug-regex11.c')
-rw-r--r--posix/bug-regex11.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/posix/bug-regex11.c b/posix/bug-regex11.c
index da1fc353d7..5c8179d675 100644
--- a/posix/bug-regex11.c
+++ b/posix/bug-regex11.c
@@ -24,19 +24,20 @@
#include <stdio.h>
#include <stdlib.h>
+/* Tests supposed to match. */
struct
{
const char *pattern;
const char *string;
- int nmatch;
+ int flags, nmatch;
regmatch_t rm[4];
} tests[] = {
/* Test for newline handling in regex. */
- { "[^~]*~", "\nx~y", 2, { { 0, 3 }, { -1, -1 } } },
+ { "[^~]*~", "\nx~y", 0, 2, { { 0, 3 }, { -1, -1 } } },
/* Other tests. */
- { ".*|\\([KIO]\\)\\([^|]*\\).*|?[KIO]", "10~.~|P|K0|I10|O16|?KSb", 3,
+ { ".*|\\([KIO]\\)\\([^|]*\\).*|?[KIO]", "10~.~|P|K0|I10|O16|?KSb", 0, 3,
{ { 0, 21 }, { 15, 16 }, { 16, 18 } } },
- { ".*|\\([KIO]\\)\\([^|]*\\).*|?\\1", "10~.~|P|K0|I10|O16|?KSb", 3,
+ { ".*|\\([KIO]\\)\\([^|]*\\).*|?\\1", "10~.~|P|K0|I10|O16|?KSb", 0, 3,
{ { 0, 21 }, { 8, 9 }, { 9, 10 } } }
};
@@ -45,13 +46,14 @@ main (void)
{
regex_t re;
regmatch_t rm[4];
- int n, i, ret = 0;
+ size_t i;
+ int n, ret = 0;
mtrace ();
for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
{
- n = regcomp (&re, tests[i].pattern, 0);
+ n = regcomp (&re, tests[i].pattern, tests[i].flags);
if (n != 0)
{
char buf[500];
@@ -84,5 +86,5 @@ main (void)
regfree (&re);
}
- return 0;
+ return ret;
}