From 705c4b24f0d78497fcefada456f86df924441780 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Thu, 31 Oct 1996 08:01:16 +0000 Subject: [PATCH] Localize it --- gnu/usr.bin/man/man/glob.c | 23 +++++++++++++++++++++++ gnu/usr.bin/man/man/man.c | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/gnu/usr.bin/man/man/glob.c b/gnu/usr.bin/man/man/glob.c index ba4be06a243a..65eb1fa8bf9e 100644 --- a/gnu/usr.bin/man/man/glob.c +++ b/gnu/usr.bin/man/man/glob.c @@ -110,6 +110,23 @@ extern char *alloca (); int noglob_dot_filenames = 1; static int glob_match_after_star (); + +#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 /* Return nonzero if PATTERN has any special globbing chars in it. */ @@ -239,7 +256,13 @@ glob_match (pattern, text, dot_special) return 0; c = *p++; } +#ifdef __FreeBSD__ + if ( collate_range_cmp (c1, cstart) >= 0 + && collate_range_cmp (c1, cend) <= 0 + ) +#else if (c1 >= cstart && c1 <= cend) +#endif goto match; if (c == ']') break; diff --git a/gnu/usr.bin/man/man/man.c b/gnu/usr.bin/man/man/man.c index d543bf2f5559..e36530b3f786 100644 --- a/gnu/usr.bin/man/man/man.c +++ b/gnu/usr.bin/man/man/man.c @@ -20,6 +20,9 @@ #include #include #include +#ifdef __FreeBSD__ +#include +#endif #include #include #include @@ -133,6 +136,9 @@ main (argc, argv) prognam = mkprogname (argv[0]); unsetenv("IFS"); +#ifdef __FreeBSD__ + (void) setlocale(LC_ALL, ""); +#endif man_getopt (argc, argv); if (optind == argc)