+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.
/* 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>.
{
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;
-/* 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.
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;
-/* 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
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;
}
for (;*p && !isspace(*p); ++p) {
- *p = tolower (*p);
+ *p = _tolower (*p);
}
/* Next we want to find the permitted name for the remote user. */
-/* 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
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];
-/* 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.
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;
else
base = 8;
- dp = strchr (digits, tolower (*runp));
+ dp = strchr (digits, _tolower (*runp));
if (dp == NULL || (dp - digits) >= base)
{
illegal_char:
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;
if (base != 16)
{
- dp = strchr (digits, tolower (*runp));
+ dp = strchr (digits, _tolower (*runp));
if (dp != NULL && (dp - digits < base))
{
wch *= base;
-/* 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.
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))
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))
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];
/* 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));
-/* 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.
/* 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,
-/* 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.
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,
/* 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
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);
/* 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.
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;
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')
/* 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");
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
#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
/* 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;
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;
/* 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.
int dig_max;
int significant;
- if (tolower (info->spec) == 'e')
+ if (_tolower (info->spec) == 'e')
{
type = info->spec;
intdig_max = 1;
ADDW (c);
c = inchar ();
- if (width != 0 && tolower (c) == 'x')
+ if (width != 0 && _tolower (c) == 'x')
{
if (base == 0)
base = 16;
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. */
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);
}
{
ADDW (c);
c = inchar ();
- if (tolower (c) == 'x')
+ if (_tolower (c) == 'x')
{
/* It is a number in hexadecimal format. */
ADDW (c);
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;
/* 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
haystack = (const unsigned char *) phaystack;
needle = (const unsigned char *) pneedle;
- b = tolower (*needle);
+ b = _tolower (*needle);
if (b != '\0')
{
haystack--; /* possible ANSI violation */
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;
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 */