summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/sort/sort.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/sort/sort.c')
-rw-r--r--gnu/usr.bin/sort/sort.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gnu/usr.bin/sort/sort.c b/gnu/usr.bin/sort/sort.c
index f4d6127..bb391a0 100644
--- a/gnu/usr.bin/sort/sort.c
+++ b/gnu/usr.bin/sort/sort.c
@@ -200,6 +200,22 @@ static int collates[UCHAR_LIM];
#define COLLDIFF(A, B) (collates[UCHAR (A)] - collates[UCHAR (B)])
+/* static */ int
+collate_range_cmp (a, b)
+ int a, b;
+{
+ int r;
+ static char s[2][2];
+
+ if ((unsigned char)a == (unsigned char)b)
+ return 0;
+ s[0][0] = a;
+ s[1][0] = b;
+ if ((r = strcoll(s[0], s[1])) == 0)
+ r = (unsigned char)a - (unsigned char)b;
+ return r;
+}
+
static int
collcompare (const void *sa, const void *sb)
{
OpenPOWER on IntegriCloud