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:
Ulrich Drepper 1999-02-07 00:06:12 +00:00
parent b8f558b7ac
commit 8d8c6efa78
28 changed files with 7046 additions and 6771 deletions

6676
ChangeLog

File diff suppressed because it is too large Load diff

6652
ChangeLog.9 Normal file

File diff suppressed because it is too large Load diff

3
FAQ
View file

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

3
FAQ.in
View file

@ -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
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
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.
?? Why is extracting files via tar so slow?

25
README
View file

@ -50,18 +50,19 @@ electronic mail to <bug-glibc@gnu.org>.
The GNU C library now includes Michael Glad's Ultra Fast Crypt, which
provides the Unix `crypt' function, plus some other entry points.
Because of the United States export restriction on DES implementations,
we are distributing this code separately from the rest of the C
library. There is an extra distribution tar file just for crypt; it is
called `glibc-crypt-2.1.tar.gz'. You can just unpack the crypt
distribution along with the rest of the C library and build; you can
also build the library without getting crypt. Users outside the USA
can get the crypt distribution via anonymous FTP from ftp.ifi.uio.no
[129.240.64.21], or another archive site outside the USA. Archive
maintainers are encouraged to copy this distribution to their archives
outside the USA. Please get it from ftp.ifi.uio.no; transferring this
distribution from ftp.gnu.org (or any other site in the USA) to a
site outside the USA is in violation of US export laws.
Because of the United States export restriction on DES
implementations, we are distributing this code separately from the
rest of the C library. There is an extra distribution tar file just
for crypt; it is called `glibc-crypt-2.1.tar.gz'. You can just
unpack the crypt distribution along with the rest of the C library and
build; you can also build the library without getting crypt. Users
outside the USA can get the crypt distribution via anonymous FTP from
ftp.funet.fi [128.214.248.6] in the directory pub/gnu/funet, or
another archive site outside the USA. Archive maintainers are
encouraged to copy this distribution to their archives outside the
USA. Please get it from ftp.funet.fi; transferring this distribution
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
used together with GNU libc. They are designed in a way to ease the

View file

@ -50,18 +50,19 @@ electronic mail to <bug-glibc@gnu.org>.
The GNU C library now includes Michael Glad's Ultra Fast Crypt, which
provides the Unix `crypt' function, plus some other entry points.
Because of the United States export restriction on DES implementations,
we are distributing this code separately from the rest of the C
library. There is an extra distribution tar file just for crypt; it is
called `glibc-crypt-VERSION.tar.gz'. You can just unpack the crypt
distribution along with the rest of the C library and build; you can
also build the library without getting crypt. Users outside the USA
can get the crypt distribution via anonymous FTP from ftp.ifi.uio.no
[129.240.64.21], or another archive site outside the USA. Archive
maintainers are encouraged to copy this distribution to their archives
outside the USA. Please get it from ftp.ifi.uio.no; transferring this
distribution from ftp.gnu.org (or any other site in the USA) to a
site outside the USA is in violation of US export laws.
Because of the United States export restriction on DES
implementations, we are distributing this code separately from the
rest of the C library. There is an extra distribution tar file just
for crypt; it is called `glibc-crypt-VERSION.tar.gz'. You can just
unpack the crypt distribution along with the rest of the C library and
build; you can also build the library without getting crypt. Users
outside the USA can get the crypt distribution via anonymous FTP from
ftp.funet.fi [128.214.248.6] in the directory pub/gnu/funet, or
another archive site outside the USA. Archive maintainers are
encouraged to copy this distribution to their archives outside the
USA. Please get it from ftp.funet.fi; transferring this distribution
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
used together with GNU libc. They are designed in a way to ease the

View file

@ -67,3 +67,7 @@ libutil {
libdb1 {
GLIBC_2.0
}
ld.so {
GLIBC_2.0
GLIBC_2.1 GLIBC_2.0
}

View file

@ -15,9 +15,6 @@ libc {
errno;
}
GLIBC_2.1 {
# global variables
__libc_stack_end;
# New special glibc functions.
gnu_get_libc_release; gnu_get_libc_version;
}

View file

@ -30,12 +30,12 @@ isblank (int c)
int
_tolower (int c)
{
return __tolower (c);
return c < -128 || c > 255 ? c : __ctype_tolower[c];
}
int
_toupper (int c)
{
return __toupper (c);
return c < -128 || c > 255 ? c : __ctype_toupper[c];
}
int

View file

@ -39,11 +39,11 @@ func (isxdigit, _ISxdigit)
int
tolower (int c)
{
return c >= -128 && c < 256 ? __tolower (c) : c;
return c >= -128 && c < 256 ? __ctype_tolower[c] : c;
}
int
toupper (int c)
{
return c >= -128 && c < 256 ? __toupper (c) : c;
return c >= -128 && c < 256 ? __ctype_toupper[c] : c;
}

View file

@ -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 __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))
/* The following names are all functions:
@ -128,7 +125,8 @@ extern int toascii __P ((int __c));
#endif /* Use SVID or use misc. */
#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 (_tolower);
#endif
@ -151,26 +149,47 @@ __exctype (_tolower);
#endif
#if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
&& defined __USE_EXTERN_INLINES
&& defined __USE_EXTERN_INLINES
extern __inline int
tolower (int __c)
{
return __c >= -128 && __c < 256 ? __tolower (__c) : __c;
return __c >= -128 && __c < 256 ? __ctype_tolower[__c] : __c;
}
extern __inline int
toupper (int __c)
{
return __c >= -128 && __c < 256 ? __toupper (__c) : __c;
return __c >= -128 && __c < 256 ? __ctype_toupper[__c] : __c;
}
#endif
#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
# define isascii(c) __isascii(c)
# define toascii(c) __toascii(c)
#if __GNUC__ >= 2 && defined __OPTIMIZE__
# define __tobody(c, f, a) \
({ 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 _toupper(c) __toupper(c)
# define tolower(c) __tobody (c, tolower, __ctype_tolower)
# 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 /* Not __NO_CTYPE. */

View file

@ -55,7 +55,7 @@ endif
before-compile = $(objpfx)trusted-dirs.h
ifeq ($(versioning),yes)
ld-map = $(common-objpfx)libc.map
ld-map = $(common-objpfx)ld.so.map
endif
ifeq (yes,$(build-shared))

View file

@ -1,11 +1,19 @@
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 {
# global variables
_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.
__libc_enable_secure; _dl_catch_error; _dl_check_all_versions;
_dl_debug_initialize; _dl_debug_state; _dl_default_scope;
@ -15,15 +23,19 @@ libc {
_dl_sysdep_start; _r_debug;
_dl_global_scope; _dl_lookup_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 {
# global variables
_dl_profile; _dl_profile_map; _dl_profile_output; _dl_start_profile;
_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
_dl_mcount; _dl_mcount_wrapper; _dl_mcount_wrapper_check; _dl_unload_cache;
_dl_mcount; _dl_unload_cache;
}
}

View file

@ -225,10 +225,23 @@ prune_cache (struct database *table, time_t now)
struct hashentry *old = head;
if (debug_level > 0)
dbg_log ("remove %s entry \"%s\"",
serv2str[old->type],
old->last
? old->key : old->data == (void *) -1 ? old->key : "???");
{
char buf[INET6_ADDRSTRLEN];
const char *str;
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. */
if (old->data == (void *) -1)

View file

@ -1,5 +1,5 @@
/* 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.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@ -24,6 +24,7 @@
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/param.h>
#include <sys/poll.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]];
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? */
if (!db->enabled)

View file

@ -1,5 +1,5 @@
/* 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.
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)
{
char buf[64];
char buf[INET_ADDRSTRLEN];
dbg_log (_("Haven't found \"%s\" in hosts cache!"),
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;
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,
&h_errno) != 0
@ -386,7 +391,7 @@ addhstbyaddrv6 (struct database *db, int fd, request_header *req, void *key)
if (debug_level > 0)
{
char buf[64];
char buf[INET6_ADDRSTRLEN];
dbg_log (_("Haven't found \"%s\" in hosts cache!"),
inet_ntop (AF_INET6, key, buf, sizeof (buf)));
}

View file

@ -42,6 +42,10 @@ libresolv {
__res_send;
__sym_ntop; __sym_ntos; __sym_ston;
}
GLIBC_2.1 {
# Needed in libnss_dns.
__ns_name_unpack; __ns_name_ntop;
}
}
libnss_dns {

View file

@ -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.
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
@ -116,6 +116,12 @@ typedef union querybuf
u_char buf[MAXPACKET];
} 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,
const char *qname, int qtype,
@ -315,6 +321,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
char tbuf[MAXDNAME];
const char *tname;
int (*name_ok) __P ((const char *));
u_char packtmp[NS_MAXCDNAME];
tname = qname;
result->h_name = NULL;
@ -346,20 +353,27 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
return NSS_STATUS_UNAVAIL;
}
n = dn_expand (answer->buf, end_of_message, cp, bp, linebuflen);
if (n < 0 || (*name_ok) (bp) == 0)
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)
{
/* There is not enough room in the input buffer. */
*errnop = ERANGE;
*h_errnop = NETDB_INTERNAL;
return NSS_STATUS_TRYAGAIN;
}
else
{
*errnop = errno;
*h_errnop = NO_RECOVERY;
}
n = -1;
}
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;
}
cp += n + QFIXEDSZ;
@ -396,7 +410,20 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
{
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)
{
++had_error;
@ -405,9 +432,9 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
cp += n; /* name */
type = _getshort (cp);
cp += INT16SZ; /* type */
class = _getshort(cp);
class = _getshort (cp);
cp += INT16SZ + INT32SZ; /* class, TTL */
n = _getshort(cp);
n = _getshort (cp);
cp += INT16SZ; /* len */
if (class != C_IN)
{
@ -444,8 +471,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
++had_error;
continue;
}
result->h_name = strcpy (bp, tbuf); /* Cannot overflow. */
bp += n;
result->h_name = bp;
bp = __mempcpy (bp, tbuf, n); /* Cannot overflow. */
linebuflen -= n;
continue;
}
@ -466,8 +493,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
++had_error;
continue;
}
tname = strcpy (bp, tbuf); /* Cannot overflow. */
bp += n;
tname = bp;
bp = __mempcpy (bp, tbuf, n); /* Cannot overflow. */
linebuflen -= n;
continue;
}
@ -493,13 +520,27 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
switch (type)
{
case T_PTR:
if (strcasecmp (tname, bp) != 0)
if (__strcasecmp (tname, bp) != 0)
{
syslog (LOG_NOTICE | LOG_AUTH, AskedForGot, qname, bp);
cp += n;
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)
{
++had_error;
@ -577,8 +618,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
cp += n;
continue;
}
memcpy (*hap++ = bp, cp, n);
bp += n;
bp = __mempcpy (*hap++ = bp, cp, n);
cp += n;
linebuflen -= n;
break;
@ -606,10 +646,16 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (result->h_name == NULL)
{
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;
result->h_name = strcpy (bp, qname); /* Cannot overflow. */
bp += n;
result->h_name = bp;
bp = __mempcpy (bp, qname, n); /* Cannot overflow. */
linebuflen -= n;
}

View file

@ -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.
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
@ -95,6 +95,12 @@ typedef union querybuf
u_char buf[MAXPACKET];
} 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. */
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;
int have_answer;
char *ans;
u_char packtmp[NS_MAXCDNAME];
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 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)
break;
cp += n;
@ -278,7 +301,19 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
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))
{
/* XXX What does this mean? The original form from bind

View file

@ -75,10 +75,10 @@ static char rcsid[] = "$Id$";
# include "../conf/portability.h"
#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_unpack __P((const u_char *, const u_char *,
const u_char *, u_char *, size_t));
extern int __ns_name_unpack __P((const u_char *, const u_char *,
const u_char *, u_char *, size_t));
static int ns_name_pack __P((const u_char *, u_char *, int,
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. */
static char digits[] = "0123456789";
static const char digits[] = "0123456789";
/* Forward. */
@ -370,8 +370,8 @@ static int dn_find(const u_char *, const u_char *,
* The root is returned as "."
* All other domains are returned in non absolute form
*/
static int
ns_name_ntop(src, dst, dstsiz)
int
__ns_name_ntop(src, dst, dstsiz)
const u_char *src;
char *dst;
size_t dstsiz;
@ -388,7 +388,7 @@ ns_name_ntop(src, dst, dstsiz)
while ((n = *cp++) != 0) {
if ((n & NS_CMPRSFLGS) != 0) {
/* Some kind of compression pointer. */
__set_errno (EMSGSIZE);
__set_errno (EINVAL);
return (-1);
}
if (dn != dst) {
@ -565,8 +565,8 @@ ns_name_pton(src, dst, dstsiz)
* return:
* -1 if it fails, or consumed octets if it succeeds.
*/
static int
ns_name_unpack(msg, eom, src, dst, dstsiz)
int
__ns_name_unpack(msg, eom, src, dst, dstsiz)
const u_char *msg;
const u_char *eom;
const u_char *src;
@ -767,9 +767,9 @@ ns_name_uncompress(msg, eom, src, dst, dstsiz)
u_char tmp[NS_MAXCDNAME];
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);
if (ns_name_ntop(tmp, dst, dstsiz) == -1)
if (__ns_name_ntop(tmp, dst, dstsiz) == -1)
return (-1);
return (n);
}

View file

@ -12,7 +12,7 @@
BEGIN {
nlibs=0;
while (getline < defsfile) {
if (/^[a-zA-Z0-9_]+ \{/) {
if (/^[a-zA-Z0-9_.]+ \{/) {
libs[$1] = 1;
curlib = $1;
while (getline < defsfile && ! /^}/) {
@ -38,7 +38,7 @@ BEGIN {
}
# This matches the beginning of the version information for a new library.
/^[a-zA-Z0-9_]+/ {
/^[a-zA-Z0-9_.]+/ {
actlib = $1;
if (!libs[$1]) {
printf("no versions defined for %s\n", $1) > "/dev/stderr";

View file

@ -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.
# 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 \
tfformat tiformat tstdiomisc tst-printfsz tst-wc-printf \
scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
tst-tmpnam
scanf12 tst-tmpnam
include ../Rules

View file

@ -41,6 +41,7 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <wchar.h>
#ifndef NDEBUG
# define NDEBUG /* Undefine this for debugging assertions. */
@ -233,14 +234,22 @@ __printf_fp (FILE *fp,
/* Figure out the decimal point character. */
if (info->extra == 0)
{
if (mbtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT))) <= 0)
mbstate_t state;
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);
}
else
{
if (mbtowc (&decimal, _NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT),
strlen (_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT))) <= 0)
mbstate_t state;
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);
}
/* Give default value. */
@ -262,19 +271,26 @@ __printf_fp (FILE *fp,
/* Figure out the thousands separator character. */
if (info->extra == 0)
{
if (mbtowc (&thousands_sep, _NL_CURRENT (LC_NUMERIC,
THOUSANDS_SEP),
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)))
<= 0)
mbstate_t state;
memset (&state, '\0', sizeof (state));
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);
}
else
{
if (mbtowc (&thousands_sep, _NL_CURRENT (LC_MONETARY,
MON_THOUSANDS_SEP),
strlen (_NL_CURRENT (LC_MONETARY,
MON_THOUSANDS_SEP))) <= 0)
mbstate_t state;
memset (&state, '\0', sizeof (state));
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,
MON_THOUSANDS_SEP);
}

View file

@ -1,6 +1,6 @@
/* Print floating point number in hexadecimal notation according to
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.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#include "_itoa.h"
#include <locale/localeinfo.h>
@ -135,14 +136,22 @@ __printf_fphex (FILE *fp,
/* Figure out the decimal point character. */
if (info->extra == 0)
{
if (mbtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT))) <= 0)
mbstate_t state;
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);
}
else
{
if (mbtowc (&decimal, _NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT),
strlen (_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT))) <= 0)
mbstate_t state;
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);
}
/* Give default value. */

23
stdio-common/scanf12.c Normal file
View 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;
}

View file

@ -0,0 +1 @@
+ foo

View file

@ -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.
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. */
if (grouping == (const char *) -1)
{
mbstate_t mbstate;
/* Figure out the thousands separator character. */
if (mbtowc (&thousands_sep,
_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
memset (&mbstate, '\0', sizeof (mbstate));
if (__mbrtowc (&thousands_sep,
_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);
grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
@ -1284,11 +1288,14 @@ do_positional:
if (grouping == (const char *) -1)
{
/* XXX Use wctob. But this is incompatible for now. */
mbstate_t mbstate;
/* Figure out the thousands separator character. */
if (mbtowc (&thousands_sep,
_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
memset (&mbstate, '\0', sizeof (mbstate));
if (__mbrtowc (&thousands_sep,
_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);
grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
if (*grouping == '\0' || *grouping == CHAR_MAX

View file

@ -24,6 +24,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <wctype.h>
#include <bits/libc-lock.h>
#include <locale/localeinfo.h>
@ -199,6 +200,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
wchar_t decimal;
/* The thousands character of the current locale. */
wchar_t thousands;
/* State for the conversions. */
mbstate_t state;
/* Integral holding variables. */
union
{
@ -247,17 +250,25 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
ARGCHECK (s, format);
/* Figure out the decimal point character. */
if (mbtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
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);
/* Figure out the thousands separator character. */
if (mbtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
memset (&state, '\0', sizeof (state));
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);
/* Lock the stream. */
LOCK_STREAM (s);
/* From now on we use `state' to convert the format string. */
memset (&state, '\0', sizeof (state));
/* Run through the format string. */
while (*f != '\0')
{
@ -298,7 +309,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
if (!isascii (*f))
{
/* Non-ASCII, may be a multibyte. */
int len = mblen (f, strlen (f));
int len = __mbrlen (f, strlen (f), &state);
if (len > 0)
{
do
@ -973,6 +984,12 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
if (inchar () == EOF)
/* EOF is only an input error before we read any chars. */
conv_error ();
if (! isdigit (c) && c != decimal)
{
/* This is no valid number. */
ungetc (c, s);
input_error ();
}
if (width > 0)
--width;
}
@ -1008,7 +1025,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
{
if (_tolower (c) == 'i')
{
/* No we have to read the rest as well. */
/* Now we have to read the rest as well. */
ADDW (c);
if (inchar () == EOF || _tolower (c) != 'n')
input_error ();