diff options
Diffstat (limited to 'libc/stdio')
36 files changed, 159 insertions, 77 deletions
diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c index f4df3f2de..6c2ef81f3 100644 --- a/libc/stdio/_fopen.c +++ b/libc/stdio/_fopen.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define isatty __isatty + #include "_stdio.h" /* diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c index 2024caca1..99fc9a9dd 100644 --- a/libc/stdio/_fpmaxtostr.c +++ b/libc/stdio/_fpmaxtostr.c @@ -694,12 +694,12 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info cnt += num_groups * tslen; /* Adjust count now for sep chars. */ -/* printf("\n"); */ +/* __printf("\n"); */ do { if (!blk) { /* Initial group could be 0 digits long! */ blk = nblk2; } else if (len >= blk) { /* Enough digits for a group. */ -/* printf("norm: len=%d blk=%d \"%.*s\"\n", len, blk, blk, gp); */ +/* __printf("norm: len=%d blk=%d \"%.*s\"\n", len, blk, blk, gp); */ if (fp_outfunc(fp, *ppc, blk, (intptr_t) gp) != blk) { return -1; } @@ -709,9 +709,9 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info } len -= blk; } else { /* Transition to 0s. */ -/* printf("trans: len=%d blk=%d \"%.*s\"\n", len, blk, len, gp); */ +/* __printf("trans: len=%d blk=%d \"%.*s\"\n", len, blk, len, gp); */ if (len) { -/* printf("len\n"); */ +/* __printf("len\n"); */ if (fp_outfunc(fp, *ppc, len, (intptr_t) gp) != len) { return -1; } @@ -719,7 +719,7 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info } if (ppc[3] == FPO_ZERO_PAD) { /* Need to group 0s */ -/* printf("zeropad\n"); */ +/* __printf("zeropad\n"); */ cnt += ppc[1]; ppc += 3; gp = (const char *) ppc[2]; @@ -742,7 +742,7 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info } blk = nblk2; -/* printf("num_groups=%d blk=%d\n", num_groups, blk); */ +/* __printf("num_groups=%d blk=%d\n", num_groups, blk); */ } while (1); } else diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index db4b48400..d0c221361 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define isatty __isatty + #include "_stdio.h" /* This is pretty much straight from uClibc, but with one important @@ -173,7 +175,7 @@ int _stdio_openlist_delflag = 0; int _stdio_user_locking = 2; #ifndef __USE_STDIO_FUTEXES__ -void __stdio_init_mutex(pthread_mutex_t *m) +void attribute_hidden __stdio_init_mutex(pthread_mutex_t *m) { static const pthread_mutex_t __stdio_mutex_initializer = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h index 858f2716b..4d45a5448 100644 --- a/libc/stdio/_stdio.h +++ b/libc/stdio/_stdio.h @@ -19,8 +19,35 @@ #include <string.h> #include <unistd.h> +extern int __vfprintf (FILE *__restrict __s, __const char *__restrict __format, + __gnuc_va_list __arg) attribute_hidden; + +extern int __vsnprintf (char *__restrict __s, size_t __maxlen, + __const char *__restrict __format, __gnuc_va_list __arg) + __THROW __attribute__ ((__format__ (__printf__, 3, 0))) attribute_hidden; + +extern int __vfscanf (FILE *__restrict __s, __const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) attribute_hidden; + +extern int __vsscanf (__const char *__restrict __s, + __const char *__restrict __format, __gnuc_va_list __arg) + __THROW __attribute__ ((__format__ (__scanf__, 2, 0))) attribute_hidden; + #ifdef __UCLIBC_HAS_WCHAR__ #include <wchar.h> + +extern int __vfwprintf (__FILE *__restrict __s, + __const wchar_t *__restrict __format, + __gnuc_va_list __arg) attribute_hidden; + +extern int __vfwscanf (__FILE *__restrict __s, + __const wchar_t *__restrict __format, + __gnuc_va_list __arg) attribute_hidden; + +extern int __vswscanf (__const wchar_t *__restrict __s, + __const wchar_t *__restrict __format, + __gnuc_va_list __arg) __THROW attribute_hidden; #endif #ifdef __UCLIBC_HAS_THREADS__ diff --git a/libc/stdio/asprintf.c b/libc/stdio/asprintf.c index 36ed807a4..207b35a3c 100644 --- a/libc/stdio/asprintf.c +++ b/libc/stdio/asprintf.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define vasprintf __vasprintf + #include "_stdio.h" #include <stdarg.h> @@ -12,7 +14,7 @@ #warning Skipping asprintf and __asprintf since no vsnprintf! #else -int __asprintf(char **__restrict buf, const char * __restrict format, ...) +int attribute_hidden __asprintf(char **__restrict buf, const char * __restrict format, ...) { va_list arg; int rv; @@ -24,6 +26,6 @@ int __asprintf(char **__restrict buf, const char * __restrict format, ...) return rv; } -weak_alias(__asprintf,asprintf) +strong_alias(__asprintf,asprintf) #endif diff --git a/libc/stdio/dprintf.c b/libc/stdio/dprintf.c index dfdd4977d..1fc46c722 100644 --- a/libc/stdio/dprintf.c +++ b/libc/stdio/dprintf.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define vdprintf __vdprintf + #include "_stdio.h" #include <stdarg.h> diff --git a/libc/stdio/fclose.c b/libc/stdio/fclose.c index 4df2e4229..4f5e479fe 100644 --- a/libc/stdio/fclose.c +++ b/libc/stdio/fclose.c @@ -7,7 +7,8 @@ #include "_stdio.h" -int fclose(register FILE *stream) +#undef fclose +int attribute_hidden __fclose(register FILE *stream) { int rv = 0; __STDIO_AUTO_THREADLOCK_VAR; @@ -84,3 +85,4 @@ int fclose(register FILE *stream) return rv; } +strong_alias(__fclose,fclose) diff --git a/libc/stdio/fdopen.c b/libc/stdio/fdopen.c index fa08c976d..9b08b4b71 100644 --- a/libc/stdio/fdopen.c +++ b/libc/stdio/fdopen.c @@ -7,7 +7,7 @@ #include "_stdio.h" -FILE *fdopen(int filedes, const char *mode) +FILE attribute_hidden *__fdopen(int filedes, const char *mode) { intptr_t cur_mode; @@ -15,3 +15,4 @@ FILE *fdopen(int filedes, const char *mode) ? _stdio_fopen(cur_mode, mode, NULL, filedes) : NULL; } +strong_alias(__fdopen,fdopen) diff --git a/libc/stdio/fileno.c b/libc/stdio/fileno.c index 4ea21d748..526a4eb9f 100644 --- a/libc/stdio/fileno.c +++ b/libc/stdio/fileno.c @@ -23,12 +23,13 @@ int attribute_hidden __fileno_unlocked(register FILE *stream) weak_alias(__fileno_unlocked,fileno_unlocked); #ifndef __UCLIBC_HAS_THREADS__ +hidden_weak_alias(__fileno_unlocked,__fileno); weak_alias(__fileno_unlocked,fileno); #endif #elif defined __UCLIBC_HAS_THREADS__ -int fileno(register FILE *stream) +int attribute_hidden __fileno(register FILE *stream) { int retval; __STDIO_AUTO_THREADLOCK_VAR; @@ -41,5 +42,5 @@ int fileno(register FILE *stream) return retval; } - +strong_alias(__fileno,fileno) #endif diff --git a/libc/stdio/fmemopen.c b/libc/stdio/fmemopen.c index 7febe1a6e..fc7870258 100644 --- a/libc/stdio/fmemopen.c +++ b/libc/stdio/fmemopen.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define fopencookie __fopencookie + #include "_stdio.h" #ifndef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ diff --git a/libc/stdio/fopencookie.c b/libc/stdio/fopencookie.c index 73a5a028a..a70e17b80 100644 --- a/libc/stdio/fopencookie.c +++ b/libc/stdio/fopencookie.c @@ -28,7 +28,7 @@ /* Currently no real reentrancy issues other than a possible double close(). */ #ifndef __BCC__ -FILE *fopencookie(void * __restrict cookie, const char * __restrict mode, +FILE attribute_hidden *__fopencookie(void * __restrict cookie, const char * __restrict mode, cookie_io_functions_t io_functions) #else FILE *_fopencookie(void * __restrict cookie, const char * __restrict mode, @@ -57,3 +57,6 @@ FILE *_fopencookie(void * __restrict cookie, const char * __restrict mode, return stream; } +#ifndef __BCC__ +strong_alias(__fopencookie,fopencookie) +#endif diff --git a/libc/stdio/fprintf.c b/libc/stdio/fprintf.c index 388eb0c3b..ee19c85a5 100644 --- a/libc/stdio/fprintf.c +++ b/libc/stdio/fprintf.c @@ -8,14 +8,16 @@ #include "_stdio.h" #include <stdarg.h> -int fprintf(FILE * __restrict stream, const char * __restrict format, ...) +#undef fprintf +int attribute_hidden __fprintf(FILE * __restrict stream, const char * __restrict format, ...) { va_list arg; int rv; va_start(arg, format); - rv = vfprintf(stream, format, arg); + rv = __vfprintf(stream, format, arg); va_end(arg); return rv; } +strong_alias(__fprintf,fprintf) diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c index 42a29b067..0defb36a0 100644 --- a/libc/stdio/fread.c +++ b/libc/stdio/fread.c @@ -83,14 +83,15 @@ size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, siz return 0; } -weak_alias(__fread_unlocked,fread_unlocked); +weak_alias(__fread_unlocked,fread_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__fread_unlocked,fread); +hidden_strong_alias(__fread_unlocked,__fread) +weak_alias(__fread_unlocked,fread) #endif #elif defined __UCLIBC_HAS_THREADS__ -size_t fread(void * __restrict ptr, size_t size, size_t nmemb, +size_t attribute_hidden __fread(void * __restrict ptr, size_t size, size_t nmemb, register FILE * __restrict stream) { size_t retval; @@ -104,5 +105,6 @@ size_t fread(void * __restrict ptr, size_t size, size_t nmemb, return retval; } +strong_alias(__fread,fread) #endif diff --git a/libc/stdio/fwprintf.c b/libc/stdio/fwprintf.c index fa5a6bdf6..c81d40482 100644 --- a/libc/stdio/fwprintf.c +++ b/libc/stdio/fwprintf.c @@ -15,7 +15,7 @@ int fwprintf(FILE * __restrict stream, const wchar_t * __restrict format, ...) int rv; va_start(arg, format); - rv = vfwprintf(stream, format, arg); + rv = __vfwprintf(stream, format, arg); va_end(arg); return rv; diff --git a/libc/stdio/fwrite.c b/libc/stdio/fwrite.c index 50af8f7a5..abe24fbb7 100644 --- a/libc/stdio/fwrite.c +++ b/libc/stdio/fwrite.c @@ -34,14 +34,15 @@ size_t attribute_hidden __fwrite_unlocked(const void * __restrict ptr, size_t si return 0; } -weak_alias(__fwrite_unlocked,fwrite_unlocked); +weak_alias(__fwrite_unlocked,fwrite_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__fwrite_unlocked,fwrite); +hidden_strong_alias(__fwrite_unlocked,__fwrite) +weak_alias(__fwrite_unlocked,fwrite) #endif #elif defined __UCLIBC_HAS_THREADS__ -size_t fwrite(const void * __restrict ptr, size_t size, +size_t attribute_hidden __fwrite(const void * __restrict ptr, size_t size, size_t nmemb, register FILE * __restrict stream) { size_t retval; @@ -55,5 +56,6 @@ size_t fwrite(const void * __restrict ptr, size_t size, return retval; } +strong_alias(__fwrite,fwrite) #endif diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c index aafc4a1ed..8b54ca849 100644 --- a/libc/stdio/old_vfprintf.c +++ b/libc/stdio/old_vfprintf.c @@ -341,7 +341,7 @@ static const char u_spec[] = "%nbopxXudics"; /* u_radix[i] <-> u_spec[i+2] for unsigned entries only */ static const char u_radix[] = "\x02\x08\x10\x10\x10\x0a"; -int vfprintf(FILE * __restrict op, register const char * __restrict fmt, +int attribute_hidden __vfprintf(FILE * __restrict op, register const char * __restrict fmt, va_list ap) { union { @@ -450,7 +450,7 @@ int vfprintf(FILE * __restrict op, register const char * __restrict fmt, if (*fmt == 'm') { flag[FLAG_PLUS] = '\0'; flag[FLAG_0_PAD] = ' '; - p = __glibc_strerror_r(errno, tmp, sizeof(tmp)); + p = __glibc_strerror_r_internal(errno, tmp, sizeof(tmp)); goto print; } #endif @@ -711,3 +711,4 @@ int vfprintf(FILE * __restrict op, register const char * __restrict fmt, return i; } +strong_alias(__vfprintf,vfprintf) diff --git a/libc/stdio/open_memstream.c b/libc/stdio/open_memstream.c index 5799005d9..f750cd11c 100644 --- a/libc/stdio/open_memstream.c +++ b/libc/stdio/open_memstream.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define fopencookie __fopencookie + #include "_stdio.h" #ifndef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ diff --git a/libc/stdio/perror.c b/libc/stdio/perror.c index d69ccd5c3..9edcf4efb 100644 --- a/libc/stdio/perror.c +++ b/libc/stdio/perror.c @@ -30,7 +30,7 @@ void attribute_hidden __perror(register const char *s) { char buf[64]; fprintf(stderr, "%s%s%s\n", s, sep, - __glibc_strerror_r(errno, buf, sizeof(buf))); + __glibc_strerror_r_internal(errno, buf, sizeof(buf))); } #endif } diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c index 00c2d7bb1..c3ee09381 100644 --- a/libc/stdio/popen.c +++ b/libc/stdio/popen.c @@ -17,6 +17,8 @@ #define waitpid __waitpid #define execl __execl #define dup2 __dup2 +#define fdopen __fdopen +#define pipe __pipe #include <stdio.h> #include <stdlib.h> diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c index 67db4b384..82326a9c3 100644 --- a/libc/stdio/printf.c +++ b/libc/stdio/printf.c @@ -8,14 +8,15 @@ #include "_stdio.h" #include <stdarg.h> -int printf(const char * __restrict format, ...) +int attribute_hidden __printf(const char * __restrict format, ...) { va_list arg; int rv; va_start(arg, format); - rv = vfprintf(stdout, format, arg); + rv = __vfprintf(stdout, format, arg); va_end(arg); return rv; } +strong_alias(__printf,printf) diff --git a/libc/stdio/remove.c b/libc/stdio/remove.c index aaef3342b..d471ae291 100644 --- a/libc/stdio/remove.c +++ b/libc/stdio/remove.c @@ -5,6 +5,9 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define rmdir __rmdir +#define unlink __unlink + #include "_stdio.h" #include <unistd.h> diff --git a/libc/stdio/rewind.c b/libc/stdio/rewind.c index 7f36a77ff..aa4534aa7 100644 --- a/libc/stdio/rewind.c +++ b/libc/stdio/rewind.c @@ -7,7 +7,7 @@ #include "_stdio.h" -void rewind(register FILE *stream) +void attribute_hidden __rewind(register FILE *stream) { __STDIO_AUTO_THREADLOCK_VAR; @@ -18,3 +18,4 @@ void rewind(register FILE *stream) __STDIO_AUTO_THREADUNLOCK(stream); } +strong_alias(__rewind,rewind) diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index c70cae4a1..3132026bb 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -48,6 +48,7 @@ #define mbrtowc __mbrtowc #define ungetc __ungetc #define ungetwc __ungetwc +#define iswspace __iswspace #define wcrtomb __wcrtomb #define _ISOC99_SOURCE /* for LLONG_MAX primarily... */ @@ -146,17 +147,18 @@ _stdlib_strto_l(register const char * __restrict str, /**********************************************************************/ #ifdef L_fscanf -int fscanf(FILE * __restrict stream, const char * __restrict format, ...) +int attribute_hidden __fscanf(FILE * __restrict stream, const char * __restrict format, ...) { va_list arg; int rv; va_start(arg, format); - rv = vfscanf(stream, format, arg); + rv = __vfscanf(stream, format, arg); va_end(arg); return rv; } +strong_alias(__fscanf,fscanf) #endif /**********************************************************************/ @@ -168,7 +170,7 @@ int scanf(const char * __restrict format, ...) int rv; va_start(arg, format); - rv = vfscanf(stdin, format, arg); + rv = __vfscanf(stdin, format, arg); va_end(arg); return rv; @@ -180,17 +182,18 @@ int scanf(const char * __restrict format, ...) #ifdef __STDIO_HAS_VSSCANF -int sscanf(const char * __restrict str, const char * __restrict format, ...) +int attribute_hidden __sscanf(const char * __restrict str, const char * __restrict format, ...) { va_list arg; int rv; va_start(arg, format); - rv = vsscanf(str, format, arg); + rv = __vsscanf(str, format, arg); va_end(arg); return rv; } +strong_alias(__sscanf,sscanf) #else /* __STDIO_HAS_VSSCANF */ #warning Skipping sscanf since no vsscanf! @@ -200,10 +203,11 @@ int sscanf(const char * __restrict str, const char * __restrict format, ...) /**********************************************************************/ #ifdef L_vscanf -int vscanf(const char * __restrict format, va_list arg) +int attribute_hidden __vscanf(const char * __restrict format, va_list arg) { - return vfscanf(stdin, format, arg); + return __vfscanf(stdin, format, arg); } +strong_alias(__vscanf,vscanf) #endif /**********************************************************************/ @@ -215,7 +219,7 @@ int vscanf(const char * __restrict format, va_list arg) #ifdef __STDIO_BUFFERS -int vsscanf(__const char *sp, __const char *fmt, va_list ap) +int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap) { FILE f; @@ -257,12 +261,13 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) __STDIO_STREAM_ENABLE_GETC(&f); __STDIO_STREAM_DISABLE_PUTC(&f); - return vfscanf(&f, fmt, ap); + return __vfscanf(&f, fmt, ap); } +strong_alias(__vsscanf,vsscanf) #elif !defined(__UCLIBC_HAS_WCHAR__) -int vsscanf(__const char *sp, __const char *fmt, va_list ap) +int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap) { __FILE_vsscanf f; @@ -299,23 +304,25 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) #endif f.f.__nextopen = NULL; - return vfscanf(&f.f, fmt, ap); + return __vfscanf(&f.f, fmt, ap); } +strong_alias(__vsscanf,vsscanf) #elif defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__) -int vsscanf(__const char *sp, __const char *fmt, va_list ap) +int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap) { FILE *f; int rv = EOF; if ((f = fmemopen((char *)sp, __strlen(sp), "r")) != NULL) { - rv = vfscanf(f, fmt, ap); + rv = __vfscanf(f, fmt, ap); fclose(f); } return rv; } +strong_alias(__vsscanf,vsscanf) #else #warning Skipping vsscanf since no buffering, no custom streams, and wchar enabled! @@ -334,7 +341,7 @@ int fwscanf(FILE * __restrict stream, const wchar_t * __restrict format, ...) int rv; va_start(arg, format); - rv = vfwscanf(stream, format, arg); + rv = __vfwscanf(stream, format, arg); va_end(arg); return rv; @@ -350,7 +357,7 @@ int wscanf(const wchar_t * __restrict format, ...) int rv; va_start(arg, format); - rv = vfwscanf(stdin, format, arg); + rv = __vfwscanf(stdin, format, arg); va_end(arg); return rv; @@ -369,7 +376,7 @@ int swscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, int rv; va_start(arg, format); - rv = vswscanf(str, format, arg); + rv = __vswscanf(str, format, arg); va_end(arg); return rv; @@ -384,7 +391,7 @@ int swscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, int vwscanf(const wchar_t * __restrict format, va_list arg) { - return vfwscanf(stdin, format, arg); + return __vfwscanf(stdin, format, arg); } #endif @@ -393,7 +400,7 @@ int vwscanf(const wchar_t * __restrict format, va_list arg) #ifdef __STDIO_BUFFERS -int vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, +int attribute_hidden __vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, va_list arg) { FILE f; @@ -434,8 +441,9 @@ int vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, #endif f.__nextopen = NULL; - return vfwscanf(&f, format, arg); + return __vfwscanf(&f, format, arg); } +strong_alias(__vswscanf,vswscanf) #else /* __STDIO_BUFFERS */ #warning Skipping vswscanf since no buffering! #endif /* __STDIO_BUFFERS */ @@ -584,6 +592,7 @@ enum { #define Wchar wchar_t #define Wuchar __uwchar_t #define ISSPACE(C) iswspace((C)) +#define HIDDEN_VFSCANF __vfwscanf #define VFSCANF vfwscanf #define GETC(SC) (SC)->sc_getc((SC)) #else @@ -593,6 +602,7 @@ typedef unsigned char __uchar_t; #define Wchar char #define Wuchar __uchar_t #define ISSPACE(C) isspace((C)) +#define HIDDEN_VFSCANF __vfscanf #define VFSCANF vfscanf #ifdef __UCLIBC_HAS_WCHAR__ #define GETC(SC) (SC)->sc_getc((SC)) @@ -1150,7 +1160,7 @@ static const char fake_thousands_sep_str[] = ","; #endif /* L_vfwscanf */ -int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) +int attribute_hidden HIDDEN_VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) { const Wuchar *fmt; unsigned char *b; @@ -1754,6 +1764,7 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) return psfs.cnt; } +strong_alias(HIDDEN_VFSCANF,VFSCANF) #endif /**********************************************************************/ #ifdef L___psfs_do_numeric diff --git a/libc/stdio/snprintf.c b/libc/stdio/snprintf.c index a827971ba..a1ea79fc0 100644 --- a/libc/stdio/snprintf.c +++ b/libc/stdio/snprintf.c @@ -12,16 +12,17 @@ #warning Skipping snprintf since no vsnprintf! #else -int snprintf(char *__restrict buf, size_t size, +int attribute_hidden __snprintf(char *__restrict buf, size_t size, const char * __restrict format, ...) { va_list arg; int rv; va_start(arg, format); - rv = vsnprintf(buf, size, format, arg); + rv = __vsnprintf(buf, size, format, arg); va_end(arg); return rv; } +strong_alias(__snprintf,snprintf) #endif diff --git a/libc/stdio/sprintf.c b/libc/stdio/sprintf.c index eb83f424a..5778c011d 100644 --- a/libc/stdio/sprintf.c +++ b/libc/stdio/sprintf.c @@ -12,16 +12,17 @@ #warning Skipping sprintf since no vsnprintf! #else -int sprintf(char *__restrict buf, const char * __restrict format, ...) +int attribute_hidden __sprintf(char *__restrict buf, const char * __restrict format, ...) { va_list arg; int rv; va_start(arg, format); - rv = vsnprintf(buf, SIZE_MAX, format, arg); + rv = __vsnprintf(buf, SIZE_MAX, format, arg); va_end(arg); return rv; } +strong_alias(__sprintf,sprintf) #endif diff --git a/libc/stdio/swprintf.c b/libc/stdio/swprintf.c index bdb092403..b373df8bd 100644 --- a/libc/stdio/swprintf.c +++ b/libc/stdio/swprintf.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define vswprintf __vswprintf + #include "_stdio.h" #include <stdarg.h> #include <wchar.h> diff --git a/libc/stdio/tmpfile.c b/libc/stdio/tmpfile.c index 488ddd763..fa9bd5019 100644 --- a/libc/stdio/tmpfile.c +++ b/libc/stdio/tmpfile.c @@ -16,6 +16,8 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define fdopen __fdopen + #include <features.h> #include <stdio.h> #include <unistd.h> diff --git a/libc/stdio/vasprintf.c b/libc/stdio/vasprintf.c index 512317c51..ca110cbd1 100644 --- a/libc/stdio/vasprintf.c +++ b/libc/stdio/vasprintf.c @@ -20,7 +20,7 @@ #warning Skipping vasprintf since no vsnprintf! #else -int vasprintf(char **__restrict buf, const char * __restrict format, +int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict format, va_list arg) { #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ @@ -32,7 +32,7 @@ int vasprintf(char **__restrict buf, const char * __restrict format, *buf = NULL; if ((f = open_memstream(buf, &size)) != NULL) { - rv = vfprintf(f, format, arg); + rv = __vfprintf(f, format, arg); fclose(f); if (rv < 0) { free(*buf); @@ -54,14 +54,14 @@ int vasprintf(char **__restrict buf, const char * __restrict format, int rv; va_copy(arg2, arg); - rv = vsnprintf(NULL, 0, format, arg2); + rv = __vsnprintf(NULL, 0, format, arg2); va_end(arg2); *buf = NULL; if (rv >= 0) { if ((*buf = malloc(++rv)) != NULL) { - if ((rv = vsnprintf(*buf, rv, format, arg)) < 0) { + if ((rv = __vsnprintf(*buf, rv, format, arg)) < 0) { free(*buf); *buf = NULL; } @@ -74,5 +74,6 @@ int vasprintf(char **__restrict buf, const char * __restrict format, #endif /* __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ */ } +strong_alias(__vasprintf,vasprintf) #endif diff --git a/libc/stdio/vdprintf.c b/libc/stdio/vdprintf.c index 6d8c91e90..4e066f169 100644 --- a/libc/stdio/vdprintf.c +++ b/libc/stdio/vdprintf.c @@ -8,7 +8,7 @@ #include "_stdio.h" #include <stdarg.h> -int vdprintf(int filedes, const char * __restrict format, va_list arg) +int attribute_hidden __vdprintf(int filedes, const char * __restrict format, va_list arg) { FILE f; int rv; @@ -51,7 +51,7 @@ int vdprintf(int filedes, const char * __restrict format, va_list arg) #endif f.__nextopen = NULL; - rv = vfprintf(&f, format, arg); + rv = __vfprintf(&f, format, arg); #ifdef __STDIO_BUFFERS /* If not buffering, then fflush is unnecessary. */ @@ -64,3 +64,4 @@ int vdprintf(int filedes, const char * __restrict format, va_list arg) return rv; } +strong_alias(__vdprintf,vdprintf) diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c index 5275f53f7..11fe926a0 100644 --- a/libc/stdio/vfprintf.c +++ b/libc/stdio/vfprintf.c @@ -1195,6 +1195,7 @@ static size_t _charpad(FILE * __restrict stream, int padchar, size_t numpad); #ifdef L_vfprintf +#define HIDDEN_VFPRINTF __vfprintf #define VFPRINTF vfprintf #define FMT_TYPE char #define OUTNSTR _outnstr @@ -1227,6 +1228,7 @@ static size_t _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf #else /* L_vfprintf */ +#define HIDDEN_VFPRINTF __vfwprintf #define VFPRINTF vfwprintf #define FMT_TYPE wchar_t #define OUTNSTR _outnwcs @@ -1736,7 +1738,7 @@ static int _do_one_spec(FILE * __restrict stream, #ifdef __UCLIBC_HAS_PRINTF_M_SPEC__ } else if (ppfs->conv_num == CONV_m) { - s = __glibc_strerror_r(errno, buf, sizeof(buf)); + s = __glibc_strerror_r_internal(errno, buf, sizeof(buf)); goto SET_STRING_LEN; #endif } else { @@ -1844,7 +1846,7 @@ static int _do_one_spec(FILE * __restrict stream, return 0; } -int VFPRINTF (FILE * __restrict stream, +int attribute_hidden HIDDEN_VFPRINTF (FILE * __restrict stream, register const FMT_TYPE * __restrict format, va_list arg) { @@ -1921,5 +1923,6 @@ int VFPRINTF (FILE * __restrict stream, return count; } +strong_alias(HIDDEN_VFPRINTF,VFPRINTF) #endif /**********************************************************************/ diff --git a/libc/stdio/vprintf.c b/libc/stdio/vprintf.c index 45d580faa..9c0e07514 100644 --- a/libc/stdio/vprintf.c +++ b/libc/stdio/vprintf.c @@ -10,5 +10,5 @@ int vprintf(const char * __restrict format, va_list arg) { - return vfprintf(stdout, format, arg); + return __vfprintf(stdout, format, arg); } diff --git a/libc/stdio/vsnprintf.c b/libc/stdio/vsnprintf.c index b8bdbaaa1..c926b2ad7 100644 --- a/libc/stdio/vsnprintf.c +++ b/libc/stdio/vsnprintf.c @@ -14,7 +14,7 @@ #ifdef __STDIO_BUFFERS -int vsnprintf(char *__restrict buf, size_t size, +int attribute_hidden __vsnprintf(char *__restrict buf, size_t size, const char * __restrict format, va_list arg) { FILE f; @@ -61,7 +61,7 @@ int vsnprintf(char *__restrict buf, size_t size, __STDIO_STREAM_DISABLE_GETC(&f); __STDIO_STREAM_ENABLE_PUTC(&f); - rv = vfprintf(&f, format, arg); + rv = __vfprintf(&f, format, arg); if (size) { if (f.__bufpos == f.__bufend) { --f.__bufpos; @@ -70,6 +70,7 @@ int vsnprintf(char *__restrict buf, size_t size, } return rv; } +strong_alias(__vsnprintf,vsnprintf) #elif defined(__USE_OLD_VFPRINTF__) @@ -79,7 +80,7 @@ typedef struct { unsigned char *bufpos; } __FILE_vsnprintf; -int vsnprintf(char *__restrict buf, size_t size, +int attribute_hidden __vsnprintf(char *__restrict buf, size_t size, const char * __restrict format, va_list arg) { __FILE_vsnprintf f; @@ -121,7 +122,7 @@ int vsnprintf(char *__restrict buf, size_t size, #endif f.f.__nextopen = NULL; - rv = vfprintf((FILE *) &f, format, arg); + rv = __vfprintf((FILE *) &f, format, arg); if (size) { if (f.bufpos == f.bufend) { --f.bufpos; @@ -130,6 +131,7 @@ int vsnprintf(char *__restrict buf, size_t size, } return rv; } +strong_alias(__vsnprintf,vsnprintf) #elif defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__) @@ -171,7 +173,7 @@ static ssize_t snpf_write(register void *cookie, const char *buf, #undef COOKIE -int vsnprintf(char *__restrict buf, size_t size, +int attribute_hidden __vsnprintf(char *__restrict buf, size_t size, const char * __restrict format, va_list arg) { FILE f; @@ -209,10 +211,11 @@ int vsnprintf(char *__restrict buf, size_t size, #endif f.__nextopen = NULL; - rv = vfprintf(&f, format, arg); + rv = __vfprintf(&f, format, arg); return rv; } +strong_alias(__vsnprintf,vsnprintf) #else #warning Skipping vsnprintf since no buffering, no custom streams, and not old vfprintf! diff --git a/libc/stdio/vsprintf.c b/libc/stdio/vsprintf.c index 81d3961ad..a7d5e08f5 100644 --- a/libc/stdio/vsprintf.c +++ b/libc/stdio/vsprintf.c @@ -15,7 +15,7 @@ int vsprintf(char *__restrict buf, const char * __restrict format, va_list arg) { - return vsnprintf(buf, SIZE_MAX, format, arg); + return __vsnprintf(buf, SIZE_MAX, format, arg); } #endif diff --git a/libc/stdio/vswprintf.c b/libc/stdio/vswprintf.c index aab847dfd..d23ba123f 100644 --- a/libc/stdio/vswprintf.c +++ b/libc/stdio/vswprintf.c @@ -13,7 +13,7 @@ #warning Skipping vswprintf since no buffering! #else /* __STDIO_BUFFERS */ -int vswprintf(wchar_t *__restrict buf, size_t size, +int attribute_hidden __vswprintf(wchar_t *__restrict buf, size_t size, const wchar_t * __restrict format, va_list arg) { FILE f; @@ -38,12 +38,8 @@ int vswprintf(wchar_t *__restrict buf, size_t size, #ifdef __UCLIBC_HAS_THREADS__ f.__user_locking = 1; /* Set user locking. */ -#ifdef __USE_STDIO_FUTEXES__ - _IO_lock_init (f._lock); -#else __stdio_init_mutex(&f.__lock); #endif -#endif f.__nextopen = NULL; if (size > ((SIZE_MAX - (size_t) buf)/sizeof(wchar_t))) { @@ -56,7 +52,7 @@ int vswprintf(wchar_t *__restrict buf, size_t size, __STDIO_STREAM_DISABLE_GETC(&f); __STDIO_STREAM_DISABLE_PUTC(&f); - rv = vfwprintf(&f, format, arg); + rv = __vfwprintf(&f, format, arg); /* NOTE: Return behaviour differs from snprintf... */ if (f.__bufpos == f.__bufend) { @@ -70,5 +66,6 @@ int vswprintf(wchar_t *__restrict buf, size_t size, } return rv; } +strong_alias(__vswprintf,vswprintf) #endif /* __STDIO_BUFFERS */ diff --git a/libc/stdio/vwprintf.c b/libc/stdio/vwprintf.c index 2ad6bbdfd..8c3401846 100644 --- a/libc/stdio/vwprintf.c +++ b/libc/stdio/vwprintf.c @@ -11,5 +11,5 @@ int vwprintf(const wchar_t * __restrict format, va_list arg) { - return vfwprintf(stdout, format, arg); + return __vfwprintf(stdout, format, arg); } diff --git a/libc/stdio/wprintf.c b/libc/stdio/wprintf.c index c64fc086a..00f5ef514 100644 --- a/libc/stdio/wprintf.c +++ b/libc/stdio/wprintf.c @@ -15,7 +15,7 @@ int wprintf(const wchar_t * __restrict format, ...) int rv; va_start(arg, format); - rv = vfwprintf(stdout, format, arg); + rv = __vfwprintf(stdout, format, arg); va_end(arg); return rv; |