diff options
-rw-r--r-- | bin/sh/expand.c | 44 |
1 files changed, 4 insertions, 40 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c index f4cbac6..922ae98 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: expand.c,v 1.4 1995/05/30 00:07:13 rgrimes Exp $ + * $Id: expand.c,v 1.5 1996/08/11 22:50:58 ache Exp $ */ #ifndef lint @@ -63,6 +63,7 @@ static char sccsid[] = "@(#)expand.c 8.2 (Berkeley) 10/22/93"; #include <sys/types.h> #include <sys/time.h> #include <sys/stat.h> +#include <locale.h> #include <errno.h> #include <dirent.h> #include <pwd.h> @@ -102,7 +103,6 @@ STATIC struct strlist *expsort(struct strlist *); STATIC struct strlist *msort(struct strlist *, int); STATIC int pmatch(char *, char *); STATIC char *exptilde(char *, int); -STATIC int collcmp (int, int); #else STATIC void argstr(); STATIC void expbackq(); @@ -119,7 +119,6 @@ STATIC struct strlist *expsort(); STATIC struct strlist *msort(); STATIC int pmatch(); STATIC char *exptilde(); -STATIC int collcmp (); #endif /* @@ -1021,41 +1020,6 @@ patmatch(pattern, string) } STATIC int -collcmp (c1, c2) -int c1, c2; -{ - static char s1[2], s2[2]; - - c1 &= 0xFF; - c2 &= 0xFF; - if (c1 == c2) - return (0); - if ( (isascii(c1) && isascii(c2)) - || (!isalpha(c1) && !isalpha(c2)) - ) - return (c1 - c2); - if (isalpha(c1) && !isalpha(c2)) { - if (isupper(c1)) - return ('A' - c2); - else - return ('a' - c2); - } else if (isalpha(c2) && !isalpha(c1)) { - if (isupper(c2)) - return (c1 - 'A'); - else - return (c1 - 'a'); - } - if (isupper(c1) && islower(c2)) - return (-1); - else if (islower(c1) && isupper(c2)) - return (1); - s1[0] = c1; - s2[0] = c2; - return strcoll(s1, s2); -} - - -STATIC int pmatch(pattern, string) char *pattern; char *string; @@ -1122,8 +1086,8 @@ pmatch(pattern, string) p++; if (*p == CTLESC) p++; - if ( collcmp(chr, c) >= 0 - && collcmp(chr, *p) <= 0 + if ( collate_range_cmp(chr, c) >= 0 + && collate_range_cmp(chr, *p) <= 0 ) found = 1; p++; |