mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
Convert to newly added collate compare function
This commit is contained in:
parent
b339a4060f
commit
c906f8d406
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17557
@ -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
|
||||
|
||||
/*
|
||||
@ -1020,41 +1019,6 @@ patmatch(pattern, string)
|
||||
return pmatch(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;
|
||||
@ -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++;
|
||||
|
Loading…
Reference in New Issue
Block a user