svn commit: r213469 - head/usr.bin/tar

Tim Kientzle kientzle at FreeBSD.org
Wed Oct 6 04:30:41 UTC 2010


Author: kientzle
Date: Wed Oct  6 04:30:40 2010
New Revision: 213469
URL: http://svn.freebsd.org/changeset/base/213469

Log:
  Recognize both ! and ^ as markers for negated character classes.
  
  Submitted by:	Mykola Dzham

Modified:
  head/usr.bin/tar/pathmatch.c

Modified: head/usr.bin/tar/pathmatch.c
==============================================================================
--- head/usr.bin/tar/pathmatch.c	Wed Oct  6 01:23:40 2010	(r213468)
+++ head/usr.bin/tar/pathmatch.c	Wed Oct  6 04:30:40 2010	(r213469)
@@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
 
 /*
  * Check whether a character 'c' is matched by a list specification [...]:
- *    * Leading '!' negates the class.
+ *    * Leading '!' or '^' negates the class.
  *    * <char>-<char> is a range of characters
  *    * \<char> removes any special meaning for <char>
  *
@@ -60,7 +60,7 @@ pm_list(const char *start, const char *e
 	(void)flags; /* UNUSED */
 
 	/* If this is a negated class, return success for nomatch. */
-	if (*p == '!' && p < end) {
+	if ((*p == '!' || *p == '^') && p < end) {
 		match = 0;
 		nomatch = 1;
 		++p;


More information about the svn-src-head mailing list