diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 1997-04-04 20:10:53 +0000 | 
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 1997-04-04 20:10:53 +0000 | 
| commit | b15443ba83936fa4e0bc4e843c9bd783c5e19b3b (patch) | |
| tree | 43ad5d5b730f4bc294bfb7f56dc2e8bb97bcc42e /lib/libcompat/regexp/regexp.c | |
| parent | b5a6eb1833569eb5944d96f7d6ffba53ddfd372f (diff) | |
Notes
Diffstat (limited to 'lib/libcompat/regexp/regexp.c')
| -rw-r--r-- | lib/libcompat/regexp/regexp.c | 42 | 
1 files changed, 16 insertions, 26 deletions
| diff --git a/lib/libcompat/regexp/regexp.c b/lib/libcompat/regexp/regexp.c index a442b962cfd29..fc97378f759f9 100644 --- a/lib/libcompat/regexp/regexp.c +++ b/lib/libcompat/regexp/regexp.c @@ -38,6 +38,7 @@  #include <ctype.h>  #include <stdlib.h>  #include <string.h> +#include "collate.h"  #include "regmagic.h"  /* @@ -181,28 +182,10 @@ STATIC void regc();  STATIC void reginsert();  STATIC void regtail();  STATIC void regoptail(); -STATIC int  collate_range_cmp();  #ifdef STRCSPN  STATIC int strcspn();  #endif -static int collate_range_cmp (c1, c2) -	int c1, c2; -{ -	static char s1[2], s2[2]; -	int ret; - -	c1 &= UCHAR_MAX; -	c2 &= UCHAR_MAX; -	if (c1 == c2) -		return (0); -	s1[0] = c1; -	s2[0] = c2; -	if ((ret = strcoll(s1, s2)) != 0) -		return (ret); -	return (c1 - c2); -} -  /*   - regcomp - compile a regular expression into internal code   * @@ -525,14 +508,21 @@ int *flagp;  					else {  						class = UCHARAT(regparse-2);  						classend = UCHARAT(regparse); -						if (collate_range_cmp(class, classend) > 0) -							FAIL("invalid [] range"); -						for (i = 0; i <= UCHAR_MAX; i++) -							if (   i != class -							    && collate_range_cmp(class, i) <= 0 -							    && collate_range_cmp(i, classend) <= 0 -							   ) -								regc(i); +						if (__collate_load_error) { +							if (class > classend) +								FAIL("invalid [] range"); +							for (class++; class <= classend; class++) +								regc(class); +						} else { +							if (__collate_range_cmp(class, classend) > 0) +								FAIL("invalid [] range"); +							for (i = 0; i <= UCHAR_MAX; i++) +								if (   i != class +								    && __collate_range_cmp(class, i) <= 0 +								    && __collate_range_cmp(i, classend) <= 0 +								   ) +									regc(i); +						}  						regparse++;  					}  				} else | 
