This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix tst-rxspencer.c


Hi!

2 small things:
- While @foo is supposed to be checked with comparing 3 bytes at rm_so
with "foo", @ alone should match only end of the string, nothing else.
- The error message was misleading if --utf8 was used.

2003-11-14  Jakub Jelinek  <jakub@redhat.com>

	* posix/tst-rxspencer.c (check_match): @ without any following
	characters must match only end of string.
	(main): Fix filename in error message.

--- libc/posix/tst-rxspencer.c.jj	2003-11-14 09:19:13.000000000 +0100
+++ libc/posix/tst-rxspencer.c	2003-11-14 10:03:56.000000000 +0100
@@ -184,7 +184,7 @@ check_match (regmatch_t *rm, int idx, co
 	  return 1;
 	}
 
-      if (strncmp (string + rm[idx].rm_so, match + 1, strlen (match + 1)))
+      if (strncmp (string + rm[idx].rm_so, match + 1, strlen (match + 1) ?: 1))
 	{
 	  printf ("%s rm[%d] not matching %s\n", fail, idx, match);
 	  return 1;
@@ -395,7 +395,7 @@ main (int argc, char **argv)
   f = fopen (argv[optind], "r");
   if (f == NULL)
     {
-      fprintf (stderr, "Couldn't open %s\n", argv[1]);
+      fprintf (stderr, "Couldn't open %s\n", argv[optind]);
       return 1;
     }
 

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]