Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: 3.1.5: fix for case-insensitivity patch



% [[ Modules = (#i)*m* ]] || print Stephenson\'s wrecked the shell again
Stephenson's wrecked the shell again

*** Misc/globtests.ci3	Tue Nov  3 11:35:36 1998
--- Misc/globtests	Tue Dec  1 15:39:36 1998
***************
*** 112,116 ****
--- 112,117 ----
  f fooxx         ((#i)FOOX)X
  f BAR           (bar|(#i)foo)
  t FOO           (bar|(#i)foo)
+ t Modules       (#i)*m*
  EOT
  print "$failed tests failed."
*** Misc/globtests.ksh.ci3	Tue Nov  3 11:35:54 1998
--- Misc/globtests.ksh	Tue Dec  1 15:39:32 1998
***************
*** 96,100 ****
--- 96,101 ----
  f fooxx         @((#i)FOOX)X
  f BAR           @(bar|(#i)foo)
  t FOO           @(bar|(#i)foo)
+ t Modules       (#i)*m*
  EOT
  print "$failed tests failed."
*** Src/glob.c.ci3	Sat Nov 14 16:31:54 1998
--- Src/glob.c	Tue Dec  1 15:41:23 1998
***************
*** 2182,2187 ****
--- 2182,2196 ----
      }
  }
  
+ /*
+  * Match characters with case-insensitivity.
+  * Note CHARMATCH(x,y) != CHARMATCH(y,x)
+  */
+ #define CHARMATCH(x, y) \
+ (x == y || (((c->stat & C_IGNCASE) ? (tulower(x) == tulower(y)) : \
+ 	     (c->stat & C_LCMATCHUC) ? (islower(y) && tuupper(y) == x) : 0)))
+ 
+ 
  /* see if current string in pptr matches c */
  
  /**/
***************
*** 2219,2225 ****
  		    for (; *pptr; pptr++) {
  			if (*pptr == Meta)
  			    pptr++;
! 			else if (*pptr == looka)
  			    break;
  		    }
  		    if (!*(saves = pptr))
--- 2228,2234 ----
  		    for (; *pptr; pptr++) {
  			if (*pptr == Meta)
  			    pptr++;
! 			else if (CHARMATCH(*pptr, looka))
  			    break;
  		    }
  		    if (!*(saves = pptr))
***************
*** 2589,2598 ****
  	    }
  	    continue;
  	}
! 	if (*pptr == *pat ||
! 	    (((c->stat & C_IGNCASE) ? (tulower(*pat) == tulower(*pptr)) :
! 	      (c->stat & C_LCMATCHUC) ?
! 	      (islower(*pat) && tuupper(*pat) == *pptr) : 0))) {
  	    /* just plain old characters */
  	    pptr++;
  	    pat++;
--- 2598,2604 ----
  	    }
  	    continue;
  	}
! 	if (CHARMATCH(*pptr, *pat)) {
  	    /* just plain old characters */
  	    pptr++;
  	    pat++;

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author