1999-01-23  Ulrich Drepper  <drepper@cygnus.com>

	* nss/nss_files/files-XXX.c (internal_getent): Make sure the buffer has
	at least two bytes (not one).  Correct buflen parameter type.
	* nss/nss_files/files-alias.c (get_next_alias): Make sure buffer
	has at least two bytes.  Use fgets_unlocked instead of fgets.

	* ctype/ctype.h: Don't user __tolower directly for tolower
	implementation.  Use inline function which tests for the range
	first.  Make _tolower equivalent to old tolower macros.
	Likewise for toupper.
	* ctype/ctype.c: Change tolower/toupper definition accordingly.

	* argp/argp-help.c: Use _tolower instead of tolower if possible.
	* inet/ether_aton_r.c: Likewise.
	* inet/ether_line.c: Likewise.
	* inet/rcmd.c: Likewise.
	* intl/l10nflist.c: Likewise.
	* locale/programs/ld-collate.c: Likewise.
	* locale/programs/linereader.c: Likewise.
	* locale/programs/localedef.c: Likewise.
	* nis/nss_nis/nis-alias.c: Likewise.
	* nis/nss_nis/nis-network.c: Likewise.
	* posix/regex.c: Likewise.
	* resolv/inet_net_pton.c: Likewise.
	* stdio-common/printf_fp.c: Likewise.
	* stdio-common/vfscanf.c: Likewise.
	* sysdeps/generic/strcasestr.c: Likewise.

	* math/bits/mathcalls.h: Fix typo.
This commit is contained in:
Ulrich Drepper 1999-01-23 22:17:17 +00:00
parent 8831788577
commit 4caef86ca6
19 changed files with 114 additions and 68 deletions

View file

@ -1,3 +1,34 @@
1999-01-23 Ulrich Drepper <drepper@cygnus.com>
* nss/nss_files/files-XXX.c (internal_getent): Make sure the buffer has
at least two bytes (not one). Correct buflen parameter type.
* nss/nss_files/files-alias.c (get_next_alias): Make sure buffer
has at least two bytes. Use fgets_unlocked instead of fgets.
* ctype/ctype.h: Don't user __tolower directly for tolower
implementation. Use inline function which tests for the range
first. Make _tolower equivalent to old tolower macros.
Likewise for toupper.
* ctype/ctype.c: Change tolower/toupper definition accordingly.
* argp/argp-help.c: Use _tolower instead of tolower if possible.
* inet/ether_aton_r.c: Likewise.
* inet/ether_line.c: Likewise.
* inet/rcmd.c: Likewise.
* intl/l10nflist.c: Likewise.
* locale/programs/ld-collate.c: Likewise.
* locale/programs/linereader.c: Likewise.
* locale/programs/localedef.c: Likewise.
* nis/nss_nis/nis-alias.c: Likewise.
* nis/nss_nis/nis-network.c: Likewise.
* posix/regex.c: Likewise.
* resolv/inet_net_pton.c: Likewise.
* stdio-common/printf_fp.c: Likewise.
* stdio-common/vfscanf.c: Likewise.
* sysdeps/generic/strcasestr.c: Likewise.
* math/bits/mathcalls.h: Fix typo.
1999-01-23 Roland McGrath <roland@baalperazim.frob.com>
* sysdeps/gnu/errlist.awk: Add comment.

View file

@ -1,5 +1,5 @@
/* Hierarchial argument parsing help output
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@ -759,7 +759,11 @@ hol_entry_cmp (const struct hol_entry *entry1,
{
char first1 = short1 ? short1 : long1 ? *long1 : 0;
char first2 = short2 ? short2 : long2 ? *long2 : 0;
#ifdef _tolower
int lower_cmp = _tolower (first1) - _tolower (first2);
#else
int lower_cmp = tolower (first1) - tolower (first2);
#endif
/* Compare ignoring case, except when the options are both the
same letter, in which case lower-case always comes first. */
return lower_cmp ? lower_cmp : first2 - first1;

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.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@ -33,12 +33,12 @@ ether_aton_r (const char *asc, struct ether_addr *addr)
unsigned int number;
char ch;
ch = tolower (*asc++);
ch = _tolower (*asc++);
if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f'))
return NULL;
number = isdigit (ch) ? (ch - '0') : (ch - 'a' + 10);
ch = tolower (*asc);
ch = _tolower (*asc);
if ((cnt < 5 && ch != ':') || (cnt == 5 && ch != '\0' && !isspace (ch)))
{
++asc;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1996 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1999 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
@ -34,12 +34,12 @@ ether_line (const char *line, struct ether_addr *addr, char *hostname)
unsigned int number;
char ch;
ch = tolower (*line++);
ch = _tolower (*line++);
if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f'))
return -1;
number = isdigit (ch) ? (ch - '0') : (ch - 'a' + 10);
ch = tolower (*line);
ch = _tolower (*line);
if ((cnt < 5 && ch != ':') || (cnt == 5 && ch != '\0' && !isspace (ch)))
{
++line;

View file

@ -574,7 +574,7 @@ __ivaliduser2(hostf, raddr, luser, ruser, rhost)
}
for (;*p && !isspace(*p); ++p) {
*p = tolower (*p);
*p = _tolower (*p);
}
/* Next we want to find the permitted name for the remote user. */

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 1997, 1998, 1999 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
@ -384,7 +384,7 @@ _nl_normalize_codeset (codeset, name_len)
for (cnt = 0; cnt < name_len; ++cnt)
if (isalpha (codeset[cnt]))
*wp++ = tolower (codeset[cnt]);
*wp++ = _tolower (codeset[cnt]);
else if (isdigit (codeset[cnt]))
*wp++ = codeset[cnt];

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -1764,12 +1764,12 @@ collate_simple_weight (struct linereader *lr, struct localedef_t *locale,
int base;
++runp;
if (tolower (*runp) == 'x')
if (_tolower (*runp) == 'x')
{
++runp;
base = 16;
}
else if (tolower (*runp) == 'd')
else if (_tolower (*runp) == 'd')
{
++runp;
base = 10;
@ -1777,7 +1777,7 @@ collate_simple_weight (struct linereader *lr, struct localedef_t *locale,
else
base = 8;
dp = strchr (digits, tolower (*runp));
dp = strchr (digits, _tolower (*runp));
if (dp == NULL || (dp - digits) >= base)
{
illegal_char:
@ -1789,7 +1789,7 @@ illegal character constant in string"));
wch = dp - digits;
++runp;
dp = strchr (digits, tolower (*runp));
dp = strchr (digits, _tolower (*runp));
if (dp == NULL || (dp - digits) >= base)
goto illegal_char;
wch *= base;
@ -1798,7 +1798,7 @@ illegal character constant in string"));
if (base != 16)
{
dp = strchr (digits, tolower (*runp));
dp = strchr (digits, _tolower (*runp));
if (dp != NULL && (dp - digits < base))
{
wch *= base;

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.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@ -300,7 +300,7 @@ get_toplvl_escape (struct linereader *lr)
if (isdigit (ch))
byte = ch - '0';
else
byte = tolower (ch) - 'a' + 10;
byte = _tolower (ch) - 'a' + 10;
ch = lr_getc (lr);
if ((base == 16 && !isxdigit (ch))
@ -311,7 +311,7 @@ get_toplvl_escape (struct linereader *lr)
if (isdigit (ch))
byte += ch - '0';
else
byte += tolower (ch) - 'a' + 10;
byte += _tolower (ch) - 'a' + 10;
ch = lr_getc (lr);
if (base != 16 && isdigit (ch))

View file

@ -558,7 +558,7 @@ normalize_codeset (codeset, name_len)
for (cnt = 0; cnt < name_len; ++cnt)
if (isalpha (codeset[cnt]))
*wp++ = tolower (codeset[cnt]);
*wp++ = _tolower (codeset[cnt]);
else if (isdigit (codeset[cnt]))
*wp++ = codeset[cnt];

View file

@ -275,7 +275,7 @@ __MATHDECL (int,ilogb,, (_Mdouble_ __x));
/* Return X times (2 to the Nth power). */
__MATHCALL (scalbln,, (_Mdouble_ __x, long int __n));
/* Round X to integral valuein floating-point format using current
/* Round X to integral value in floating-point format using current
rounding direction, but do not raise inexact exception. */
__MATHCALL (nearbyint,, (_Mdouble_ __x));

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.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@ -245,7 +245,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
/* Convert name to lowercase. */
for (i = 0; i < namlen; ++i)
name2[i] = tolower (name[i]);
name2[i] = _tolower (name[i]);
name2[i] = '\0';
retval = yperr2nss (yp_match (domain, "mail.aliases", name2, namlen,

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.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@ -195,7 +195,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
int i;
for (i = 0; i < namlen; ++i)
name2[i] = tolower (name[i]);
name2[i] = _tolower (name[i]);
name2[i] = '\0';
retval = yperr2nss (yp_match (domain, "networks.byname", name2,

View file

@ -1,5 +1,5 @@
/* Common code for file-based databases in nss_files module.
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.
The GNU C Library is free software; you can redistribute it and/or
@ -162,14 +162,14 @@ CONCAT(_nss_files_end,ENTNAME) (void)
static enum nss_status
internal_getent (struct STRUCTURE *result,
char *buffer, int buflen, int *errnop H_ERRNO_PROTO)
char *buffer, size_t buflen, int *errnop H_ERRNO_PROTO)
{
char *p;
struct parser_data *data = (void *) buffer;
int linebuflen = buffer + buflen - data->linebuffer;
int parse_result;
if (buflen < (int) sizeof *data + 1)
if (buflen < sizeof *data + 2)
{
*errnop = ERANGE;
H_ERRNO_SET (NETDB_INTERNAL);

View file

@ -1,5 +1,5 @@
/* Mail alias file parser in nss_files module.
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.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@ -148,10 +148,15 @@ get_next_alias (const char *match, struct aliasent *result,
size_t room_left = buflen - (buflen % __alignof__ (char *));
char *line;
/* Check whether the buffer is large enough for even trying to
read something. */
if (room_left < 2)
goto no_more_room;
/* Read the first line. It must contain the alias name and
possibly some alias names. */
first_unused[room_left - 1] = '\xff';
line = fgets (first_unused, room_left, stream);
line = fgets_unlocked (first_unused, room_left, stream);
if (line == NULL)
/* Nothing to read. */
break;
@ -245,7 +250,8 @@ get_next_alias (const char *match, struct aliasent *result,
while (! feof (listfile))
{
first_unused[room_left - 1] = '\xff';
line = fgets (first_unused, room_left, listfile);
line = fgets_unlocked (first_unused, room_left,
listfile);
if (line == NULL)
break;
if (first_unused[room_left - 1] != '\xff')
@ -345,7 +351,7 @@ get_next_alias (const char *match, struct aliasent *result,
/* The just read character is a white space and so
can be ignored. */
first_unused[room_left - 1] = '\xff';
line = fgets (first_unused, room_left, stream);
line = fgets_unlocked (first_unused, room_left, stream);
if (first_unused[room_left - 1] != '\xff')
goto no_more_room;
cp = strpbrk (line, "#\n");

View file

@ -2,7 +2,7 @@
version 0.12.
(Implements POSIX draft P1003.2/D11.2, except for some of the
internationalization features.)
Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
Copyright (C) 1993, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
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
@ -254,6 +254,12 @@ init_syntax_once ()
#define ISUPPER(c) (ISASCII (c) && isupper (c))
#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
#ifdef _tolower
# define TOLOWER(c) _tolower(c)
#else
# define TOLOWER(c) tolower(c)
#endif
#ifndef NULL
# define NULL (void *)0
#endif
@ -5628,7 +5634,7 @@ regcomp (preg, pattern, cflags)
/* Map uppercase characters to corresponding lowercase ones. */
for (i = 0; i < CHAR_SET_SIZE; i++)
preg->translate[i] = ISUPPER (i) ? tolower (i) : i;
preg->translate[i] = ISUPPER (i) ? TOLOWER (i) : i;
}
else
preg->translate = NULL;

View file

@ -107,8 +107,7 @@ inet_net_pton_ipv4(src, dst, size)
src++; /* skip x or X. */
while ((ch = *src++) != '\0' &&
isascii(ch) && isxdigit(ch)) {
if (isupper(ch))
ch = tolower(ch);
ch = _tolower(ch);
n = strchr(xdigits, ch) - xdigits;
assert(n >= 0 && n <= 15);
*dst |= n;

View file

@ -1,5 +1,5 @@
/* Floating point output for `printf'.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -709,7 +709,7 @@ __printf_fp (FILE *fp,
int dig_max;
int significant;
if (tolower (info->spec) == 'e')
if (_tolower (info->spec) == 'e')
{
type = info->spec;
intdig_max = 1;

View file

@ -844,7 +844,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
ADDW (c);
c = inchar ();
if (width != 0 && tolower (c) == 'x')
if (width != 0 && _tolower (c) == 'x')
{
if (base == 0)
base = 16;
@ -883,9 +883,9 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
we must recognize "(nil)" as well. */
if (wpsize == 0 && read_pointer && (width < 0 || width >= 0)
&& c == '('
&& tolower (inchar ()) == 'n'
&& tolower (inchar ()) == 'i'
&& tolower (inchar ()) == 'l'
&& _tolower (inchar ()) == 'n'
&& _tolower (inchar ()) == 'i'
&& _tolower (inchar ()) == 'l'
&& inchar () == ')')
/* We must produce the value of a NULL pointer. A single
'0' digit is enough. */
@ -980,46 +980,46 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
negative = 0;
/* Take care for the special arguments "nan" and "inf". */
if (tolower (c) == 'n')
if (_tolower (c) == 'n')
{
/* Maybe "nan". */
ADDW (c);
if (inchar () == EOF || tolower (c) != 'a')
if (inchar () == EOF || _tolower (c) != 'a')
input_error ();
ADDW (c);
if (inchar () == EOF || tolower (c) != 'n')
if (inchar () == EOF || _tolower (c) != 'n')
input_error ();
ADDW (c);
/* It is "nan". */
goto scan_float;
}
else if (tolower (c) == 'i')
else if (_tolower (c) == 'i')
{
/* Maybe "inf" or "infinity". */
ADDW (c);
if (inchar () == EOF || tolower (c) != 'n')
if (inchar () == EOF || _tolower (c) != 'n')
input_error ();
ADDW (c);
if (inchar () == EOF || tolower (c) != 'f')
if (inchar () == EOF || _tolower (c) != 'f')
input_error ();
ADDW (c);
/* It is as least "inf". */
if (inchar () != EOF)
{
if (tolower (c) == 'i')
if (_tolower (c) == 'i')
{
/* No we have to read the rest as well. */
ADDW (c);
if (inchar () == EOF || tolower (c) != 'n')
if (inchar () == EOF || _tolower (c) != 'n')
input_error ();
ADDW (c);
if (inchar () == EOF || tolower (c) != 'i')
if (inchar () == EOF || _tolower (c) != 'i')
input_error ();
ADDW (c);
if (inchar () == EOF || tolower (c) != 't')
if (inchar () == EOF || _tolower (c) != 't')
input_error ();
ADDW (c);
if (inchar () == EOF || tolower (c) != 'y')
if (inchar () == EOF || _tolower (c) != 'y')
input_error ();
ADDW (c);
}
@ -1036,7 +1036,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
{
ADDW (c);
c = inchar ();
if (tolower (c) == 'x')
if (_tolower (c) == 'x')
{
/* It is a number in hexadecimal format. */
ADDW (c);
@ -1060,7 +1060,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
else if (got_e && wp[wpsize - 1] == exp_char
&& (c == '-' || c == '+'))
ADDW (c);
else if (wpsize > 0 && !got_e && tolower (c) == exp_char)
else if (wpsize > 0 && !got_e && _tolower (c) == exp_char)
{
ADDW (exp_char);
got_e = got_dot = 1;

View file

@ -1,5 +1,5 @@
/* Return the offset of one string within another.
Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1994, 1996, 1997, 1998, 1999 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
@ -52,7 +52,7 @@ __strcasestr (phaystack, pneedle)
haystack = (const unsigned char *) phaystack;
needle = (const unsigned char *) pneedle;
b = tolower (*needle);
b = _tolower (*needle);
if (b != '\0')
{
haystack--; /* possible ANSI violation */
@ -62,9 +62,9 @@ __strcasestr (phaystack, pneedle)
if (c == '\0')
goto ret0;
}
while (tolower (c) != b);
while (_tolower (c) != b);
c = tolower (*++needle);
c = _tolower (*++needle);
if (c == '\0')
goto foundneedle;
++needle;
@ -80,40 +80,40 @@ __strcasestr (phaystack, pneedle)
a = *++haystack;
if (a == '\0')
goto ret0;
if (tolower (a) == b)
if (_tolower (a) == b)
break;
a = *++haystack;
if (a == '\0')
goto ret0;
shloop: }
while (tolower (a) != b);
while (_tolower (a) != b);
jin: a = *++haystack;
if (a == '\0')
goto ret0;
if (tolower (a) != c)
if (_tolower (a) != c)
goto shloop;
rhaystack = haystack-- + 1;
rneedle = needle;
a = tolower (*rneedle);
a = _tolower (*rneedle);
if (tolower (*rhaystack) == a)
if (_tolower (*rhaystack) == a)
do
{
if (a == '\0')
goto foundneedle;
++rhaystack;
a = tolower (*++needle);
if (tolower (*rhaystack) != a)
a = _tolower (*++needle);
if (_tolower (*rhaystack) != a)
break;
if (a == '\0')
goto foundneedle;
++rhaystack;
a = tolower (*++needle);
a = _tolower (*++needle);
}
while (tolower (*rhaystack) == a);
while (_tolower (*rhaystack) == a);
needle = rneedle; /* took the register-poor approach */