From d635f7bb20a0211ea463fcd4fc2654aa1475c73a Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Thu, 31 Oct 1996 07:45:15 +0000 Subject: [PATCH] Replace collate_range_cmp call with its code (GNU version) --- gnu/usr.bin/awk/dfa.c | 20 +++++++++++++++++--- gnu/usr.bin/grep/dfa.c | 20 +++++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/gnu/usr.bin/awk/dfa.c b/gnu/usr.bin/awk/dfa.c index 7a7e8a863c3a..e9c832b540e0 100644 --- a/gnu/usr.bin/awk/dfa.c +++ b/gnu/usr.bin/awk/dfa.c @@ -21,9 +21,6 @@ #include #include #include -#ifdef __FreeBSD__ -#include -#endif #ifdef HAVE_CONFIG_H #include "config.h" @@ -121,6 +118,23 @@ static char **comsubs _RE_ARGS((char *left, char *right)); static char **addlists _RE_ARGS((char **old, char **new)); static char **inboth _RE_ARGS((char **left, char **right)); +#ifdef __FreeBSD__ +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; +} +#endif + static ptr_t xcalloc(n, s) size_t n; diff --git a/gnu/usr.bin/grep/dfa.c b/gnu/usr.bin/grep/dfa.c index 2270325e43ae..b8144d9c26ac 100644 --- a/gnu/usr.bin/grep/dfa.c +++ b/gnu/usr.bin/grep/dfa.c @@ -21,9 +21,6 @@ #include #include #include -#ifdef __FreeBSD__ -#include -#endif #ifdef STDC_HEADERS #include @@ -68,6 +65,23 @@ typedef char *ptr_t; static void dfamust(); +#ifdef __FreeBSD__ +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; +} +#endif + static ptr_t xcalloc(n, s) int n;