summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1996-08-12 19:31:11 +0000
committerache <ache@FreeBSD.org>1996-08-12 19:31:11 +0000
commit05aa8617cfa34537f1a7fbc5920c8cdc213ed5b8 (patch)
tree06e2d5890d7329cc6754eb08ef6139d31b2d73d9 /bin/sh
parentbc4e65eedce64416d92f92293e11b45b10507633 (diff)
downloadFreeBSD-src-05aa8617cfa34537f1a7fbc5920c8cdc213ed5b8.zip
FreeBSD-src-05aa8617cfa34537f1a7fbc5920c8cdc213ed5b8.tar.gz
Convert to newly added collate compare function
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/expand.c44
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++;
OpenPOWER on IntegriCloud