1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-18 15:30:21 +00:00

Localize it

This commit is contained in:
Andrey A. Chernov 1996-10-31 08:01:16 +00:00
parent d635f7bb20
commit 705c4b24f0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19285
2 changed files with 29 additions and 0 deletions

View File

@ -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;

View File

@ -20,6 +20,9 @@
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#ifdef __FreeBSD__
#include <locale.h>
#endif
#include <string.h>
#include <sys/file.h>
#include <signal.h>
@ -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)