summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1996-10-31 07:45:15 +0000
committerache <ache@FreeBSD.org>1996-10-31 07:45:15 +0000
commitae538a3fbdd7a152b632f6cad205c4cda9c24787 (patch)
tree7e84936449577892db70b91c7ba3c4fc8f4a9e97 /gnu/usr.bin
parent71018396d18d81687c813c5a5d83309a78908bb8 (diff)
downloadFreeBSD-src-ae538a3fbdd7a152b632f6cad205c4cda9c24787.zip
FreeBSD-src-ae538a3fbdd7a152b632f6cad205c4cda9c24787.tar.gz
Replace collate_range_cmp call with its code (GNU version)
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/awk/dfa.c20
-rw-r--r--gnu/usr.bin/grep/dfa.c20
2 files changed, 34 insertions, 6 deletions
diff --git a/gnu/usr.bin/awk/dfa.c b/gnu/usr.bin/awk/dfa.c
index 7a7e8a8..e9c832b 100644
--- a/gnu/usr.bin/awk/dfa.c
+++ b/gnu/usr.bin/awk/dfa.c
@@ -21,9 +21,6 @@
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
-#ifdef __FreeBSD__
-#include <locale.h>
-#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 2270325..b8144d9 100644
--- a/gnu/usr.bin/grep/dfa.c
+++ b/gnu/usr.bin/grep/dfa.c
@@ -21,9 +21,6 @@
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
-#ifdef __FreeBSD__
-#include <locale.h>
-#endif
#ifdef STDC_HEADERS
#include <stdlib.h>
@@ -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;
OpenPOWER on IntegriCloud