svn commit: r232217 - user/gabor/tre-integration/usr.bin/grep

Gabor Kovesdan gabor at FreeBSD.org
Mon Feb 27 15:59:18 UTC 2012


Author: gabor
Date: Mon Feb 27 15:59:17 2012
New Revision: 232217
URL: http://svn.freebsd.org/changeset/base/232217

Log:
  - Use mregerror() to determine which pattern compilation fails and why

Modified:
  user/gabor/tre-integration/usr.bin/grep/grep.c

Modified: user/gabor/tre-integration/usr.bin/grep/grep.c
==============================================================================
--- user/gabor/tre-integration/usr.bin/grep/grep.c	Mon Feb 27 15:58:38 2012	(r232216)
+++ user/gabor/tre-integration/usr.bin/grep/grep.c	Mon Feb 27 15:59:17 2012	(r232217)
@@ -687,9 +687,10 @@ main(int argc, char *argv[])
 	ptr = (const char **)pats;
 	c = mregncomp(&preg, patterns, ptr, lens, cflags);
 	if (c != 0) {
-	  // regerror(c, &r_pattern[i], re_error, RE_ERROR_BUF);
-	  // errx(2, "%s", re_error);
-	  errx(2, "%s", "Bad patterns.");
+	  int no;
+
+	  mregerror(c, &preg, &no, re_error, RE_ERROR_BUF);
+	  errx(2, "%s:%s", pats[no], re_error);
 	}
 
 	if (lbflag)


More information about the svn-src-user mailing list