25 # define _GNU_SOURCE 1 34 #if defined _LIBC || defined HAVE___FSETLOCKING 35 # include <stdio_ext.h> 37 #include <sys/types.h> 41 # define alloca __builtin_alloca 42 # define HAVE_ALLOCA 1 46 # define alloca _alloca 48 # if defined HAVE_ALLOCA_H || defined _LIBC 67 #if ENABLE_RELOCATABLE 70 # define relocate(pathname) (pathname) 79 # define strcasecmp __strcasecmp 82 # define mempcpy __mempcpy 84 # define HAVE_MEMPCPY 1 85 # define HAVE___FSETLOCKING 1 88 # include <bits/libc-lock.h> 93 #ifndef internal_function 94 # define internal_function 99 # define FEOF(fp) feof_unlocked (fp) 100 # define FGETS(buf, n, fp) fgets_unlocked (buf, n, fp) 102 # define FEOF(fp) feof (fp) 103 # define FGETS(buf, n, fp) fgets (buf, n, fp) 111 # define alloca(n) malloc (n) 112 # define freea(p) free (p) 115 #if defined _LIBC_REENTRANT || defined HAVE_FGETS_UNLOCKED 117 # define fgets(buf, len, s) fgets_unlocked (buf, len, s) 119 #if defined _LIBC_REENTRANT || defined HAVE_FEOF_UNLOCKED 121 # define feof(s) feof_unlocked (s) 133 # define libc_freeres_ptr(decl) decl 156 static const char *locale_alias_path;
158 const char *result =
NULL;
165 if (locale_alias_path ==
NULL)
177 (int (*)
PARAMS ((
const void *,
186 result = retval->
value;
192 while (added == 0 && locale_alias_path[0] !=
'\0')
198 start = locale_alias_path;
200 while (locale_alias_path[0] !=
'\0' 204 if (start < locale_alias_path)
227 static const char aliasfile[] =
"/locale.alias";
229 full_fname = (
char *)
alloca (fname_len +
sizeof aliasfile);
232 aliasfile,
sizeof aliasfile);
234 memcpy (full_fname, fname, fname_len);
235 memcpy (&full_fname[fname_len], aliasfile,
sizeof aliasfile);
238 fp = fopen (
relocate (full_fname),
"r");
243 #ifdef HAVE___FSETLOCKING 245 __fsetlocking (fp, FSETLOCKING_BYCALLER);
269 while (
isspace ((
unsigned char) cp[0]))
273 if (cp[0] !=
'\0' && cp[0] !=
'#')
276 while (cp[0] !=
'\0' && !
isspace ((
unsigned char) cp[0]))
283 while (
isspace ((
unsigned char) cp[0]))
292 while (cp[0] !=
'\0' && !
isspace ((
unsigned char) cp[0]))
303 else if (cp[0] !=
'\0')
313 alias_len = strlen (alias) + 1;
314 value_len = strlen (value) + 1;
320 + (alias_len + value_len > 1024
321 ? alias_len + value_len : 1024));
323 if (new_pool ==
NULL)
333 for (i = 0; i <
nmap; i++)
346 string_space_act += alias_len;
350 string_space_act += value_len;
402 #if defined _LIBC || defined HAVE_STRCASECMP 405 const unsigned char *p1 = (
const unsigned char *) map1->
alias;
406 const unsigned char *p2 = (
const unsigned char *) map2->
alias;
407 unsigned char c1, c2;
416 c1 = isupper (*p1) ? tolower (*p1) : *p1;
417 c2 = isupper (*p2) ? tolower (*p2) : *p2;
#define __libc_lock_define_initialized(CLASS, NAME)
#define libc_freeres_ptr(decl)
static size_t read_alias_file()
static char * string_space
#define FGETS(buf, n, fp)
static size_t string_space_act
static nls_uint32 nls_uint32 i
#define __libc_lock_unlock(NAME)
static int extend_alias_table()
#define __builtin_expect(expr, val)
static int alias_compare()
#define internal_function
#define LOCALE_ALIAS_PATH
#define relocate(pathname)
#define __libc_lock_lock(NAME)
const char * _nl_expand_alias(char *name) const
static struct alias_map * map
int strcasecmp(char *string1, const char *string2) const
static size_t string_space_max