mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-23 02:04:46 +00:00
Follow alphabetical order more closely, now ISO8859-1 characters
sorted properly too.
This commit is contained in:
parent
1ffa43c082
commit
9cca9761a6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=16261
|
@ -201,12 +201,25 @@ colldiff (unsigned char A, unsigned char B)
|
||||||
{
|
{
|
||||||
static unsigned char s1[2], s2[2];
|
static unsigned char s1[2], s2[2];
|
||||||
|
|
||||||
if (isascii(A) || isascii(B) || !isalpha(A) || !isalpha(B))
|
if (A == B)
|
||||||
|
return (0);
|
||||||
|
if (isascii(A) && isascii(B) || !isalpha(A) && !isalpha(B))
|
||||||
return ((int)A - (int)B);
|
return ((int)A - (int)B);
|
||||||
if (isupper(A) && islower(B))
|
if (isupper(A) && islower(B))
|
||||||
return (-1);
|
return (-1);
|
||||||
else if (islower(A) && isupper(B))
|
else if (islower(A) && isupper(B))
|
||||||
return (1);
|
return (1);
|
||||||
|
if (isalpha(A) && !isalpha(B)) {
|
||||||
|
if (isupper(A))
|
||||||
|
return ('A' - (int)B);
|
||||||
|
else
|
||||||
|
return ('a' - (int)B);
|
||||||
|
} else if (isalpha(B) && !isalpha(A)) {
|
||||||
|
if (isupper(B))
|
||||||
|
return ((int)A - 'A');
|
||||||
|
else
|
||||||
|
return ((int)A - 'a');
|
||||||
|
}
|
||||||
s1[0] = A;
|
s1[0] = A;
|
||||||
s2[0] = B;
|
s2[0] = B;
|
||||||
return strcoll(s1, s2);
|
return strcoll(s1, s2);
|
||||||
|
|
Loading…
Reference in a new issue