From c7f0abb049cbd58704545ee94ec6e6aa40d00f0a Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 5 May 2015 13:16:23 +0000 Subject: - fix for case_diff* with 2.3.4.0 - rc for 2.0.4.1 --- src/skaembutils/s6-sort.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/skaembutils/s6-sort.c b/src/skaembutils/s6-sort.c index 5b259b8..78efd51 100644 --- a/src/skaembutils/s6-sort.c +++ b/src/skaembutils/s6-sort.c @@ -1,10 +1,11 @@ /* ISC license. */ +#include +#include #include #include #include #include -#include #include #include #include @@ -14,19 +15,14 @@ #define USAGE "s6-sort [ -bcfru0 ]" -typedef int strncmp_t (char const *, unsigned int, char const *) ; +typedef int strncmp_t (char const *, char const *, size_t) ; typedef strncmp_t *strncmp_t_ref ; typedef int qsortcmp_t (void const *, void const *) ; typedef qsortcmp_t *qsortcmp_t_ref ; static int flagnoblanks = 0, flagreverse = 0, flaguniq = 0 ; -static int str_diffb_f (register char const *s1, register unsigned int n, register char const *s2) -{ - return str_diffb(s1, n, s2) ; -} - -static strncmp_t_ref comp = &str_diffb_f ; +static strncmp_t_ref comp = &strncmp ; static int compit (register char const *s1, register unsigned int n1, register char const *s2, register unsigned int n2) { @@ -36,7 +32,7 @@ static int compit (register char const *s1, register unsigned int n1, register c while ((*s1 == ' ') || (*s1 == '\t')) (s1++, n1--) ; while ((*s2 == ' ') || (*s2 == '\t')) (s2++, n2--) ; } - r = (*comp)(s1, n1 < n2 ? n1 : n2, s2) ; + r = (*comp)(s1, s2, n1 < n2 ? n1 : n2) ; if (!r) r = n1 - n2 ; return flagreverse ? -r : r ; } @@ -103,7 +99,7 @@ int main (int argc, char const *const *argv) { case 'b' : flagnoblanks = 1 ; break ; case 'c' : flagcheck = 1 ; break ; - case 'f' : comp = &case_diffb ; break ; + case 'f' : comp = &strncasecmp ; break ; case 'r' : flagreverse = 1 ; break ; case 'u' : flaguniq = 1 ; break ; case '0' : sep = '\0' ; break ; -- cgit v1.2.3