* libc/include/langinfo.h: New file.

* libc/include/wchar.h: Likewise.
	* libc/include/sys/syslimits.h: Likewise.
	* libc/locale/fix_grouping.c: Likewise.
	* libc/locale/ldpart.c: Likewise.
	* libc/locale/ldpart.h: Likewise.
	* libc/locale/lmessages.c: Likewise.
	* libc/locale/lmessages.h: Likewise.
	* libc/locale/lmonetary.c: Likewise.
	* libc/locale/lmonetary.h: Likewise.
	* libc/locale/lnumeric.c: Likewise.
	* libc/locale/lnumeric.h: Likewise.
	* libc/locale/nl_langinfo.3: Likewise.
	* libc/locale/nl_langinfo.c: Likewise.
	* libc/locale/timelocal.c: Likewise.
	* libc/locale/timelocal.h: Likewise.
	* libc/stdlib/btowc.c: Likewise.
	* libc/stdlib/mbrlen.c: Likewise.
	* libc/stdlib/mbrtowc.c: Likewise.
	* libc/stdlib/mbsinit.c: Likewise.
	* libc/stdlib/mbsrtowcs.c: Likewise.
	* libc/stdlib/wcrtomb.c: Likewise.
	* libc/stdlib/wcsrtombs.c: Likewise.
	* libc/stdlib/wctob.c: Likewise.
	* libc/sys/linux/prof-freq.c: Likewise.
	* libc/sys/linux/profile.c: Likewise.
	* libc/sys/linux/machine/i386/dl-procinfo.c: Likewise.
	* libc/sys/linux/machine/i386/dl-procinfo.h: Likewise.
	* libc/include/stdlib.h: Change re-entrant functions to take
	mbstate_t pointers.
	* libc/include/sys/_types.h: Define _mbstate_t.
	* libc/include/sys/config.h (MB_LEN_MAX): New macro.
	* libc/include/sys/errno.h (EILSEQ): New error code.
	* libc/include/sys/reent.h: Include wchar.h.  Change reentrant
	structure to use mbstate_t.
	* libc/locale/Makefile.am (LIB_SOURCES): Add new files.
	* libc/machine/powerpc/vfprintf.c: Use mbstate_t.
	* libc/machine/powerpc/vfscanf.c: Likewise.
	* libc/stdio/getdelim.c: Reallocate buffer only when necessary.
	* libc/stdio/vfprintf.c: Likewise.
	* libc/stdio/vfscanf.c: Likewise.
	* libc/stdlib/Makefile.am (LIB_SOURCES): Add new files.
	* libc/stdlib/mblen.c: Use mbstate_t.
	* libc/stdlib/mblen_r.c: Likewise.
	* libc/stdlib/mbstowcs.c: Likewise.
	* libc/stdlib/mbstowcs_r.c: Likewise.
	* libc/stdlib/mbtowc.c: Likewise.
	* libc/stdlib/mbtowc_r.c: Likewise.
	* libc/stdlib/wcstombs.c: Likewise.
	* libc/stdlib/wcstombs_r.c: Likewise.
	* libc/stdlib/wctomb_r.c: Likewise.
	* libc/sys/linux/Makefile.am (LIB_SOURCES): Add prof-freq.c and
	profile.c.
	* libc/sys/linux/machine/i386/Makefile.am (LIB_SOURCES): Add
	dl-procinfo.c.
	* libc/sys/linux/sys/errno.h (EILSEQ): New error code.
	* libc/sys/linux/sys/types.h (off_t): Define type.
	* testsuite/newlib.locale/UTF-8.c: Change locale name from UTF-8
	to C-UTF-8.
	* testsuite/newlib.locale/UTF-8.exp: Likewise.
This commit is contained in:
Thomas Fitzsimmons
2002-08-23 01:56:05 +00:00
parent 1c5dcf3b0a
commit 8d9112f2f3
67 changed files with 2210 additions and 105 deletions

View File

@ -109,21 +109,24 @@ __getdelim (bufptr, n, delim, fp)
}
}
/* Buffer is too small so reallocate a larger buffer. */
pos = ptr - buf;
newsize = (*n << 1);
buf = realloc (buf, newsize);
if (buf == NULL)
if (cont)
{
cont = 0;
break;
}
/* Buffer is too small so reallocate a larger buffer. */
pos = ptr - buf;
newsize = (*n << 1);
buf = realloc (buf, newsize);
if (buf == NULL)
{
cont = 0;
break;
}
/* After reallocating, continue in new buffer */
*bufptr = buf;
*n = newsize;
ptr = buf + pos;
numbytes = newsize - pos;
/* After reallocating, continue in new buffer */
*bufptr = buf;
*n = newsize;
ptr = buf + pos;
numbytes = newsize - pos;
}
}
_funlockfile (fp);

View File

@ -184,6 +184,8 @@ static char *rcsid = "$Id$";
#include <stdlib.h>
#include <string.h>
#include <reent.h>
#include <wchar.h>
#include <string.h>
#ifdef _HAVE_STDC
#include <stdarg.h>
@ -426,7 +428,7 @@ _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap),
struct __siov iov[NIOV];/* ... and individual io vectors */
char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */
char ox[2]; /* space for 0x hex-prefix */
int state = 0; /* mbtowc calls from library must not change state */
mbstate_t state; /* mbtowc calls from library must not change state */
/*
* Choose PADSIZE to trade efficiency vs. size. If larger printf
@ -439,6 +441,7 @@ _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap),
static _CONST char zeroes[PADSIZE] =
{'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
memset (&state, '\0', sizeof (state));
/*
* BEWARE, these `goto error' on error, and PAD uses `n'.
*/
@ -1367,7 +1370,7 @@ get_arg (int n, char *fmt, va_list *ap, int *numargs_p, union arg_val *args,
STATE state, next_state;
ACTION action;
int pos, last_arg;
int wc_state = 0;
mbstate_t wc_state;
int max_pos_arg = n;
enum types { INT, LONG_INT, SHORT_INT, QUAD_INT, CHAR, CHAR_PTR, DOUBLE, LONG_DOUBLE };
@ -1375,6 +1378,8 @@ get_arg (int n, char *fmt, va_list *ap, int *numargs_p, union arg_val *args,
if (*last_fmt != NULL)
fmt = *last_fmt;
memset (&wc_state, '\0', sizeof (wc_state));
/* we need to process either to end of fmt string or until we have actually
read the desired parameter from the vararg list. */
while (*fmt && n >= numargs)

View File

@ -107,6 +107,8 @@ Supporting OS subroutines required:
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <wchar.h>
#include <string.h>
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
@ -257,7 +259,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
char buf[BUF]; /* buffer for numeric conversions */
char *lptr; /* literal pointer */
#ifdef MB_CAPABLE
int state = 0; /* value to keep track of multibyte state */
mbstate_t state; /* value to keep track of multibyte state */
#endif
short *sp;
@ -283,6 +285,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
#ifndef MB_CAPABLE
wc = *fmt;
#else
memset (&state, '\0', sizeof (state));
nbytes = _mbtowc_r (rptr, &wc, fmt, MB_CUR_MAX, &state);
#endif
fmt += nbytes;