diff options
author | ache <ache@FreeBSD.org> | 1996-08-13 14:33:05 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1996-08-13 14:33:05 +0000 |
commit | 9e33f9be1e1dcb8ddf6eb3e714d8a02b3338b4b4 (patch) | |
tree | ce09590d3d6688fc13c308806c151a6a8fcfb1d1 /gnu/usr.bin | |
parent | c7f196690052b2e3c35473ba37dd432c3d1b5c8a (diff) | |
download | FreeBSD-src-9e33f9be1e1dcb8ddf6eb3e714d8a02b3338b4b4.zip FreeBSD-src-9e33f9be1e1dcb8ddf6eb3e714d8a02b3338b4b4.tar.gz |
Use collate for alpha character ranges
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r-- | gnu/usr.bin/awk/dfa.c | 25 | ||||
-rw-r--r-- | gnu/usr.bin/awk/main.c | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/gnu/usr.bin/awk/dfa.c b/gnu/usr.bin/awk/dfa.c index 397027f..7a7e8a8 100644 --- a/gnu/usr.bin/awk/dfa.c +++ b/gnu/usr.bin/awk/dfa.c @@ -21,6 +21,9 @@ #include <assert.h> #include <ctype.h> #include <stdio.h> +#ifdef __FreeBSD__ +#include <locale.h> +#endif #ifdef HAVE_CONFIG_H #include "config.h" @@ -671,6 +674,27 @@ lex() } else c2 = c; +#ifdef __FreeBSD__ + { token c3; + + if (collate_range_cmp(c, c2) > 0) { + FETCH(c2, "Invalid range"); + goto skip; + } + + for (c3 = 0; c3 < NOTCHAR; ++c3) + if ( collate_range_cmp(c, c3) <= 0 + && collate_range_cmp(c3, c2) <= 0 + ) { + setbit(c3, ccl); + if (case_fold) + if (ISUPPER(c3)) + setbit(tolower(c3), ccl); + else if (ISLOWER(c3)) + setbit(toupper(c3), ccl); + } + } +#else while (c <= c2) { setbit(c, ccl); @@ -681,6 +705,7 @@ lex() setbit(toupper(c), ccl); ++c; } +#endif skip: ; } diff --git a/gnu/usr.bin/awk/main.c b/gnu/usr.bin/awk/main.c index 1f483bc..2276460 100644 --- a/gnu/usr.bin/awk/main.c +++ b/gnu/usr.bin/awk/main.c @@ -146,7 +146,7 @@ char **argv; extern char *optarg; #ifdef __FreeBSD__ - (void) setlocale(LC_CTYPE, ""); + (void) setlocale(LC_ALL, ""); #endif #ifdef __EMX__ _response(&argc, &argv); |