From 1217289737588e65b088b3535428b27c7287d699 Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Fri, 1 Aug 2003 20:08:59 +0000 Subject: Add a new *scanf implementation, includeing the *wscanf functions. Should be standards compliant and with several optional features, including support for hexadecimal float notation, locale awareness, glibc-like locale-specific digit grouping with the `'' flag, and positional arg support. I tested it pretty well (finding several bugs in glibc's scanf in the process), but it is brand new so be aware. The *wprintf functions now support floating point output. Also, a couple of bugs were squashed. Finally, %a/%A conversions are now implemented. Implement the glibc xlocale interface for thread-specific locale support. Also add the various *_l(args, locale_t loc_arg) funcs. NOTE!!! setlocale() is NOT threadsafe! NOTE!!! The strto{floating point} conversion functions are now locale aware. The also now support hexadecimal floating point notation. Add the wcsto{floating point} conversion functions. Fix a bug in mktime() related to dst. Note that unlike glibc's mktime, uClibc's version always normalizes the struct tm before attempting to determine the correct dst setting if tm_isdst == -1 on entry. Add a stub version of the libintl functions. (untested) Fixed a known memory leak in setlocale() related to the collation data. Add lots of new config options (which Erik agreed to sort out :-), including finally exposing some of the stripped down stdio configs. Be careful with those though, as they haven't been tested in a long time. (temporary) GOTCHAs... The ctype functions are currently incorrect for 8-bit locales. They will be fixed shortly. The ctype functions are now table-based, resulting in larger staticly linked binaries. I'll be adding an option to use the old approach in the stub locale configuration. --- include/stdio.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/stdio.h') diff --git a/include/stdio.h b/include/stdio.h index 3e27707ae..b11394da7 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -355,12 +355,19 @@ extern int getchar (void) __THROW; /* The C standard explicitly says this is a macro, so we always do the optimization for it. */ +#ifdef __UCLIBC_HAS_THREADS__ +#define getc(_fp) (getc)(_fp) /* SUSv3 says getc must be threadsafe. */ +#else /* __UCLIBC_HAS_THREADS__ */ #define getc(_fp) __GETC(_fp) +#endif /* __UCLIBC_HAS_THREADS__ */ #if defined __USE_POSIX || defined __USE_MISC /* These are defined in POSIX.1:1996. */ extern int getc_unlocked (FILE *__stream) __THROW; extern int getchar_unlocked (void) __THROW; + +/* SUSv3 allows getc_unlocked to be a macro */ +#define getc_unlocked(_fp) __GETC(_fp) #endif /* Use POSIX or MISC. */ #ifdef __USE_MISC @@ -378,7 +385,11 @@ extern int putchar (int __c) __THROW; /* The C standard explicitly says this can be a macro, so we always do the optimization for it. */ +#ifdef __UCLIBC_HAS_THREADS__ +#define putc(_ch, _fp) (putc)(_ch, _fp) /* SUSv3 says putc must be threadsafe. */ +#else /* __UCLIBC_HAS_THREADS__ */ #define putc(_ch, _fp) __PUTC(_ch, _fp) +#endif /* __UCLIBC_HAS_THREADS__ */ #ifdef __USE_MISC /* Faster version when locking is not necessary. */ @@ -389,6 +400,9 @@ extern int fputc_unlocked (int __c, FILE *__stream) __THROW; /* These are defined in POSIX.1:1996. */ extern int putc_unlocked (int __c, FILE *__stream) __THROW; extern int putchar_unlocked (int __c) __THROW; + +/* SUSv3 allows putc_unlocked to be a macro */ +#define putc_unlocked(_ch, _fp) __PUTC(_ch, _fp) #endif /* Use POSIX or MISC. */ @@ -544,6 +558,7 @@ extern int ferror_unlocked (FILE *__stream) __THROW; /* Print a message describing the meaning of the value of errno. */ extern void perror (__const char *__s) __THROW; +#ifdef __UCLIBC_HAS_SYS_ERRLIST__ /* These variables normally should not be used directly. The `strerror' function provides all the needed functionality. */ #ifdef __USE_BSD @@ -555,6 +570,7 @@ extern __const char *__const sys_errlist[]; extern int _sys_nerr; extern __const char *__const _sys_errlist[]; #endif +#endif /* __UCLIBC_HAS_SYS_ERRLIST__ */ #ifdef __USE_POSIX -- cgit v1.2.3