mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
1fb05e3db1
1997-02-19 03:28 Miles Bader <miles@gnu.ai.mit.edu> * argp/argp-help.c: Add support for user provided filter of help messages. * argp/argp-parse.c: Likewise. * argp/argp.h: Likewise. * argp/argp-namefrob.h: Define __argp_input. * argp/argp-test.c: Add example for filter. 1997-02-19 02:58 Ulrich Drepper <drepper@cygnus.com> * argp.h: New file. * locale/programs/locale.c: Switch to use argp. * errno.h: Make it possible to get definition of error_t even after having errno.h already. * elf/dl-hash.h: New file. ELF hashing function. Extracted from dl-lookup.c. * elf/dl-lookup.c (_dl_elf_hash): Remove definition. * elf/dl-load.c: Rename _dl_does_name_match_p to _dl_name_match_p. * elf/dl-version.c: Likewise. * elf/dl-lookup.c: Implement new versioning lookup scheme. * elf/dl-version.c (_dl_check_map_versions): Initialize new field in l_versions member. * elf/dlvsym.c: Correct call of _dl_lookup_versioned_symbol_skip and _dl_lookup_versioned_symbol. * elf/link.h: Rename hash_name_pair to struct r_found_version. * sysdeps/alpha/dl-machine.h: Likewise. * sysdeps/i386/dl-machine.h: Likewise. * sysdeps/m68k/dl-machine.h: Likewise. * sysdeps/mips/dl-machine.h: Likewise. * intl/l10nflist.c: (_nl_make_l10nflist): Fix bug in computation of length of abs_filename. * locale/Makefile (CPPFLAGS): Define LOCALE_ALIAS_PATH. * locale/programs/ld-monetary.c (monetary_add): Allow value 0 in mon_grouping information. This means no more grouping. * locale/programs/ld-numeric.c (numeric_add): Write value \377 when seein value 0 in grouping information. * locale/programs/linereader.c (lr_close): Don't free fname since it might be used in error messages. * locale/programs/locale.c: Check whether output of `locale -a' really is locale directory. Also print locale aliases. * misc/search.h (__action_fn_t): Parameters VALUE and LEVEL cannot be const. 1997-02-19 02:16 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/bsd/sun/sunos4/resourcebits.h: Correct #defin to #define. Reported by Rick Flower <FLOWER@sdvax2.sdd.TRW.COM>. 1997-02-19 01:37 Erik Troan <ewt@redhat.com> * shadow/sgetspent_r.c: Accept empty third, fourth and fifth fields. 1997-02-19 01:02 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/mman/syscalls.list: msync takes 3 arguments. Reported by Andreas Jaeger <aj@arthur.pfalz.de>. * sysdeps/stub/msync.c (msync): Add missing third parameter. 1997-02-19 00:29 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/bsd/sigsuspend.c: Call __sigpause with needed additional argument. 1997-02-18 22:13 Ulrich Drepper <drepper@cygnus.com> * inet/net/ethernet.h: New file. * sysdeps/unix/sysv/linux/netinet/if_ether.c: Add BSD compatibility. * sysdeps/unix/sysv/linux/net/if_slip.h: New file. Contributed by a sun <asun@zoology.washington.edu>. * sysdeps/unix/sysv/linux/net/if_arp.h: Include <sys/socket.h>. * sunrpc/rpc/rpc_msg.h: Include <rpc/clnt.h>. Reported by a sun <asun@zoology.washington.edu>. 1997-02-16 14:25 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * Makerules ((common-objpfx)distinfo-$(subdir)): Depend on sysdep makefiles which may change the distinfo variables. 1997-02-16 14:03 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/unix/sysv/linux/Makefile (sysdep_headers) [$(subdir)=misc]: Add sys/quota.h. (sysdep_headers) [$(subdir)=inet]: Add netinet/udp.h. 1997-02-17 13:12 aleph1@dfw.net * sunrpc/clnt_simp.c (callrpc): Prevent buffer overflow by using strncpy. 1997-02-18 03:28 Ulrich Drepper <drepper@cygnus.com> * stdio-common/bug10.c (main): Correct parameter. 1997-02-17 02:51 Ulrich Drepper <drepper@cygnus.com> * malloc/obstack.h: Add `extern "C"' protection. * posix/regex.h: Likewise. * io/ftw.h: Likewise. * misc/libgen.h: Likewise. * login/utmp.h: Likewise. * sysdeps/unix/sysv/linux/sys/reboot.h: Likewise. * sysdeps/unix/sysv/linux/netinet/in.h: Likewise. * sunrpc/rpc/pmap_rmt.h: Likewise. * sunrpc/rpc/auth_des.h: Likewise. * elf/link.h: Likewise. Reported by HJ Lu. 1997-02-17 01:45 a sun <asun@zoology.washington.edu> Linux specific network headers. * sysdeps/unix/sysv/linux/netinet/if_fddi.h: New file. * sysdeps/unix/sysv/linux/netinet/if_tr.h: New file. * sysdeps/unix/sysv/linux/netinet/ip_icmp.h: New file. * sysdeps/unix/sysv/linux/netinet/ip_fw.h: New file. * sysdeps/unix/sysv/linux/netinet/igmp.h: New file. * sysdeps/unix/sysv/linux/netinet/icmp.h: New file. * sysdeps/unix/sysv/linux/netinet/ip.h: New file. * sysdeps/unix/sysv/linux/netinet/tcp.h: New file. * sysdeps/unix/sysv/linux/netipx/ipx.h: New file. * sysdeps/unix/sysv/linux/netatalk/atalk.h: New file. * sysdeps/unix/sysv/linux/Dist: Add new network headers. * sysdeps/unix/sysv/linux/Makefile [$(subdir)=misc] (sysdep_headers): Add sys/quota.h. [$(subdir)=inet] (sysdep_headers): Add new network header. * sysdeps/unix/sysv/linux/netinet/udp.h: Add Linux specific changes. * inet/netinet/ip.h: Move to sysdeps/generic. * inet/netinet/tcp.h: Likewise. * sysdeps/generic/netinet/ip.h: Moved to here from inet/netinet. * sysdeps/generic/netinet/tcp.h: Likewise. 1997-02-17 01:18 Ulrich Drepper <drepper@cygnus.com> * misc/sys/syslog.h (prioritynames): Correct definition to use braces where necessary. (facilitynames): Likewise. Patch by Ronald F. Guilmette <rfg@monkeys.com>. Comment and beautify declarations. 1997-02-16 19:54 1997 Philip Blundell <Philip.Blundell@pobox.com> * inet/Makefile (routines): Add in6_addr, getnameinfo. * inet/getnameinfo.c: New file. Implementation of getnameinfo() by Craig Metz. * inet/in6_addr.c: New file. IPv6 addressing constants. * posix/Makefile (routines): Add gai_strerror. * resolv/netdb.h: Add more constants for IPv6 basic API. * sysdeps/posix/gai_strerror.c: New file. * sysdeps/stub/gai_strerror.c New file. * sysdeps/unix/sysv/linux/netinet/in.h: Add definitions for IPv6 basic API. * sysdeps/posix/getaddrinfo.c: Update from latest version by Craig Metz and use reentrant getXXbyYY functions. 1997-02-15 14:32 Andreas Jaeger <aj@arthur.pfalz.de> * argp/argp.h: Declare argp_program_version as const char. * argp/argp-test.c: Likewise * stdlib/testrand.c (main): Declare main prototype. * stdlib/testdiv.c (main): Likewise. * string/testcopy.c (main): Likewise. * string/test-ffs.c (main): Likewise. * time/test_time.c (main): Likewise. * locale/duplocale.c (__duplocale): Return result. 1997-02-16 03:54 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/netinet/in.h: Declare bindresvport. Reported by fabsoft@fabserver1.zarm.uni-bremen.de. * nss/nss.h: Remove declaration of __nss_shlib_revision. * nss/nsswitch.c: Don't use NSS_SHLIB_VERSION macro. 1997-02-16 03:48 Thorsten Kukuk <kukuk@weber.uni-paderborn.de> * nis/nss_nis/nis-ethers.c (_nss_nis_getethernam_r): Rename to _nss_nis_gethostton_r. (_nss_nis_getetherbyaddr_r): Rename to _nss_nis_getntohost_r. 1997-02-15 22:37 Andy Berkheimer <andy@tho.org> * resolv/gethnamaddr.c (gethostbyname2): Test for ':' in name before trying to resolv name as numeric IPv6 address. * nss/digits_dots.c: Likewise. Sat Feb 15 04:51:08 1997 Ulrich Drepper <drepper@cygnus.com> * locale/setlocale.c (setlocale): Don't try to be clever about unused locales. When the existence of the locale files isn't tested the result of setlocale might be different. 1997-02-15 03:34 Ulrich Drepper <drepper@cygnus.com> * locale/setlocale.c (setlocale): Don't increment usage_count of new locale if it already has the value MAX_USAGE_COUNT (it might be the C locale data which is read-only).
410 lines
10 KiB
C
410 lines
10 KiB
C
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||
|
||
This file is part of the GNU C Library. Its master source is NOT part of
|
||
the C library, however. The master source lives in /gd/gnu/lib.
|
||
|
||
The GNU C Library is free software; you can redistribute it and/or
|
||
modify it under the terms of the GNU Library General Public License as
|
||
published by the Free Software Foundation; either version 2 of the
|
||
License, or (at your option) any later version.
|
||
|
||
The GNU C Library is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
Library General Public License for more details.
|
||
|
||
You should have received a copy of the GNU Library General Public
|
||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||
Boston, MA 02111-1307, USA. */
|
||
|
||
#ifdef HAVE_CONFIG_H
|
||
# include <config.h>
|
||
#endif
|
||
|
||
|
||
#if defined HAVE_STRING_H || defined _LIBC
|
||
# ifndef _GNU_SOURCE
|
||
# define _GNU_SOURCE 1
|
||
# endif
|
||
# include <string.h>
|
||
#else
|
||
# include <strings.h>
|
||
#endif
|
||
#if !HAVE_STRCHR && !defined _LIBC
|
||
# ifndef strchr
|
||
# define strchr index
|
||
# endif
|
||
#endif
|
||
|
||
#if defined _LIBC || defined HAVE_ARGZ_H
|
||
# include <argz.h>
|
||
#endif
|
||
#include <ctype.h>
|
||
#include <sys/types.h>
|
||
|
||
#if defined STDC_HEADERS || defined _LIBC
|
||
# include <stdlib.h>
|
||
#endif
|
||
|
||
#include "loadinfo.h"
|
||
|
||
/* On some strange systems still no definition of NULL is found. Sigh! */
|
||
#ifndef NULL
|
||
# if defined __STDC__ && __STDC__
|
||
# define NULL ((void *) 0)
|
||
# else
|
||
# define NULL 0
|
||
# endif
|
||
#endif
|
||
|
||
/* @@ end of prolog @@ */
|
||
|
||
#ifdef _LIBC
|
||
/* Rename the non ANSI C functions. This is required by the standard
|
||
because some ANSI C functions will require linking with this object
|
||
file and the name space must not be polluted. */
|
||
# define stpcpy(dest, src) __stpcpy(dest, src)
|
||
#else
|
||
# ifndef HAVE_STPCPY
|
||
static char *stpcpy PARAMS ((char *dest, const char *src));
|
||
# endif
|
||
#endif
|
||
|
||
/* Define function which are usually not available. */
|
||
|
||
#if !defined _LIBC && !defined HAVE___ARGZ_COUNT
|
||
/* Returns the number of strings in ARGZ. */
|
||
static size_t argz_count__ PARAMS ((const char *argz, size_t len));
|
||
|
||
static size_t
|
||
argz_count__ (argz, len)
|
||
const char *argz;
|
||
size_t len;
|
||
{
|
||
size_t count = 0;
|
||
while (len > 0)
|
||
{
|
||
size_t part_len = strlen (argz);
|
||
argz += part_len + 1;
|
||
len -= part_len + 1;
|
||
count++;
|
||
}
|
||
return count;
|
||
}
|
||
# undef __argz_count
|
||
# define __argz_count(argz, len) argz_count__ (argz, len)
|
||
#endif /* !_LIBC && !HAVE___ARGZ_COUNT */
|
||
|
||
#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY
|
||
/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
|
||
except the last into the character SEP. */
|
||
static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep));
|
||
|
||
static void
|
||
argz_stringify__ (argz, len, sep)
|
||
char *argz;
|
||
size_t len;
|
||
int sep;
|
||
{
|
||
while (len > 0)
|
||
{
|
||
size_t part_len = strlen (argz);
|
||
argz += part_len;
|
||
len -= part_len + 1;
|
||
if (len > 0)
|
||
*argz++ = sep;
|
||
}
|
||
}
|
||
# undef __argz_stringify
|
||
# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
|
||
#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */
|
||
|
||
#if !defined _LIBC && !defined HAVE___ARGZ_NEXT
|
||
static char *argz_next__ PARAMS ((char *argz, size_t argz_len,
|
||
const char *entry));
|
||
|
||
static char *
|
||
argz_next__ (argz, argz_len, entry)
|
||
char *argz;
|
||
size_t argz_len;
|
||
const char *entry;
|
||
{
|
||
if (entry)
|
||
{
|
||
if (entry < argz + argz_len)
|
||
entry = strchr (entry, '\0') + 1;
|
||
|
||
return entry >= argz + argz_len ? NULL : (char *) entry;
|
||
}
|
||
else
|
||
if (argz_len > 0)
|
||
return argz;
|
||
else
|
||
return 0;
|
||
}
|
||
# undef __argz_next
|
||
# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry)
|
||
#endif /* !_LIBC && !HAVE___ARGZ_NEXT */
|
||
|
||
|
||
/* Return number of bits set in X. */
|
||
static int pop PARAMS ((int x));
|
||
|
||
static inline int
|
||
pop (x)
|
||
int x;
|
||
{
|
||
/* We assume that no more than 16 bits are used. */
|
||
x = ((x & ~0x5555) >> 1) + (x & 0x5555);
|
||
x = ((x & ~0x3333) >> 2) + (x & 0x3333);
|
||
x = ((x >> 4) + x) & 0x0f0f;
|
||
x = ((x >> 8) + x) & 0xff;
|
||
|
||
return x;
|
||
}
|
||
|
||
|
||
struct loaded_l10nfile *
|
||
_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
|
||
territory, codeset, normalized_codeset, modifier, special,
|
||
sponsor, revision, filename, do_allocate)
|
||
struct loaded_l10nfile **l10nfile_list;
|
||
const char *dirlist;
|
||
size_t dirlist_len;
|
||
int mask;
|
||
const char *language;
|
||
const char *territory;
|
||
const char *codeset;
|
||
const char *normalized_codeset;
|
||
const char *modifier;
|
||
const char *special;
|
||
const char *sponsor;
|
||
const char *revision;
|
||
const char *filename;
|
||
int do_allocate;
|
||
{
|
||
char *abs_filename;
|
||
struct loaded_l10nfile *last = NULL;
|
||
struct loaded_l10nfile *retval;
|
||
char *cp;
|
||
size_t entries;
|
||
int cnt;
|
||
|
||
/* Allocate room for the full file name. */
|
||
abs_filename = (char *) malloc (dirlist_len
|
||
+ strlen (language)
|
||
+ ((mask & TERRITORY) != 0
|
||
? strlen (territory) + 1 : 0)
|
||
+ ((mask & XPG_CODESET) != 0
|
||
? strlen (codeset) + 1 : 0)
|
||
+ ((mask & XPG_NORM_CODESET) != 0
|
||
? strlen (normalized_codeset) + 1 : 0)
|
||
+ (((mask & XPG_MODIFIER) != 0
|
||
|| (mask & CEN_AUDIENCE) != 0)
|
||
? strlen (modifier) + 1 : 0)
|
||
+ ((mask & CEN_SPECIAL) != 0
|
||
? strlen (special) + 1 : 0)
|
||
+ (((mask & CEN_SPONSOR) != 0
|
||
|| (mask & CEN_REVISION) != 0)
|
||
? (1 + ((mask & CEN_SPONSOR) != 0
|
||
? strlen (sponsor) + 1 : 0)
|
||
+ ((mask & CEN_REVISION) != 0
|
||
? strlen (revision) + 1 : 0)) : 0)
|
||
+ 1 + strlen (filename) + 1);
|
||
|
||
if (abs_filename == NULL)
|
||
return NULL;
|
||
|
||
retval = NULL;
|
||
last = NULL;
|
||
|
||
/* Construct file name. */
|
||
memcpy (abs_filename, dirlist, dirlist_len);
|
||
__argz_stringify (abs_filename, dirlist_len, ':');
|
||
cp = abs_filename + (dirlist_len - 1);
|
||
*cp++ = '/';
|
||
cp = stpcpy (cp, language);
|
||
|
||
if ((mask & TERRITORY) != 0)
|
||
{
|
||
*cp++ = '_';
|
||
cp = stpcpy (cp, territory);
|
||
}
|
||
if ((mask & XPG_CODESET) != 0)
|
||
{
|
||
*cp++ = '.';
|
||
cp = stpcpy (cp, codeset);
|
||
}
|
||
if ((mask & XPG_NORM_CODESET) != 0)
|
||
{
|
||
*cp++ = '.';
|
||
cp = stpcpy (cp, normalized_codeset);
|
||
}
|
||
if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0)
|
||
{
|
||
/* This component can be part of both syntaces but has different
|
||
leading characters. For CEN we use `+', else `@'. */
|
||
*cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@';
|
||
cp = stpcpy (cp, modifier);
|
||
}
|
||
if ((mask & CEN_SPECIAL) != 0)
|
||
{
|
||
*cp++ = '+';
|
||
cp = stpcpy (cp, special);
|
||
}
|
||
if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0)
|
||
{
|
||
*cp++ = ',';
|
||
if ((mask & CEN_SPONSOR) != 0)
|
||
cp = stpcpy (cp, sponsor);
|
||
if ((mask & CEN_REVISION) != 0)
|
||
{
|
||
*cp++ = '_';
|
||
cp = stpcpy (cp, revision);
|
||
}
|
||
}
|
||
|
||
*cp++ = '/';
|
||
stpcpy (cp, filename);
|
||
|
||
/* Look in list of already loaded domains whether it is already
|
||
available. */
|
||
last = NULL;
|
||
for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
|
||
if (retval->filename != NULL)
|
||
{
|
||
int compare = strcmp (retval->filename, abs_filename);
|
||
if (compare == 0)
|
||
/* We found it! */
|
||
break;
|
||
if (compare < 0)
|
||
{
|
||
/* It's not in the list. */
|
||
retval = NULL;
|
||
break;
|
||
}
|
||
|
||
last = retval;
|
||
}
|
||
|
||
if (retval != NULL || do_allocate == 0)
|
||
{
|
||
free (abs_filename);
|
||
return retval;
|
||
}
|
||
|
||
retval = (struct loaded_l10nfile *)
|
||
malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len)
|
||
* (1 << pop (mask))
|
||
* sizeof (struct loaded_l10nfile *)));
|
||
if (retval == NULL)
|
||
return NULL;
|
||
|
||
retval->filename = abs_filename;
|
||
retval->decided = (__argz_count (dirlist, dirlist_len) != 1
|
||
|| ((mask & XPG_CODESET) != 0
|
||
&& (mask & XPG_NORM_CODESET) != 0));
|
||
retval->data = NULL;
|
||
|
||
if (last == NULL)
|
||
{
|
||
retval->next = *l10nfile_list;
|
||
*l10nfile_list = retval;
|
||
}
|
||
else
|
||
{
|
||
retval->next = last->next;
|
||
last->next = retval;
|
||
}
|
||
|
||
entries = 0;
|
||
/* If the DIRLIST is a real list the RETVAL entry corresponds not to
|
||
a real file. So we have to use the DIRLIST separation mechanism
|
||
of the inner loop. */
|
||
cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask;
|
||
for (; cnt >= 0; --cnt)
|
||
if ((cnt & ~mask) == 0
|
||
&& ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0)
|
||
&& ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0))
|
||
{
|
||
/* Iterate over all elements of the DIRLIST. */
|
||
char *dir = NULL;
|
||
|
||
while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
|
||
!= NULL)
|
||
retval->successor[entries++]
|
||
= _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt,
|
||
language, territory, codeset,
|
||
normalized_codeset, modifier, special,
|
||
sponsor, revision, filename, 1);
|
||
}
|
||
retval->successor[entries] = NULL;
|
||
|
||
return retval;
|
||
}
|
||
|
||
/* Normalize codeset name. There is no standard for the codeset
|
||
names. Normalization allows the user to use any of the common
|
||
names. */
|
||
const char *
|
||
_nl_normalize_codeset (codeset, name_len)
|
||
const char *codeset;
|
||
size_t name_len;
|
||
{
|
||
int len = 0;
|
||
int only_digit = 1;
|
||
char *retval;
|
||
char *wp;
|
||
size_t cnt;
|
||
|
||
for (cnt = 0; cnt < name_len; ++cnt)
|
||
if (isalnum (codeset[cnt]))
|
||
{
|
||
++len;
|
||
|
||
if (isalpha (codeset[cnt]))
|
||
only_digit = 0;
|
||
}
|
||
|
||
retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1);
|
||
|
||
if (retval != NULL)
|
||
{
|
||
if (only_digit)
|
||
wp = stpcpy (retval, "iso");
|
||
else
|
||
wp = retval;
|
||
|
||
for (cnt = 0; cnt < name_len; ++cnt)
|
||
if (isalpha (codeset[cnt]))
|
||
*wp++ = tolower (codeset[cnt]);
|
||
else if (isdigit (codeset[cnt]))
|
||
*wp++ = codeset[cnt];
|
||
|
||
*wp = '\0';
|
||
}
|
||
|
||
return (const char *) retval;
|
||
}
|
||
|
||
|
||
/* @@ begin of epilog @@ */
|
||
|
||
/* We don't want libintl.a to depend on any other library. So we
|
||
avoid the non-standard function stpcpy. In GNU C Library this
|
||
function is available, though. Also allow the symbol HAVE_STPCPY
|
||
to be defined. */
|
||
#if !_LIBC && !HAVE_STPCPY
|
||
static char *
|
||
stpcpy (dest, src)
|
||
char *dest;
|
||
const char *src;
|
||
{
|
||
while ((*dest++ = *src++) != '\0')
|
||
/* Do nothing. */ ;
|
||
return dest - 1;
|
||
}
|
||
#endif
|