summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2004-02-11 23:48:50 +0000
committerManuel Novoa III <mjn3@codepoet.org>2004-02-11 23:48:50 +0000
commit082e680bd54e999f2bb4eb77141958938b1e9ee9 (patch)
tree203c45b85ca608e1550d8ffc459456fc9cf0b30b /libc
parent17c21765b4a97c6f0b74ba8466073e5a3f97cdee (diff)
New stdio core. Should be more maintainable. Fixes a couple of bugs.
Codepaths streamlined. Improved performance for nonthreaded apps when linked with a thread-enabled libc. Minor iconv bug and some locale/thread related startup issues fixed. These showed up in getting a gcj-compiled java helloworld app running. Removed some old extension functions... _stdio_fdout and _stdio_fsfopen.
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/addr.c3
-rw-r--r--libc/misc/assert/__assert.c33
-rw-r--r--libc/misc/locale/locale.c4
-rw-r--r--libc/misc/time/time.c2
-rw-r--r--libc/misc/wchar/Makefile18
-rw-r--r--libc/misc/wchar/wchar.c41
-rw-r--r--libc/misc/wchar/wstdio.c14
-rw-r--r--libc/pwd_grp/pwd_grp.c15
-rw-r--r--libc/stdio/Makefile144
-rw-r--r--libc/stdio/_READ.c66
-rw-r--r--libc/stdio/_WRITE.c100
-rw-r--r--libc/stdio/__fbufsize.c20
-rw-r--r--libc/stdio/__flbf.c20
-rw-r--r--libc/stdio/__fpending.c35
-rw-r--r--libc/stdio/__fpurge.c34
-rw-r--r--libc/stdio/__freadable.c20
-rw-r--r--libc/stdio/__freading.c20
-rw-r--r--libc/stdio/__fsetlocking.c45
-rw-r--r--libc/stdio/__fwritable.c20
-rw-r--r--libc/stdio/__fwriting.c20
-rw-r--r--libc/stdio/_adjust_pos.c68
-rw-r--r--libc/stdio/_cs_funcs.c67
-rw-r--r--libc/stdio/_flushlbf.c18
-rw-r--r--libc/stdio/_fopen.c207
-rw-r--r--libc/stdio/_fpmaxtostr.c738
-rw-r--r--libc/stdio/_fwrite.c78
-rw-r--r--libc/stdio/_load_inttype.c66
-rw-r--r--libc/stdio/_rfill.c45
-rw-r--r--libc/stdio/_stdio.c432
-rw-r--r--libc/stdio/_stdio.h436
-rw-r--r--libc/stdio/_store_inttype.c57
-rw-r--r--libc/stdio/_trans2r.c75
-rw-r--r--libc/stdio/_trans2w.c89
-rw-r--r--libc/stdio/_uintmaxtostr.c151
-rw-r--r--libc/stdio/_wcommit.c31
-rw-r--r--libc/stdio/_wfwrite.c75
-rw-r--r--libc/stdio/asprintf.c29
-rw-r--r--libc/stdio/clearerr.c39
-rw-r--r--libc/stdio/ctermid.c54
-rw-r--r--libc/stdio/dprintf.c21
-rw-r--r--libc/stdio/fclose.c86
-rw-r--r--libc/stdio/fcloseall.c40
-rw-r--r--libc/stdio/fdopen.c17
-rw-r--r--libc/stdio/feof.c42
-rw-r--r--libc/stdio/ferror.c42
-rw-r--r--libc/stdio/fflush.c161
-rw-r--r--libc/stdio/fgetc.c98
-rw-r--r--libc/stdio/fgetpos.c44
-rw-r--r--libc/stdio/fgets.c84
-rw-r--r--libc/stdio/fgetwc.c134
-rw-r--r--libc/stdio/fgetws.c61
-rw-r--r--libc/stdio/fileno.c45
-rw-r--r--libc/stdio/flockfile.c16
-rw-r--r--libc/stdio/fmemopen.c176
-rw-r--r--libc/stdio/fopen.c24
-rw-r--r--libc/stdio/fopencookie.c59
-rw-r--r--libc/stdio/fprintf.c21
-rw-r--r--libc/stdio/fputc.c96
-rw-r--r--libc/stdio/fputs.c46
-rw-r--r--libc/stdio/fputwc.c42
-rw-r--r--libc/stdio/fputws.c44
-rw-r--r--libc/stdio/fread.c108
-rw-r--r--libc/stdio/freopen.c66
-rw-r--r--libc/stdio/fseeko.c89
-rw-r--r--libc/stdio/fsetpos.c44
-rw-r--r--libc/stdio/ftello.c61
-rw-r--r--libc/stdio/ftrylockfile.c19
-rw-r--r--libc/stdio/funlockfile.c15
-rw-r--r--libc/stdio/fwide.c32
-rw-r--r--libc/stdio/fwprintf.c22
-rw-r--r--libc/stdio/fwrite.c59
-rw-r--r--libc/stdio/getchar.c44
-rw-r--r--libc/stdio/getdelim.c124
-rw-r--r--libc/stdio/getline.c34
-rw-r--r--libc/stdio/gets.c36
-rw-r--r--libc/stdio/getw.c18
-rw-r--r--libc/stdio/getwchar.c31
-rw-r--r--libc/stdio/old_vfprintf.c54
-rw-r--r--libc/stdio/open_memstream.c162
-rw-r--r--libc/stdio/perror.c36
-rw-r--r--libc/stdio/popen.c21
-rw-r--r--libc/stdio/printf.c3259
-rw-r--r--libc/stdio/putchar.c44
-rw-r--r--libc/stdio/puts.c33
-rw-r--r--libc/stdio/putw.c28
-rw-r--r--libc/stdio/putwchar.c31
-rw-r--r--libc/stdio/remove.c29
-rw-r--r--libc/stdio/rewind.c20
-rw-r--r--libc/stdio/scanf.c227
-rw-r--r--libc/stdio/setbuf.c15
-rw-r--r--libc/stdio/setbuffer.c21
-rw-r--r--libc/stdio/setlinebuf.c20
-rw-r--r--libc/stdio/setvbuf.c106
-rw-r--r--libc/stdio/snprintf.c27
-rw-r--r--libc/stdio/sprintf.c27
-rw-r--r--libc/stdio/stdio.c3677
-rw-r--r--libc/stdio/swprintf.c29
-rw-r--r--libc/stdio/ungetc.c77
-rw-r--r--libc/stdio/ungetwc.c48
-rw-r--r--libc/stdio/vasprintf.c75
-rw-r--r--libc/stdio/vdprintf.c62
-rw-r--r--libc/stdio/vfprintf.c1901
-rw-r--r--libc/stdio/vprintf.c14
-rw-r--r--libc/stdio/vsnprintf.c210
-rw-r--r--libc/stdio/vsprintf.c21
-rw-r--r--libc/stdio/vswprintf.c70
-rw-r--r--libc/stdio/vwprintf.c15
-rw-r--r--libc/stdio/wprintf.c23
-rw-r--r--libc/stdlib/abort.c8
-rw-r--r--libc/stdlib/ptsname.c3
-rw-r--r--libc/stdlib/stdlib.c10
-rw-r--r--libc/string/wstring.c9
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_locale.h1
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_stdio.h716
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h115
115 files changed, 9161 insertions, 7713 deletions
diff --git a/libc/inet/addr.c b/libc/inet/addr.c
index a75916e69..75ebc191e 100644
--- a/libc/inet/addr.c
+++ b/libc/inet/addr.c
@@ -16,13 +16,14 @@
* Changed to use _int10tostr.
*/
+#define _GNU_SOURCE
#define __FORCE_GLIBC
#include <features.h>
-#define _STDIO_UTILITY /* For _int10tostr. */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <netinet/in.h>
+#include <bits/uClibc_uintmaxtostr.h>
int inet_aton(const char *cp, struct in_addr *addrptr);
diff --git a/libc/misc/assert/__assert.c b/libc/misc/assert/__assert.c
index 74b5ee86f..2949b75f0 100644
--- a/libc/misc/assert/__assert.c
+++ b/libc/misc/assert/__assert.c
@@ -27,10 +27,11 @@
* and is useful in debugging the stdio code.
*/
-#define _STDIO_UTILITY /* For _stdio_fdout and _int10tostr. */
+#define _ISOC99_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <bits/uClibc_uintmaxtostr.h>
/* Get the prototype from assert.h as a double-check. */
#undef NDEBUG
@@ -44,8 +45,6 @@
extern const char *__progname;
#endif
-#if 1
-
static int in_assert; /* bss inits to 0. */
void __assert(const char *assertion, const char * filename,
@@ -69,31 +68,3 @@ void __assert(const char *assertion, const char * filename,
}
abort();
}
-
-#else
-
-void __assert(const char *assertion, const char * filename,
- int linenumber, register const char * function)
-{
- char buf[__BUFLEN_INT10TOSTR];
-
- _stdio_fdout(STDERR_FILENO,
-#ifdef ASSERT_SHOW_PROGNAME
- __progname,
- ": ",
-#endif
- filename,
- ":",
- _int10tostr(buf+sizeof(buf)-1, linenumber),
- ": ",
- /* Function name isn't available with some compilers. */
- ((function == NULL) ? "?function?" : function),
- ": Assertion `",
- assertion,
- "' failed.\n",
- NULL
- );
- abort();
-}
-
-#endif
diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c
index cf058ce3e..c6a1a2dd0 100644
--- a/libc/misc/locale/locale.c
+++ b/libc/misc/locale/locale.c
@@ -346,7 +346,7 @@ struct lconv *localeconv(void)
/**********************************************************************/
#if defined(L__locale_init) && !defined(__LOCALE_C_ONLY)
-static __uclibc_locale_t __global_locale_data;
+__uclibc_locale_t __global_locale_data;
__locale_t __global_locale = &__global_locale_data;
@@ -1420,7 +1420,7 @@ int __locale_mbrtowc_l(wchar_t *__restrict dst,
mbstate_t ps;
const char *p = src;
size_t r;
- ps.mask = 0;
+ ps.__mask = 0;
r = _wchar_utf8sntowcs(dst, 1, &p, SIZE_MAX, &ps, 1);
return (r == 1) ? (p-src) : r; /* Need to return 0 if nul char. */
}
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
index e2f1f6c6d..8176e071a 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -135,7 +135,6 @@
*/
#define _GNU_SOURCE
-#define _STDIO_UTILITY
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@@ -147,6 +146,7 @@
#include <ctype.h>
#include <langinfo.h>
#include <locale.h>
+#include <bits/uClibc_uintmaxtostr.h>
#ifdef __UCLIBC_HAS_XLOCALE__
#include <xlocale.h>
diff --git a/libc/misc/wchar/Makefile b/libc/misc/wchar/Makefile
index a96dae2b4..b1db37293 100644
--- a/libc/misc/wchar/Makefile
+++ b/libc/misc/wchar/Makefile
@@ -33,17 +33,17 @@ ifeq ($(UCLIBC_HAS_LOCALE),y)
MOBJ1 += iconv.o
endif
-MSRC2= wstdio.c
-MOBJ2= fwide.o \
- fgetwc.o getwchar.o fgetws.o \
- fputwc.o putwchar.o fputws.o \
- ungetwc.o
-# getwc (fgetwc alias) getwc_unlocked (fgetwc_unlocked alias)
-# putwc (fputwc alias) putwc_unlocked (fputwc_unlocked alias)
-
+# The stdio and time related wide functions are now built in the normal
+# directories.
+#
+# stdio:
+# fwide fgetwc getwchar fgetws fputwc putwchar fputws ungetwc
+# getwc (fgetwc alias) getwc_unlocked (fgetwc_unlocked alias)
+# putwc (fputwc alias) putwc_unlocked (fputwc_unlocked alias)
+# time:
# wcsftime
-OBJS=$(MOBJ1) $(MOBJ2)
+OBJS=$(MOBJ1)
all: $(OBJS) $(LIBC)
diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c
index 4fc96f430..d1383c99f 100644
--- a/libc/misc/wchar/wchar.c
+++ b/libc/misc/wchar/wchar.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 2002 Manuel Novoa III
+/* Copyright (C) 2002, 2003, 2004 Manuel Novoa III
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -92,6 +92,9 @@
* Aug 18, 2003
* Bug fix: _wchar_utf8sntowcs and _wchar_wcsntoutf8s now set errno if EILSEQ.