mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
Update.
1999-02-06 Ulrich Drepper <drepper@cygnus.com> * Versions.def: Add versions for ld.so. * csu/Versions: Remove __libc_stack_end here. * elf/Versions: Split libc definitions in libc and ld.so definitions. * elf/Makefile (ld-map): Change to ld.so.map. * scripts/versions.awk: Recognize dot in library names. * ctype/ctype.h: Remove definitions of __tolower and __toupper. Don't use __tolower and __toupper in inline functions. Add optimizing macros for tolower and toupper. * ctype/ctype-extn.c (_tolower): Don't use __tolower. (_toupper): Don't use __toupper. * ctype/ctype.c (tolower): Don't use __tolower. (toupper): Don't use toupper. * nscd/cache.c (prune_cache): Correct printing of debugging messages. * resolv/Versions (libresolv): Export __ns_name_unpack and __ns_name_ntop. * resolv/res_comp.c: Rename ns_name_unpack to __ns_name_unpack and make it global. Change all users. Similar for ns_name_ntop. * resolv/nss_dns/dns-host.c: Don't use dn_expand when extracting in user-provided buffer. Use __ns_name_unpack and __ns_name_ntop directly to detect too small buffer. * stdio-common/Makefile (tests): Add scanf12. * stdio-common/scanf12.c: New file. * stdio-common/scanf12.input: New file. * stdio-common/vfscanf.c (__vfscanf): Handle +/- at beginning of floating-point correctly if the number is invalid. * stdio-common/vfscanf.c: Don't use non-reentrant multibyte conversion * stdio-common/printf_fphex.c: Likewise. * stdio-common/vfprintf.c: Likewise. See ChangeLog.9 for earlier changes.
This commit is contained in:
6652
ChangeLog.9
Normal file
6652
ChangeLog.9
Normal file
File diff suppressed because it is too large
Load Diff
3
FAQ
3
FAQ
@ -1042,7 +1042,8 @@ on a glibc 2.1 system. You just add -lcompat and you should be fine.
|
|||||||
The glibc-compat add-on will provide the libcompat.a library, the older
|
The glibc-compat add-on will provide the libcompat.a library, the older
|
||||||
nss modules, and a few other files. Together, they should make it
|
nss modules, and a few other files. Together, they should make it
|
||||||
possible to do development with old static libraries on a glibc 2.1
|
possible to do development with old static libraries on a glibc 2.1
|
||||||
system. This add-on is still in development. You can get it from <URL>
|
system. This add-on is still in development. You can get it from
|
||||||
|
ftp://alpha.gnu.org/gnu/glibc-compat-2.1.tar.gz
|
||||||
but please keep in mind that it is experimental.
|
but please keep in mind that it is experimental.
|
||||||
|
|
||||||
|
|
||||||
|
3
FAQ.in
3
FAQ.in
@ -858,7 +858,8 @@ on a glibc 2.1 system. You just add -lcompat and you should be fine.
|
|||||||
The glibc-compat add-on will provide the libcompat.a library, the older
|
The glibc-compat add-on will provide the libcompat.a library, the older
|
||||||
nss modules, and a few other files. Together, they should make it
|
nss modules, and a few other files. Together, they should make it
|
||||||
possible to do development with old static libraries on a glibc 2.1
|
possible to do development with old static libraries on a glibc 2.1
|
||||||
system. This add-on is still in development. You can get it from <URL>
|
system. This add-on is still in development. You can get it from
|
||||||
|
ftp://alpha.gnu.org/gnu/glibc-compat-2.1.tar.gz
|
||||||
but please keep in mind that it is experimental.
|
but please keep in mind that it is experimental.
|
||||||
|
|
||||||
?? Why is extracting files via tar so slow?
|
?? Why is extracting files via tar so slow?
|
||||||
|
25
README
25
README
@ -50,18 +50,19 @@ electronic mail to <bug-glibc@gnu.org>.
|
|||||||
|
|
||||||
The GNU C library now includes Michael Glad's Ultra Fast Crypt, which
|
The GNU C library now includes Michael Glad's Ultra Fast Crypt, which
|
||||||
provides the Unix `crypt' function, plus some other entry points.
|
provides the Unix `crypt' function, plus some other entry points.
|
||||||
Because of the United States export restriction on DES implementations,
|
Because of the United States export restriction on DES
|
||||||
we are distributing this code separately from the rest of the C
|
implementations, we are distributing this code separately from the
|
||||||
library. There is an extra distribution tar file just for crypt; it is
|
rest of the C library. There is an extra distribution tar file just
|
||||||
called `glibc-crypt-2.1.tar.gz'. You can just unpack the crypt
|
for crypt; it is called `glibc-crypt-2.1.tar.gz'. You can just
|
||||||
distribution along with the rest of the C library and build; you can
|
unpack the crypt distribution along with the rest of the C library and
|
||||||
also build the library without getting crypt. Users outside the USA
|
build; you can also build the library without getting crypt. Users
|
||||||
can get the crypt distribution via anonymous FTP from ftp.ifi.uio.no
|
outside the USA can get the crypt distribution via anonymous FTP from
|
||||||
[129.240.64.21], or another archive site outside the USA. Archive
|
ftp.funet.fi [128.214.248.6] in the directory pub/gnu/funet, or
|
||||||
maintainers are encouraged to copy this distribution to their archives
|
another archive site outside the USA. Archive maintainers are
|
||||||
outside the USA. Please get it from ftp.ifi.uio.no; transferring this
|
encouraged to copy this distribution to their archives outside the
|
||||||
distribution from ftp.gnu.org (or any other site in the USA) to a
|
USA. Please get it from ftp.funet.fi; transferring this distribution
|
||||||
site outside the USA is in violation of US export laws.
|
from ftp.gnu.org (or any other site in the USA) to a site outside the
|
||||||
|
USA is in violation of US export laws.
|
||||||
|
|
||||||
Beside the separate crypt tar file there are some more add-ons which can be
|
Beside the separate crypt tar file there are some more add-ons which can be
|
||||||
used together with GNU libc. They are designed in a way to ease the
|
used together with GNU libc. They are designed in a way to ease the
|
||||||
|
@ -50,18 +50,19 @@ electronic mail to <bug-glibc@gnu.org>.
|
|||||||
|
|
||||||
The GNU C library now includes Michael Glad's Ultra Fast Crypt, which
|
The GNU C library now includes Michael Glad's Ultra Fast Crypt, which
|
||||||
provides the Unix `crypt' function, plus some other entry points.
|
provides the Unix `crypt' function, plus some other entry points.
|
||||||
Because of the United States export restriction on DES implementations,
|
Because of the United States export restriction on DES
|
||||||
we are distributing this code separately from the rest of the C
|
implementations, we are distributing this code separately from the
|
||||||
library. There is an extra distribution tar file just for crypt; it is
|
rest of the C library. There is an extra distribution tar file just
|
||||||
called `glibc-crypt-VERSION.tar.gz'. You can just unpack the crypt
|
for crypt; it is called `glibc-crypt-VERSION.tar.gz'. You can just
|
||||||
distribution along with the rest of the C library and build; you can
|
unpack the crypt distribution along with the rest of the C library and
|
||||||
also build the library without getting crypt. Users outside the USA
|
build; you can also build the library without getting crypt. Users
|
||||||
can get the crypt distribution via anonymous FTP from ftp.ifi.uio.no
|
outside the USA can get the crypt distribution via anonymous FTP from
|
||||||
[129.240.64.21], or another archive site outside the USA. Archive
|
ftp.funet.fi [128.214.248.6] in the directory pub/gnu/funet, or
|
||||||
maintainers are encouraged to copy this distribution to their archives
|
another archive site outside the USA. Archive maintainers are
|
||||||
outside the USA. Please get it from ftp.ifi.uio.no; transferring this
|
encouraged to copy this distribution to their archives outside the
|
||||||
distribution from ftp.gnu.org (or any other site in the USA) to a
|
USA. Please get it from ftp.funet.fi; transferring this distribution
|
||||||
site outside the USA is in violation of US export laws.
|
from ftp.gnu.org (or any other site in the USA) to a site outside the
|
||||||
|
USA is in violation of US export laws.
|
||||||
|
|
||||||
Beside the separate crypt tar file there are some more add-ons which can be
|
Beside the separate crypt tar file there are some more add-ons which can be
|
||||||
used together with GNU libc. They are designed in a way to ease the
|
used together with GNU libc. They are designed in a way to ease the
|
||||||
|
@ -67,3 +67,7 @@ libutil {
|
|||||||
libdb1 {
|
libdb1 {
|
||||||
GLIBC_2.0
|
GLIBC_2.0
|
||||||
}
|
}
|
||||||
|
ld.so {
|
||||||
|
GLIBC_2.0
|
||||||
|
GLIBC_2.1 GLIBC_2.0
|
||||||
|
}
|
||||||
|
@ -15,9 +15,6 @@ libc {
|
|||||||
errno;
|
errno;
|
||||||
}
|
}
|
||||||
GLIBC_2.1 {
|
GLIBC_2.1 {
|
||||||
# global variables
|
|
||||||
__libc_stack_end;
|
|
||||||
|
|
||||||
# New special glibc functions.
|
# New special glibc functions.
|
||||||
gnu_get_libc_release; gnu_get_libc_version;
|
gnu_get_libc_release; gnu_get_libc_version;
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,12 @@ isblank (int c)
|
|||||||
int
|
int
|
||||||
_tolower (int c)
|
_tolower (int c)
|
||||||
{
|
{
|
||||||
return __tolower (c);
|
return c < -128 || c > 255 ? c : __ctype_tolower[c];
|
||||||
}
|
}
|
||||||
int
|
int
|
||||||
_toupper (int c)
|
_toupper (int c)
|
||||||
{
|
{
|
||||||
return __toupper (c);
|
return c < -128 || c > 255 ? c : __ctype_toupper[c];
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -39,11 +39,11 @@ func (isxdigit, _ISxdigit)
|
|||||||
int
|
int
|
||||||
tolower (int c)
|
tolower (int c)
|
||||||
{
|
{
|
||||||
return c >= -128 && c < 256 ? __tolower (c) : c;
|
return c >= -128 && c < 256 ? __ctype_tolower[c] : c;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
toupper (int c)
|
toupper (int c)
|
||||||
{
|
{
|
||||||
return c >= -128 && c < 256 ? __toupper (c) : c;
|
return c >= -128 && c < 256 ? __ctype_toupper[c] : c;
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,6 @@ extern __const __int32_t *__ctype_toupper; /* Case conversions. */
|
|||||||
#define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */
|
#define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */
|
||||||
#define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */
|
#define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */
|
||||||
|
|
||||||
#define __tolower(c) ((int) __ctype_tolower[(int) (c)])
|
|
||||||
#define __toupper(c) ((int) __ctype_toupper[(int) (c)])
|
|
||||||
|
|
||||||
#define __exctype(name) extern int name __P ((int))
|
#define __exctype(name) extern int name __P ((int))
|
||||||
|
|
||||||
/* The following names are all functions:
|
/* The following names are all functions:
|
||||||
@ -128,7 +125,8 @@ extern int toascii __P ((int __c));
|
|||||||
#endif /* Use SVID or use misc. */
|
#endif /* Use SVID or use misc. */
|
||||||
|
|
||||||
#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
|
#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
|
||||||
/* These are the same as `toupper' and `tolower'. */
|
/* These are the same as `toupper' and `tolower' except that they do not
|
||||||
|
check the argument for being in the range of a `char'. */
|
||||||
__exctype (_toupper);
|
__exctype (_toupper);
|
||||||
__exctype (_tolower);
|
__exctype (_tolower);
|
||||||
#endif
|
#endif
|
||||||
@ -151,26 +149,47 @@ __exctype (_tolower);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
|
#if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
|
||||||
&& defined __USE_EXTERN_INLINES
|
&& defined __USE_EXTERN_INLINES
|
||||||
extern __inline int
|
extern __inline int
|
||||||
tolower (int __c)
|
tolower (int __c)
|
||||||
{
|
{
|
||||||
return __c >= -128 && __c < 256 ? __tolower (__c) : __c;
|
return __c >= -128 && __c < 256 ? __ctype_tolower[__c] : __c;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern __inline int
|
extern __inline int
|
||||||
toupper (int __c)
|
toupper (int __c)
|
||||||
{
|
{
|
||||||
return __c >= -128 && __c < 256 ? __toupper (__c) : __c;
|
return __c >= -128 && __c < 256 ? __ctype_toupper[__c] : __c;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
|
#if __GNUC__ >= 2 && defined __OPTIMIZE__
|
||||||
# define isascii(c) __isascii(c)
|
# define __tobody(c, f, a) \
|
||||||
# define toascii(c) __toascii(c)
|
({ int __res; \
|
||||||
|
if (sizeof (c) > 1) \
|
||||||
|
{ \
|
||||||
|
if (__builtin_constant_p (c)) \
|
||||||
|
{ \
|
||||||
|
int __c = (c); \
|
||||||
|
__res = __c < -128 || __c > 255 ? __c : a[__c]; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
__res = f (c); \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
__res = a[(int) (c)]; \
|
||||||
|
__res; })
|
||||||
|
|
||||||
# define _tolower(c) __tolower(c)
|
# define tolower(c) __tobody (c, tolower, __ctype_tolower)
|
||||||
# define _toupper(c) __toupper(c)
|
# define toupper(c) __tobody (c, toupper, __ctype_toupper)
|
||||||
|
#endif /* Optimizing gcc */
|
||||||
|
|
||||||
|
#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
|
||||||
|
# define isascii(c) __isascii (c)
|
||||||
|
# define toascii(c) __toascii (c)
|
||||||
|
|
||||||
|
# define _tolower(c) ((int) __ctype_tolower[(int) (c)])
|
||||||
|
# define _toupper(c) ((int) __ctype_toupper[(int) (c)])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* Not __NO_CTYPE. */
|
#endif /* Not __NO_CTYPE. */
|
||||||
|
@ -55,7 +55,7 @@ endif
|
|||||||
before-compile = $(objpfx)trusted-dirs.h
|
before-compile = $(objpfx)trusted-dirs.h
|
||||||
|
|
||||||
ifeq ($(versioning),yes)
|
ifeq ($(versioning),yes)
|
||||||
ld-map = $(common-objpfx)libc.map
|
ld-map = $(common-objpfx)ld.so.map
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (yes,$(build-shared))
|
ifeq (yes,$(build-shared))
|
||||||
|
22
elf/Versions
22
elf/Versions
@ -1,11 +1,19 @@
|
|||||||
libc {
|
libc {
|
||||||
|
GLIBC_2.0 {
|
||||||
|
# functions used in other libraries
|
||||||
|
_dl_open; _dl_close; _dl_addr;
|
||||||
|
}
|
||||||
|
GLIBC_2.1 {
|
||||||
|
# functions used in other libraries
|
||||||
|
_dl_mcount_wrapper; _dl_mcount_wrapper_check;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ld.so {
|
||||||
GLIBC_2.0 {
|
GLIBC_2.0 {
|
||||||
# global variables
|
# global variables
|
||||||
_dl_debug_impcalls; _dl_debug_fd;
|
_dl_debug_impcalls; _dl_debug_fd;
|
||||||
|
|
||||||
# functions used in other libraries
|
|
||||||
_dl_open; _dl_close; _dl_addr; _dl_sysdep_output; _dl_debug_message;
|
|
||||||
|
|
||||||
# Those are in the dynamic linker, but used by libc.so.
|
# Those are in the dynamic linker, but used by libc.so.
|
||||||
__libc_enable_secure; _dl_catch_error; _dl_check_all_versions;
|
__libc_enable_secure; _dl_catch_error; _dl_check_all_versions;
|
||||||
_dl_debug_initialize; _dl_debug_state; _dl_default_scope;
|
_dl_debug_initialize; _dl_debug_state; _dl_default_scope;
|
||||||
@ -15,15 +23,19 @@ libc {
|
|||||||
_dl_sysdep_start; _r_debug;
|
_dl_sysdep_start; _r_debug;
|
||||||
_dl_global_scope; _dl_lookup_symbol_skip;
|
_dl_global_scope; _dl_lookup_symbol_skip;
|
||||||
_dl_lookup_versioned_symbol; _dl_lookup_versioned_symbol_skip;
|
_dl_lookup_versioned_symbol; _dl_lookup_versioned_symbol_skip;
|
||||||
|
_dl_debug_message;
|
||||||
|
|
||||||
|
# Function from libc.so which must be shared with libc.
|
||||||
|
calloc; free; malloc; realloc;
|
||||||
}
|
}
|
||||||
GLIBC_2.1 {
|
GLIBC_2.1 {
|
||||||
# global variables
|
# global variables
|
||||||
_dl_profile; _dl_profile_map; _dl_profile_output; _dl_start_profile;
|
_dl_profile; _dl_profile_map; _dl_profile_output; _dl_start_profile;
|
||||||
_dl_loaded; _dl_main_searchlist; _dl_fpu_control; _dl_initial_searchlist;
|
_dl_loaded; _dl_main_searchlist; _dl_fpu_control; _dl_initial_searchlist;
|
||||||
_dl_global_scope_alloc;
|
_dl_global_scope_alloc; __libc_stack_end;
|
||||||
|
|
||||||
# functions used in other libraries
|
# functions used in other libraries
|
||||||
_dl_mcount; _dl_mcount_wrapper; _dl_mcount_wrapper_check; _dl_unload_cache;
|
_dl_mcount; _dl_unload_cache;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
21
nscd/cache.c
21
nscd/cache.c
@ -225,10 +225,23 @@ prune_cache (struct database *table, time_t now)
|
|||||||
struct hashentry *old = head;
|
struct hashentry *old = head;
|
||||||
|
|
||||||
if (debug_level > 0)
|
if (debug_level > 0)
|
||||||
dbg_log ("remove %s entry \"%s\"",
|
{
|
||||||
serv2str[old->type],
|
char buf[INET6_ADDRSTRLEN];
|
||||||
old->last
|
const char *str;
|
||||||
? old->key : old->data == (void *) -1 ? old->key : "???");
|
|
||||||
|
if ((old->type == GETHOSTBYADDR || old->type == GETHOSTBYADDRv6)
|
||||||
|
&& (old->last || old->data == (void *) -1))
|
||||||
|
{
|
||||||
|
inet_ntop (old->type == GETHOSTBYADDR ? AF_INET : AF_INET6,
|
||||||
|
old->key, buf, sizeof (buf));
|
||||||
|
str = buf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
str = old->last ? old->key : (old->data == (void *) -1
|
||||||
|
? old->key : "???");
|
||||||
|
|
||||||
|
dbg_log ("remove %s entry \"%s\"", serv2str[old->type], str);
|
||||||
|
}
|
||||||
|
|
||||||
/* Free the data structures. */
|
/* Free the data structures. */
|
||||||
if (old->data == (void *) -1)
|
if (old->data == (void *) -1)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Inner loops of cache daemon.
|
/* Inner loops of cache daemon.
|
||||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||||
|
|
||||||
@ -24,6 +24,7 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@ -214,7 +215,19 @@ cannot handle old request version %d; current version is %d"),
|
|||||||
struct database *db = &dbs[serv2db[req->type]];
|
struct database *db = &dbs[serv2db[req->type]];
|
||||||
|
|
||||||
if (debug_level > 0)
|
if (debug_level > 0)
|
||||||
dbg_log ("\t%s (%s)", serv2str[req->type], key);
|
{
|
||||||
|
if (req->type == GETHOSTBYADDR || req->type == GETHOSTBYADDRv6)
|
||||||
|
{
|
||||||
|
char buf[INET6_ADDRSTRLEN];
|
||||||
|
|
||||||
|
dbg_log ("\t%s (%s)", serv2str[req->type],
|
||||||
|
inet_ntop (req->type == GETHOSTBYADDR
|
||||||
|
? AF_INET : AF_INET6,
|
||||||
|
key, buf, sizeof (buf)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dbg_log ("\t%s (%s)", serv2str[req->type], key);
|
||||||
|
}
|
||||||
|
|
||||||
/* Is this service enabled? */
|
/* Is this service enabled? */
|
||||||
if (!db->enabled)
|
if (!db->enabled)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Cache handling for host lookup.
|
/* Cache handling for host lookup.
|
||||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ addhstbyaddr (struct database *db, int fd, request_header *req, void *key)
|
|||||||
|
|
||||||
if (debug_level > 0)
|
if (debug_level > 0)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[INET_ADDRSTRLEN];
|
||||||
dbg_log (_("Haven't found \"%s\" in hosts cache!"),
|
dbg_log (_("Haven't found \"%s\" in hosts cache!"),
|
||||||
inet_ntop (AF_INET, key, buf, sizeof (buf)));
|
inet_ntop (AF_INET, key, buf, sizeof (buf)));
|
||||||
}
|
}
|
||||||
@ -356,7 +356,12 @@ addhstbynamev6 (struct database *db, int fd, request_header *req, void *key)
|
|||||||
struct hostent *hst;
|
struct hostent *hst;
|
||||||
|
|
||||||
if (debug_level > 0)
|
if (debug_level > 0)
|
||||||
dbg_log (_("Haven't found \"%s\" in hosts cache!"), key);
|
{
|
||||||
|
char buf[INET6_ADDRSTRLEN];
|
||||||
|
|
||||||
|
dbg_log (_("Haven't found \"%s\" in hosts cache!"),
|
||||||
|
inet_ntop (AF_INET6, key, buf, sizeof (buf)));
|
||||||
|
}
|
||||||
|
|
||||||
while (gethostbyname2_r (key, AF_INET6, &resultbuf, buffer, buflen, &hst,
|
while (gethostbyname2_r (key, AF_INET6, &resultbuf, buffer, buflen, &hst,
|
||||||
&h_errno) != 0
|
&h_errno) != 0
|
||||||
@ -386,7 +391,7 @@ addhstbyaddrv6 (struct database *db, int fd, request_header *req, void *key)
|
|||||||
|
|
||||||
if (debug_level > 0)
|
if (debug_level > 0)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[INET6_ADDRSTRLEN];
|
||||||
dbg_log (_("Haven't found \"%s\" in hosts cache!"),
|
dbg_log (_("Haven't found \"%s\" in hosts cache!"),
|
||||||
inet_ntop (AF_INET6, key, buf, sizeof (buf)));
|
inet_ntop (AF_INET6, key, buf, sizeof (buf)));
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,10 @@ libresolv {
|
|||||||
__res_send;
|
__res_send;
|
||||||
__sym_ntop; __sym_ntos; __sym_ston;
|
__sym_ntop; __sym_ntos; __sym_ston;
|
||||||
}
|
}
|
||||||
|
GLIBC_2.1 {
|
||||||
|
# Needed in libnss_dns.
|
||||||
|
__ns_name_unpack; __ns_name_ntop;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
libnss_dns {
|
libnss_dns {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
@ -116,6 +116,12 @@ typedef union querybuf
|
|||||||
u_char buf[MAXPACKET];
|
u_char buf[MAXPACKET];
|
||||||
} querybuf;
|
} querybuf;
|
||||||
|
|
||||||
|
/* These functions are defined in res_comp.c. */
|
||||||
|
#define NS_MAXCDNAME 255 /* maximum compressed domain name */
|
||||||
|
extern int __ns_name_ntop __P ((const u_char *, char *, size_t));
|
||||||
|
extern int __ns_name_unpack __P ((const u_char *, const u_char *,
|
||||||
|
const u_char *, u_char *, size_t));
|
||||||
|
|
||||||
|
|
||||||
static enum nss_status getanswer_r (const querybuf *answer, int anslen,
|
static enum nss_status getanswer_r (const querybuf *answer, int anslen,
|
||||||
const char *qname, int qtype,
|
const char *qname, int qtype,
|
||||||
@ -315,6 +321,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
|
|||||||
char tbuf[MAXDNAME];
|
char tbuf[MAXDNAME];
|
||||||
const char *tname;
|
const char *tname;
|
||||||
int (*name_ok) __P ((const char *));
|
int (*name_ok) __P ((const char *));
|
||||||
|
u_char packtmp[NS_MAXCDNAME];
|
||||||
|
|
||||||
tname = qname;
|
tname = qname;
|
||||||
result->h_name = NULL;
|
result->h_name = NULL;
|
||||||
@ -346,20 +353,27 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
|
|||||||
return NSS_STATUS_UNAVAIL;
|
return NSS_STATUS_UNAVAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = dn_expand (answer->buf, end_of_message, cp, bp, linebuflen);
|
n = __ns_name_unpack (answer->buf, end_of_message, cp,
|
||||||
if (n < 0 || (*name_ok) (bp) == 0)
|
packtmp, sizeof packtmp);
|
||||||
|
if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1)
|
||||||
{
|
{
|
||||||
if (errno == EMSGSIZE)
|
if (errno == EMSGSIZE)
|
||||||
{
|
{
|
||||||
/* There is not enough room in the input buffer. */
|
|
||||||
*errnop = ERANGE;
|
*errnop = ERANGE;
|
||||||
*h_errnop = NETDB_INTERNAL;
|
*h_errnop = NETDB_INTERNAL;
|
||||||
|
return NSS_STATUS_TRYAGAIN;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
n = -1;
|
||||||
*errnop = errno;
|
}
|
||||||
*h_errnop = NO_RECOVERY;
|
|
||||||
}
|
if (n > 0 && bp[0] == '.')
|
||||||
|
bp[0] = '\0';
|
||||||
|
|
||||||
|
if (n < 0 || (*name_ok) (bp) == 0)
|
||||||
|
{
|
||||||
|
*errnop = errno;
|
||||||
|
*h_errnop = NO_RECOVERY;
|
||||||
return NSS_STATUS_UNAVAIL;
|
return NSS_STATUS_UNAVAIL;
|
||||||
}
|
}
|
||||||
cp += n + QFIXEDSZ;
|
cp += n + QFIXEDSZ;
|
||||||
@ -396,7 +410,20 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
|
|||||||
{
|
{
|
||||||
int type, class;
|
int type, class;
|
||||||
|
|
||||||
n = dn_expand (answer->buf, end_of_message, cp, bp, linebuflen);
|
n = __ns_name_unpack (answer->buf, end_of_message, cp,
|
||||||
|
packtmp, sizeof packtmp);
|
||||||
|
if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1)
|
||||||
|
{
|
||||||
|
if (errno == EMSGSIZE)
|
||||||
|
{
|
||||||
|
*errnop = ERANGE;
|
||||||
|
*h_errnop = NETDB_INTERNAL;
|
||||||
|
return NSS_STATUS_TRYAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (n < 0 || (*name_ok) (bp) == 0)
|
if (n < 0 || (*name_ok) (bp) == 0)
|
||||||
{
|
{
|
||||||
++had_error;
|
++had_error;
|
||||||
@ -405,9 +432,9 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
|
|||||||
cp += n; /* name */
|
cp += n; /* name */
|
||||||
type = _getshort (cp);
|
type = _getshort (cp);
|
||||||
cp += INT16SZ; /* type */
|
cp += INT16SZ; /* type */
|
||||||
class = _getshort(cp);
|
class = _getshort (cp);
|
||||||
cp += INT16SZ + INT32SZ; /* class, TTL */
|
cp += INT16SZ + INT32SZ; /* class, TTL */
|
||||||
n = _getshort(cp);
|
n = _getshort (cp);
|
||||||
cp += INT16SZ; /* len */
|
cp += INT16SZ; /* len */
|
||||||
if (class != C_IN)
|
if (class != C_IN)
|
||||||
{
|
{
|
||||||
@ -444,8 +471,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
|
|||||||
++had_error;
|
++had_error;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result->h_name = strcpy (bp, tbuf); /* Cannot overflow. */
|
result->h_name = bp;
|
||||||
bp += n;
|
bp = __mempcpy (bp, tbuf, n); /* Cannot overflow. */
|
||||||
linebuflen -= n;
|
linebuflen -= n;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -466,8 +493,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
|
|||||||
++had_error;
|
++had_error;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tname = strcpy (bp, tbuf); /* Cannot overflow. */
|
tname = bp;
|
||||||
bp += n;
|
bp = __mempcpy (bp, tbuf, n); /* Cannot overflow. */
|
||||||
linebuflen -= n;
|
linebuflen -= n;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -493,13 +520,27 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case T_PTR:
|
case T_PTR:
|
||||||
if (strcasecmp (tname, bp) != 0)
|
if (__strcasecmp (tname, bp) != 0)
|
||||||
{
|
{
|
||||||
syslog (LOG_NOTICE | LOG_AUTH, AskedForGot, qname, bp);
|
syslog (LOG_NOTICE | LOG_AUTH, AskedForGot, qname, bp);
|
||||||
cp += n;
|
cp += n;
|
||||||
continue; /* XXX - had_error++ ? */
|
continue; /* XXX - had_error++ ? */
|
||||||
}
|
}
|
||||||
n = dn_expand (answer->buf, end_of_message, cp, bp, linebuflen);
|
|
||||||
|
n = __ns_name_unpack (answer->buf, end_of_message, cp,
|
||||||
|
packtmp, sizeof packtmp);
|
||||||
|
if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1)
|
||||||
|
{
|
||||||
|
if (errno == EMSGSIZE)
|
||||||
|
{
|
||||||
|
*errnop = ERANGE;
|
||||||
|
*h_errnop = NETDB_INTERNAL;
|
||||||
|
return NSS_STATUS_TRYAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (n < 0 || res_hnok (bp) == 0)
|
if (n < 0 || res_hnok (bp) == 0)
|
||||||
{
|
{
|
||||||
++had_error;
|
++had_error;
|
||||||
@ -577,8 +618,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
|
|||||||
cp += n;
|
cp += n;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
memcpy (*hap++ = bp, cp, n);
|
bp = __mempcpy (*hap++ = bp, cp, n);
|
||||||
bp += n;
|
|
||||||
cp += n;
|
cp += n;
|
||||||
linebuflen -= n;
|
linebuflen -= n;
|
||||||
break;
|
break;
|
||||||
@ -606,10 +646,16 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
|
|||||||
if (result->h_name == NULL)
|
if (result->h_name == NULL)
|
||||||
{
|
{
|
||||||
n = strlen (qname) + 1; /* For the \0. */
|
n = strlen (qname) + 1; /* For the \0. */
|
||||||
if (n > linebuflen || n >= MAXHOSTNAMELEN)
|
if (n > linebuflen)
|
||||||
|
{
|
||||||
|
*errnop = ERANGE;
|
||||||
|
*h_errnop = NETDB_INTERNAL;
|
||||||
|
return NSS_STATUS_TRYAGAIN;
|
||||||
|
}
|
||||||
|
if (n >= MAXHOSTNAMELEN)
|
||||||
goto no_recovery;
|
goto no_recovery;
|
||||||
result->h_name = strcpy (bp, qname); /* Cannot overflow. */
|
result->h_name = bp;
|
||||||
bp += n;
|
bp = __mempcpy (bp, qname, n); /* Cannot overflow. */
|
||||||
linebuflen -= n;
|
linebuflen -= n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
@ -95,6 +95,12 @@ typedef union querybuf
|
|||||||
u_char buf[MAXPACKET];
|
u_char buf[MAXPACKET];
|
||||||
} querybuf;
|
} querybuf;
|
||||||
|
|
||||||
|
/* These functions are defined in res_comp.c. */
|
||||||
|
#define NS_MAXCDNAME 255 /* maximum compressed domain name */
|
||||||
|
extern int __ns_name_ntop __P ((const u_char *, char *, size_t));
|
||||||
|
extern int __ns_name_unpack __P ((const u_char *, const u_char *,
|
||||||
|
const u_char *, u_char *, size_t));
|
||||||
|
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
static enum nss_status getanswer_r (const querybuf *answer, int anslen,
|
static enum nss_status getanswer_r (const querybuf *answer, int anslen,
|
||||||
@ -235,6 +241,7 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
|
|||||||
char **alias_pointer;
|
char **alias_pointer;
|
||||||
int have_answer;
|
int have_answer;
|
||||||
char *ans;
|
char *ans;
|
||||||
|
u_char packtmp[NS_MAXCDNAME];
|
||||||
|
|
||||||
if (question_count == 0)
|
if (question_count == 0)
|
||||||
{
|
{
|
||||||
@ -267,6 +274,22 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
|
|||||||
int n = dn_expand (answer->buf, end_of_message, cp, bp, linebuflen);
|
int n = dn_expand (answer->buf, end_of_message, cp, bp, linebuflen);
|
||||||
int type, class;
|
int type, class;
|
||||||
|
|
||||||
|
n = __ns_name_unpack (answer->buf, end_of_message, cp,
|
||||||
|
packtmp, sizeof packtmp);
|
||||||
|
if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1)
|
||||||
|
{
|
||||||
|
if (errno == EMSGSIZE)
|
||||||
|
{
|
||||||
|
errno = ERANGE;
|
||||||
|
return NSS_STATUS_TRYAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n > 0 && bp[0] == '.')
|
||||||
|
bp[0] = '\0';
|
||||||
|
|
||||||
if (n < 0 || res_dnok (bp) == 0)
|
if (n < 0 || res_dnok (bp) == 0)
|
||||||
break;
|
break;
|
||||||
cp += n;
|
cp += n;
|
||||||
@ -278,7 +301,19 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
|
|||||||
|
|
||||||
if (class == C_IN && type == T_PTR)
|
if (class == C_IN && type == T_PTR)
|
||||||
{
|
{
|
||||||
n = dn_expand (answer->buf, end_of_message, cp, bp, linebuflen);
|
n = __ns_name_unpack (answer->buf, end_of_message, cp,
|
||||||
|
packtmp, sizeof packtmp);
|
||||||
|
if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1)
|
||||||
|
{
|
||||||
|
if (errno == EMSGSIZE)
|
||||||
|
{
|
||||||
|
errno = ERANGE;
|
||||||
|
return NSS_STATUS_TRYAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (n < 0 || !res_hnok (bp))
|
if (n < 0 || !res_hnok (bp))
|
||||||
{
|
{
|
||||||
/* XXX What does this mean? The original form from bind
|
/* XXX What does this mean? The original form from bind
|
||||||
|
@ -75,10 +75,10 @@ static char rcsid[] = "$Id$";
|
|||||||
# include "../conf/portability.h"
|
# include "../conf/portability.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int ns_name_ntop __P((const u_char *, char *, size_t));
|
extern int __ns_name_ntop __P((const u_char *, char *, size_t));
|
||||||
static int ns_name_pton __P((const char *, u_char *, size_t));
|
static int ns_name_pton __P((const char *, u_char *, size_t));
|
||||||
static int ns_name_unpack __P((const u_char *, const u_char *,
|
extern int __ns_name_unpack __P((const u_char *, const u_char *,
|
||||||
const u_char *, u_char *, size_t));
|
const u_char *, u_char *, size_t));
|
||||||
static int ns_name_pack __P((const u_char *, u_char *, int,
|
static int ns_name_pack __P((const u_char *, u_char *, int,
|
||||||
const u_char **, const u_char **));
|
const u_char **, const u_char **));
|
||||||
static int ns_name_uncompress __P((const u_char *, const u_char *,
|
static int ns_name_uncompress __P((const u_char *, const u_char *,
|
||||||
@ -349,7 +349,7 @@ __putlong(l, msgp)
|
|||||||
|
|
||||||
/* Data. */
|
/* Data. */
|
||||||
|
|
||||||
static char digits[] = "0123456789";
|
static const char digits[] = "0123456789";
|
||||||
|
|
||||||
/* Forward. */
|
/* Forward. */
|
||||||
|
|
||||||
@ -370,8 +370,8 @@ static int dn_find(const u_char *, const u_char *,
|
|||||||
* The root is returned as "."
|
* The root is returned as "."
|
||||||
* All other domains are returned in non absolute form
|
* All other domains are returned in non absolute form
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
ns_name_ntop(src, dst, dstsiz)
|
__ns_name_ntop(src, dst, dstsiz)
|
||||||
const u_char *src;
|
const u_char *src;
|
||||||
char *dst;
|
char *dst;
|
||||||
size_t dstsiz;
|
size_t dstsiz;
|
||||||
@ -388,7 +388,7 @@ ns_name_ntop(src, dst, dstsiz)
|
|||||||
while ((n = *cp++) != 0) {
|
while ((n = *cp++) != 0) {
|
||||||
if ((n & NS_CMPRSFLGS) != 0) {
|
if ((n & NS_CMPRSFLGS) != 0) {
|
||||||
/* Some kind of compression pointer. */
|
/* Some kind of compression pointer. */
|
||||||
__set_errno (EMSGSIZE);
|
__set_errno (EINVAL);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (dn != dst) {
|
if (dn != dst) {
|
||||||
@ -565,8 +565,8 @@ ns_name_pton(src, dst, dstsiz)
|
|||||||
* return:
|
* return:
|
||||||
* -1 if it fails, or consumed octets if it succeeds.
|
* -1 if it fails, or consumed octets if it succeeds.
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
ns_name_unpack(msg, eom, src, dst, dstsiz)
|
__ns_name_unpack(msg, eom, src, dst, dstsiz)
|
||||||
const u_char *msg;
|
const u_char *msg;
|
||||||
const u_char *eom;
|
const u_char *eom;
|
||||||
const u_char *src;
|
const u_char *src;
|
||||||
@ -767,9 +767,9 @@ ns_name_uncompress(msg, eom, src, dst, dstsiz)
|
|||||||
u_char tmp[NS_MAXCDNAME];
|
u_char tmp[NS_MAXCDNAME];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if ((n = ns_name_unpack(msg, eom, src, tmp, sizeof tmp)) == -1)
|
if ((n = __ns_name_unpack(msg, eom, src, tmp, sizeof tmp)) == -1)
|
||||||
return (-1);
|
return (-1);
|
||||||
if (ns_name_ntop(tmp, dst, dstsiz) == -1)
|
if (__ns_name_ntop(tmp, dst, dstsiz) == -1)
|
||||||
return (-1);
|
return (-1);
|
||||||
return (n);
|
return (n);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
BEGIN {
|
BEGIN {
|
||||||
nlibs=0;
|
nlibs=0;
|
||||||
while (getline < defsfile) {
|
while (getline < defsfile) {
|
||||||
if (/^[a-zA-Z0-9_]+ \{/) {
|
if (/^[a-zA-Z0-9_.]+ \{/) {
|
||||||
libs[$1] = 1;
|
libs[$1] = 1;
|
||||||
curlib = $1;
|
curlib = $1;
|
||||||
while (getline < defsfile && ! /^}/) {
|
while (getline < defsfile && ! /^}/) {
|
||||||
@ -38,7 +38,7 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# This matches the beginning of the version information for a new library.
|
# This matches the beginning of the version information for a new library.
|
||||||
/^[a-zA-Z0-9_]+/ {
|
/^[a-zA-Z0-9_.]+/ {
|
||||||
actlib = $1;
|
actlib = $1;
|
||||||
if (!libs[$1]) {
|
if (!libs[$1]) {
|
||||||
printf("no versions defined for %s\n", $1) > "/dev/stderr";
|
printf("no versions defined for %s\n", $1) > "/dev/stderr";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
|
# Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
|
||||||
# This file is part of the GNU C Library.
|
# This file is part of the GNU C Library.
|
||||||
|
|
||||||
# The GNU C Library is free software; you can redistribute it and/or
|
# The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -49,7 +49,7 @@ tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \
|
|||||||
bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 bug12 \
|
bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 bug12 \
|
||||||
tfformat tiformat tstdiomisc tst-printfsz tst-wc-printf \
|
tfformat tiformat tstdiomisc tst-printfsz tst-wc-printf \
|
||||||
scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
|
scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
|
||||||
tst-tmpnam
|
scanf12 tst-tmpnam
|
||||||
|
|
||||||
include ../Rules
|
include ../Rules
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
# define NDEBUG /* Undefine this for debugging assertions. */
|
# define NDEBUG /* Undefine this for debugging assertions. */
|
||||||
@ -233,14 +234,22 @@ __printf_fp (FILE *fp,
|
|||||||
/* Figure out the decimal point character. */
|
/* Figure out the decimal point character. */
|
||||||
if (info->extra == 0)
|
if (info->extra == 0)
|
||||||
{
|
{
|
||||||
if (mbtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
|
mbstate_t state;
|
||||||
strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT))) <= 0)
|
|
||||||
|
memset (&state, '\0', sizeof (state));
|
||||||
|
if (__mbrtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
|
||||||
|
strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT)),
|
||||||
|
&state) <= 0)
|
||||||
decimal = (wchar_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
|
decimal = (wchar_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mbtowc (&decimal, _NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT),
|
mbstate_t state;
|
||||||
strlen (_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT))) <= 0)
|
|
||||||
|
memset (&state, '\0', sizeof (state));
|
||||||
|
if (__mbrtowc (&decimal, _NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT),
|
||||||
|
strlen (_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT)),
|
||||||
|
&state) <= 0)
|
||||||
decimal = (wchar_t) *_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT);
|
decimal = (wchar_t) *_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT);
|
||||||
}
|
}
|
||||||
/* Give default value. */
|
/* Give default value. */
|
||||||
@ -262,19 +271,26 @@ __printf_fp (FILE *fp,
|
|||||||
/* Figure out the thousands separator character. */
|
/* Figure out the thousands separator character. */
|
||||||
if (info->extra == 0)
|
if (info->extra == 0)
|
||||||
{
|
{
|
||||||
if (mbtowc (&thousands_sep, _NL_CURRENT (LC_NUMERIC,
|
mbstate_t state;
|
||||||
THOUSANDS_SEP),
|
|
||||||
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)))
|
memset (&state, '\0', sizeof (state));
|
||||||
<= 0)
|
if (__mbrtowc (&thousands_sep, _NL_CURRENT (LC_NUMERIC,
|
||||||
|
THOUSANDS_SEP),
|
||||||
|
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)),
|
||||||
|
&state) <= 0)
|
||||||
thousands_sep = (wchar_t) *_NL_CURRENT (LC_NUMERIC,
|
thousands_sep = (wchar_t) *_NL_CURRENT (LC_NUMERIC,
|
||||||
THOUSANDS_SEP);
|
THOUSANDS_SEP);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mbtowc (&thousands_sep, _NL_CURRENT (LC_MONETARY,
|
mbstate_t state;
|
||||||
MON_THOUSANDS_SEP),
|
|
||||||
strlen (_NL_CURRENT (LC_MONETARY,
|
memset (&state, '\0', sizeof (state));
|
||||||
MON_THOUSANDS_SEP))) <= 0)
|
if (__mbrtowc (&thousands_sep, _NL_CURRENT (LC_MONETARY,
|
||||||
|
MON_THOUSANDS_SEP),
|
||||||
|
strlen (_NL_CURRENT (LC_MONETARY,
|
||||||
|
MON_THOUSANDS_SEP)),
|
||||||
|
&state) <= 0)
|
||||||
thousands_sep = (wchar_t) *_NL_CURRENT (LC_MONETARY,
|
thousands_sep = (wchar_t) *_NL_CURRENT (LC_MONETARY,
|
||||||
MON_THOUSANDS_SEP);
|
MON_THOUSANDS_SEP);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* Print floating point number in hexadecimal notation according to
|
/* Print floating point number in hexadecimal notation according to
|
||||||
ISO C 9X.
|
ISO C 9X.
|
||||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||||
|
|
||||||
@ -26,6 +26,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <wchar.h>
|
||||||
#include "_itoa.h"
|
#include "_itoa.h"
|
||||||
#include <locale/localeinfo.h>
|
#include <locale/localeinfo.h>
|
||||||
|
|
||||||
@ -135,14 +136,22 @@ __printf_fphex (FILE *fp,
|
|||||||
/* Figure out the decimal point character. */
|
/* Figure out the decimal point character. */
|
||||||
if (info->extra == 0)
|
if (info->extra == 0)
|
||||||
{
|
{
|
||||||
if (mbtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
|
mbstate_t state;
|
||||||
strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT))) <= 0)
|
|
||||||
|
memset (&state, '\0', sizeof (state));
|
||||||
|
if (__mbrtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
|
||||||
|
strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT)),
|
||||||
|
&state) <= 0)
|
||||||
decimal = (wchar_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
|
decimal = (wchar_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mbtowc (&decimal, _NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT),
|
mbstate_t state;
|
||||||
strlen (_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT))) <= 0)
|
|
||||||
|
memset (&state, '\0', sizeof (state));
|
||||||
|
if (__mbrtowc (&decimal, _NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT),
|
||||||
|
strlen (_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT)),
|
||||||
|
&state) <= 0)
|
||||||
decimal = (wchar_t) *_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT);
|
decimal = (wchar_t) *_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT);
|
||||||
}
|
}
|
||||||
/* Give default value. */
|
/* Give default value. */
|
||||||
|
23
stdio-common/scanf12.c
Normal file
23
stdio-common/scanf12.c
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
double d;
|
||||||
|
int c;
|
||||||
|
|
||||||
|
if (scanf ("%lg", &d) != EOF)
|
||||||
|
{
|
||||||
|
printf ("scanf didn't failed\n");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
c = getchar ();
|
||||||
|
if (c != ' ')
|
||||||
|
{
|
||||||
|
printf ("c is `%c', not ` '\n", c);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
1
stdio-common/scanf12.input
Normal file
1
stdio-common/scanf12.input
Normal file
@ -0,0 +1 @@
|
|||||||
|
+ foo
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1991,92,93,94,95,96,97,98 Free Software Foundation, Inc.
|
/* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -1121,10 +1121,14 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
|
|||||||
/* XXX Completely wrong. Use wctob. */
|
/* XXX Completely wrong. Use wctob. */
|
||||||
if (grouping == (const char *) -1)
|
if (grouping == (const char *) -1)
|
||||||
{
|
{
|
||||||
|
mbstate_t mbstate;
|
||||||
|
|
||||||
/* Figure out the thousands separator character. */
|
/* Figure out the thousands separator character. */
|
||||||
if (mbtowc (&thousands_sep,
|
memset (&mbstate, '\0', sizeof (mbstate));
|
||||||
_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
|
if (__mbrtowc (&thousands_sep,
|
||||||
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
|
_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
|
||||||
|
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)),
|
||||||
|
&mbstate) <= 0)
|
||||||
thousands_sep = (wchar_t)
|
thousands_sep = (wchar_t)
|
||||||
*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
|
*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
|
||||||
grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
|
grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
|
||||||
@ -1284,11 +1288,14 @@ do_positional:
|
|||||||
|
|
||||||
if (grouping == (const char *) -1)
|
if (grouping == (const char *) -1)
|
||||||
{
|
{
|
||||||
/* XXX Use wctob. But this is incompatible for now. */
|
mbstate_t mbstate;
|
||||||
|
|
||||||
/* Figure out the thousands separator character. */
|
/* Figure out the thousands separator character. */
|
||||||
if (mbtowc (&thousands_sep,
|
memset (&mbstate, '\0', sizeof (mbstate));
|
||||||
_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
|
if (__mbrtowc (&thousands_sep,
|
||||||
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
|
_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
|
||||||
|
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)),
|
||||||
|
&mbstate) <= 0)
|
||||||
thousands_sep = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
|
thousands_sep = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
|
||||||
grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
|
grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
|
||||||
if (*grouping == '\0' || *grouping == CHAR_MAX
|
if (*grouping == '\0' || *grouping == CHAR_MAX
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <wchar.h>
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
#include <bits/libc-lock.h>
|
#include <bits/libc-lock.h>
|
||||||
#include <locale/localeinfo.h>
|
#include <locale/localeinfo.h>
|
||||||
@ -199,6 +200,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
|
|||||||
wchar_t decimal;
|
wchar_t decimal;
|
||||||
/* The thousands character of the current locale. */
|
/* The thousands character of the current locale. */
|
||||||
wchar_t thousands;
|
wchar_t thousands;
|
||||||
|
/* State for the conversions. */
|
||||||
|
mbstate_t state;
|
||||||
/* Integral holding variables. */
|
/* Integral holding variables. */
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
@ -247,17 +250,25 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
|
|||||||
ARGCHECK (s, format);
|
ARGCHECK (s, format);
|
||||||
|
|
||||||
/* Figure out the decimal point character. */
|
/* Figure out the decimal point character. */
|
||||||
if (mbtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
|
memset (&state, '\0', sizeof (state));
|
||||||
strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT))) <= 0)
|
if (__mbrtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
|
||||||
|
strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT)), &state)
|
||||||
|
<= 0)
|
||||||
decimal = (wchar_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
|
decimal = (wchar_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
|
||||||
/* Figure out the thousands separator character. */
|
/* Figure out the thousands separator character. */
|
||||||
if (mbtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
|
memset (&state, '\0', sizeof (state));
|
||||||
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
|
if (__mbrtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
|
||||||
|
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)),
|
||||||
|
&state) <= 0)
|
||||||
thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
|
thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
|
||||||
|
|
||||||
/* Lock the stream. */
|
/* Lock the stream. */
|
||||||
LOCK_STREAM (s);
|
LOCK_STREAM (s);
|
||||||
|
|
||||||
|
|
||||||
|
/* From now on we use `state' to convert the format string. */
|
||||||
|
memset (&state, '\0', sizeof (state));
|
||||||
|
|
||||||
/* Run through the format string. */
|
/* Run through the format string. */
|
||||||
while (*f != '\0')
|
while (*f != '\0')
|
||||||
{
|
{
|
||||||
@ -298,7 +309,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
|
|||||||
if (!isascii (*f))
|
if (!isascii (*f))
|
||||||
{
|
{
|
||||||
/* Non-ASCII, may be a multibyte. */
|
/* Non-ASCII, may be a multibyte. */
|
||||||
int len = mblen (f, strlen (f));
|
int len = __mbrlen (f, strlen (f), &state);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
@ -973,6 +984,12 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
|
|||||||
if (inchar () == EOF)
|
if (inchar () == EOF)
|
||||||
/* EOF is only an input error before we read any chars. */
|
/* EOF is only an input error before we read any chars. */
|
||||||
conv_error ();
|
conv_error ();
|
||||||
|
if (! isdigit (c) && c != decimal)
|
||||||
|
{
|
||||||
|
/* This is no valid number. */
|
||||||
|
ungetc (c, s);
|
||||||
|
input_error ();
|
||||||
|
}
|
||||||
if (width > 0)
|
if (width > 0)
|
||||||
--width;
|
--width;
|
||||||
}
|
}
|
||||||
@ -1008,7 +1025,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
|
|||||||
{
|
{
|
||||||
if (_tolower (c) == 'i')
|
if (_tolower (c) == 'i')
|
||||||
{
|
{
|
||||||
/* No we have to read the rest as well. */
|
/* Now we have to read the rest as well. */
|
||||||
ADDW (c);
|
ADDW (c);
|
||||||
if (inchar () == EOF || _tolower (c) != 'n')
|
if (inchar () == EOF || _tolower (c) != 'n')
|
||||||
input_error ();
|
input_error ();
|
||||||
|
Reference in New Issue
Block a user