patches

Patches for various other programs
git clone https://git.regexghost.com/patches.git
Log | Files | Refs | README

oksh-case-insensitive.diff (821B)


      1 diff --git a/misc.c b/misc.c
      2 index 428f183..150624d 100644
      3 --- a/misc.c
      4 +++ b/misc.c
      5 @@ -602,7 +602,7 @@ do_gmatch(const unsigned char *s, const unsigned char *se,
      6  		sc = s < se ? *s : '\0';
      7  		s++;
      8  		if (!ISMAGIC(pc)) {
      9 -			if (sc != pc)
     10 +			if (sc != pc && !(tolower(sc) == tolower(pc)))
     11  				return 0;
     12  			continue;
     13  		}
     14 @@ -705,7 +705,7 @@ do_gmatch(const unsigned char *s, const unsigned char *se,
     15  			return 0;
     16  
     17  		default:
     18 -			if (sc != p[-1])
     19 +			if (sc != p[-1] && !(tolower(sc) == tolower(p[-1])))
     20  				return 0;
     21  			break;
     22  		}
     23 @@ -795,7 +795,7 @@ cclass(const unsigned char *p, int sub)
     24  				return NULL;
     25  		} else
     26  			d = c;
     27 -		if (c == sub || (c <= sub && sub <= d))
     28 +		if (c == sub || (c <= sub && sub <= d) || (tolower(c) == tolower(sub)))
     29  			found = 1;
     30  	} while (!(ISMAGIC(p[0]) && p[1] == ']'));
     31