aboutsummaryrefslogtreecommitdiff
path: root/posix/bug-regex10.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-08-26 23:00:40 +0000
committerUlrich Drepper <drepper@redhat.com>2002-08-26 23:00:40 +0000
commit8b269abcea15a868696ac3f0bd48373ee708950c (patch)
tree60580122ee86e196e749f43205ba5dfed45bda4f /posix/bug-regex10.c
parentc3c66446ac542900de5fbf6ae10028aceb7be416 (diff)
downloadglibc-8b269abcea15a868696ac3f0bd48373ee708950c.zip
glibc-8b269abcea15a868696ac3f0bd48373ee708950c.tar.gz
glibc-8b269abcea15a868696ac3f0bd48373ee708950c.tar.bz2
Update.
2002-08-26 Brian Youmans <3diff@gnu.org> * Examples/ex10.c: Likewise. * Examples/ex11.c: Likewise. * Examples/ex13.c: Likewise. * Examples/ex8.c: Likewise. * Examples/ex9.c: Likewise. * barrier.c: Likewise. * events.c: Likewise. * lockfile.c: Likewise. * no-tsd.c: Likewise. * pt-machine.c: Likewise. * ptclock_gettime.c: Likewise. * ptclock_settime.c: Likewise. * rwlock.c: Likewise. * sysdeps/alpha/pspinlock.c: Likewise. * sysdeps/alpha/pt-machine.h: Likewise. * sysdeps/arm/pspinlock.c: Likewise. * sysdeps/arm/pt-machine.h: Likewise. * sysdeps/cris/pspinlock.c: Likewise. * sysdeps/cris/pt-machine.h: Likewise. * sysdeps/hppa/pspinlock.c: Likewise. * sysdeps/hppa/pt-machine.h: Likewise. * sysdeps/i386/i686/pt-machine.h: Likewise. * sysdeps/i386/pspinlock.c: Likewise. * sysdeps/i386/pt-machine.h: Likewise. * sysdeps/i386/useldt.h: Likewise. * sysdeps/ia64/pspinlock.c: Likewise. * sysdeps/ia64/pt-machine.h: Likewise. * sysdeps/m68k/pspinlock.c: Likewise. * sysdeps/m68k/pt-machine.h: Likewise. * sysdeps/mips/pspinlock.c: Likewise. * sysdeps/mips/pt-machine.h: Likewise. * sysdeps/powerpc/pspinlock.c: Likewise. * sysdeps/powerpc/pt-machine.h: Likewise. * sysdeps/pthread/bits/initspin.h: Likewise. * sysdeps/pthread/bits/libc-lock.h: Likewise. * sysdeps/pthread/bits/libc-tsd.h: Likewise. * sysdeps/pthread/getcpuclockid.c: Likewise. * sysdeps/pthread/posix-timer.h: Likewise. * sysdeps/pthread/timer_create.c: Likewise. * sysdeps/pthread/timer_delete.c: Likewise. * sysdeps/pthread/timer_getoverr.c: Likewise. * sysdeps/pthread/timer_gettime.c: Likewise. * sysdeps/pthread/timer_routines.c: Likewise. * sysdeps/pthread/timer_settime.c: Likewise. * sysdeps/pthread/tst-timer.c: Likewise. * sysdeps/s390/pspinlock.c: Likewise. * sysdeps/s390/s390-32/pt-machine.h: Likewise. * sysdeps/s390/s390-64/pt-machine.h: Likewise. * sysdeps/sh/pspinlock.c: Likewise. * sysdeps/sh/pt-machine.h: Likewise. * sysdeps/sparc/sparc32/pspinlock.c: Likewise. * sysdeps/sparc/sparc32/pt-machine.h: Likewise. * sysdeps/sparc/sparc32/sparcv9/pspinlock.c: Likewise. * sysdeps/sparc/sparc64/pspinlock.c: Likewise. * sysdeps/sparc/sparc64/pt-machine.h: Likewise. * sysdeps/unix/sysv/linux/bits/local_lim.h: Likewise. * sysdeps/unix/sysv/linux/bits/posix_opt.h: Likewise. * sysdeps/unix/sysv/linux/bits/sigthread.h: Likewise. * sysdeps/unix/sysv/linux/hppa/bits/initspin.h: Likewise. * sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: Likewise. * tststack.c: Likewise. * unload.c: Likewise. * weaks.c: Likewise. * wrapsyscall.c: Likewise. * sysdeps/pthread/pt-initfini.c: Changed copying permission notice to Lesser GPL from Library GPL, including the references in the special exception. * sysdeps/unix/sysv/linux/hppa/pt-initfini.c: Likewise. * sysdeps/unix/sysv/linux/ia64/pt-initfini.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c: Likewise. * sysdeps/unix/sysv/linux/sh/pt-initfini.c: Likewise.
Diffstat (limited to 'posix/bug-regex10.c')
-rw-r--r--posix/bug-regex10.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/posix/bug-regex10.c b/posix/bug-regex10.c
new file mode 100644
index 0000000..5cb0146
--- /dev/null
+++ b/posix/bug-regex10.c
@@ -0,0 +1,61 @@
+/* Test for re_match with non-zero start.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+#include <regex.h>
+
+int
+main (void)
+{
+ struct re_pattern_buffer regex;
+ struct re_registers regs;
+ const char *s;
+ int match;
+ int result = 0;
+
+ regs.num_regs = 1;
+ memset (&regex, '\0', sizeof (regex));
+ s = re_compile_pattern ("[abc]*d", 7, &regex);
+ if (s != NULL)
+ {
+ puts ("re_compile_pattern return non-NULL value");
+ result = 1;
+ }
+ else
+ {
+ match = re_match (&regex, "foacabdxy", 9, 2, &regs);
+ if (match != 5)
+ {
+ printf ("re_match returned %d, expected 5\n", match);
+ result = 1;
+ }
+ else if (regs.start[0] != 2 || regs.end[0] != 7)
+ {
+ printf ("re_match returned %d..%d, expected 2..7\n",
+ regs.start[0], regs.end[0]);
+ result = 1;
+ }
+ puts (" -> OK");
+ }
+
+ return result;
+}