diff options
Diffstat (limited to 'libc/stdio')
46 files changed, 192 insertions, 310 deletions
diff --git a/libc/stdio/Makefile b/libc/stdio/Makefile index cde1d17b3..11f362a5e 100644 --- a/libc/stdio/Makefile +++ b/libc/stdio/Makefile @@ -1,161 +1,13 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> -# Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org> +# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> # -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. - -TOPDIR=../../ -include $(TOPDIR)Rules.mak - -# Note: The *64.o objects are empty when compiled without large file support. - -# SUSv3 functions -CSRC = fclose.c fcloseall.c fdopen.c fgetpos.c fopen.c freopen.c \ - fseeko.c fsetpos.c ftello.c getdelim.c getline.c gets.c getw.c \ - perror.c puts.c putw.c remove.c rewind.c setbuf.c setbuffer.c \ - setlinebuf.c setvbuf.c ungetc.c \ - printf.c vprintf.c vsprintf.c fprintf.c snprintf.c dprintf.c \ - asprintf.c sprintf.c vasprintf.c vdprintf.c vsnprintf.c \ - tmpfile.c tmpnam.c tmpnam_r.c popen.c tempnam.c ctermid.c - -# getc -> alias for fgetc -# putc -> alias for fputc -# rename is a syscall - -# Implementation support functions -CSRC += _READ.c _WRITE.c _adjust_pos.c _fopen.c _fwrite.c \ - _rfill.c _stdio.c _trans2r.c _trans2w.c _wcommit.c \ - _cs_funcs.c _load_inttype.c _store_inttype.c _uintmaxtostr.c -ifeq ($(strip $(UCLIBC_HAS_FLOATS)),y) -CSRC += _fpmaxtostr.c -endif - -# stdio_ext.h functions -CSRC += __fbufsize.c __flbf.c __fpending.c __fpurge.c __freadable.c \ - __freading.c __fsetlocking.c __fwritable.c __fwriting.c _flushlbf.c - -# Other glibc extensions -ifeq ($(strip $(UCLIBC_HAS_GLIBC_CUSTOM_STREAMS)),y) -CSRC += fopencookie.c fmemopen.c open_memstream.c -endif - -# pthread functions -CSRC += flockfile.c ftrylockfile.c funlockfile.c - -# Functions with unlocked versions -CUSRC = clearerr.c feof.c ferror.c fflush.c fgetc.c fgets.c fileno.c \ - fputc.c fputs.c fread.c fwrite.c getchar.c putchar.c -# getc_unlocked -> alias for fgetc_unlocked -# putc_unlocked -> alias for fputc_unlocked - -# Largefile functions -CLOBJS = fgetpos64.o fopen64.o freopen64.o fseeko64.o fsetpos64.o ftello64.o -# tmpfile64.o - -# vfprintf and support functions -MSRC2= vfprintf.c -ifneq ($(USE_OLD_VFPRINTF),y) -MOBJ2= vfprintf.o \ - _ppfs_init.o _ppfs_prepargs.o _ppfs_setargs.o _ppfs_parsespec.o \ - register_printf_function.o parse_printf_format.o -else -MOBJ2= -CSRC += old_vfprintf.c -endif - -# vfscanf and support functions plus other *scanf funcs -MSRC3= scanf.c -MOBJ3= vfscanf.o __scan_cookie.o __psfs_parse_spec.o __psfs_do_numeric.o \ - scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o - -MWSRC= wstdio.c -MWOBJ= - -CWSRC = -ifeq ($(UCLIBC_HAS_WCHAR),y) -CWSRC += _wfwrite.c fwprintf.c swprintf.c vswprintf.c vwprintf.c wprintf.c \ - fwide.c ungetwc.c -CUSRC += fgetwc.c getwchar.c fgetws.c fputwc.c putwchar.c fputws.c -# getwc (fgetwc alias) getwc_unlocked (fgetwc_unlocked alias) -# putwc (fputwc alias) putwc_unlocked (fputwc_unlocked alias) -MOBJ2 += vfwprintf.o -MOBJ3 += wscanf.o swscanf.o fwscanf.o vwscanf.o vswscanf.o vfwscanf.o -endif - -CSRC += $(CUSRC) - -COBJS = $(patsubst %.c,%.o, $(CSRC)) -CUOBJS = $(patsubst %.c,%_unlocked.o, $(CUSRC)) -CWOBJS = $(patsubst %.c,%.o, $(CWSRC)) - -ifeq ($(strip $(UCLIBC_HAS_WCHAR)),y) -COBJS += $(CWOBJS) -endif - -OBJS = $(COBJS) $(CUOBJS) $(MOBJ2) $(MOBJ3) $(MWOBJ) - -ifeq ($(strip $(UCLIBC_HAS_LFS)),y) -OBJS += $(CLOBJS) -endif - -ifeq ($(UCLIBC_HAS_THREADS),y) -CFLAGS += $(PTINC) -endif - -ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y) -CFLAGS += -D__USE_STDIO_FUTEXES__ -endif - -OBJ_LIST=../obj.stdio - -all: $(OBJ_LIST) - -$(OBJ_LIST): $(OBJS) - echo $(patsubst %, stdio/%, $(OBJS)) > $(OBJ_LIST) - -$(COBJS): %.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - $(STRIPTOOL) -x -R .note -R .comment $@ - -%_unlocked.o : %.c - $(CC) $(CFLAGS) -D__DO_UNLOCKED -c $< -o $@ - $(STRIPTOOL) -x -R .note -R .comment $@ - -%64.o : %.c - $(CC) $(CFLAGS) -D__DO_LARGEFILE -c $< -o $@ - $(STRIPTOOL) -x -R .note -R .comment $@ - -$(MOBJ2): $(MSRC2) - $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o - $(STRIPTOOL) -x -R .note -R .comment $*.o - -$(MOBJ3): $(MSRC3) - $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o - $(STRIPTOOL) -x -R .note -R .comment $*.o - -$(MWOBJ): $(MWSRC) - $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o - $(STRIPTOOL) -x -R .note -R .comment $*.o - -$(OBJ): Makefile -clean: - $(RM) *.[oa] *~ core +top_srcdir=../../ +top_builddir=../../ +all: objs +include $(top_builddir)Rules.mak +include Makefile.in +include $(top_srcdir)Makerules diff --git a/libc/stdio/Makefile.in b/libc/stdio/Makefile.in index dfdf4ff14..3a6f739b4 100644 --- a/libc/stdio/Makefile.in +++ b/libc/stdio/Makefile.in @@ -17,8 +17,9 @@ CSRC := \ asprintf.c sprintf.c vasprintf.c vdprintf.c vsnprintf.c \ tmpfile.c tmpnam.c tmpnam_r.c popen.c tempnam.c ctermid.c -# Note: The *64.o objects are empty when compiled without large file support +ifeq ($(UCLIBC_HAS_LFS),y) CSRC += fgetpos64.c fopen64.c freopen64.c fseeko64.c fsetpos64.c ftello64.c +endif # getc -> alias for fgetc # putc -> alias for fputc @@ -110,9 +111,9 @@ STDIO_MOBJ := $(STDIO_MOBJ1) $(STDIO_MOBJ2) STDIO_DEF := $(patsubst %,-DL_%,$(subst .o,,$(filter-out $(STDIO_MOBJ_NO_MULTI),$(notdir $(STDIO_MOBJ))))) -STDIO_OBJS := $(STDIO_OBJ) $(STDIO_MOBJ) $(STDIO_CUOBJ) $(STDIO_CLOBJ) +STDIO_OBJS := $(STDIO_OBJ) $(STDIO_MOBJ) $(STDIO_CUOBJ) -STDIO_NO_MULTI := $(STDIO_CUOBJ) $(STDIO_CLOBJ) +STDIO_NO_MULTI := $(STDIO_CUOBJ) # these need special handling or rewrite to support multi-build # CUOBJ diff --git a/libc/stdio/__fsetlocking.c b/libc/stdio/__fsetlocking.c index f49503207..77690e269 100644 --- a/libc/stdio/__fsetlocking.c +++ b/libc/stdio/__fsetlocking.c @@ -15,7 +15,7 @@ * glibc treats invalid locking_mode args as FSETLOCKING_INTERNAL. */ -int __fsetlocking(FILE *stream, int locking_mode) +int attribute_hidden __libc_fsetlocking(FILE *stream, int locking_mode) { #ifdef __UCLIBC_HAS_THREADS__ int current = 1 + (stream->__user_locking & 1); @@ -43,3 +43,5 @@ int __fsetlocking(FILE *stream, int locking_mode) return FSETLOCKING_INTERNAL; #endif } + +strong_alias(__libc_fsetlocking,__fsetlocking) diff --git a/libc/stdio/_cs_funcs.c b/libc/stdio/_cs_funcs.c index 9df93f227..3bec64c19 100644 --- a/libc/stdio/_cs_funcs.c +++ b/libc/stdio/_cs_funcs.c @@ -13,14 +13,14 @@ ssize_t attribute_hidden _cs_read(void *cookie, char *buf, size_t bufsize) { - return read(*((int *) cookie), buf, bufsize); + return __read(*((int *) cookie), buf, bufsize); } /**********************************************************************/ ssize_t attribute_hidden _cs_write(void *cookie, const char *buf, size_t bufsize) { - return write(*((int *) cookie), (char *) buf, bufsize); + return __write(*((int *) cookie), (char *) buf, bufsize); } /**********************************************************************/ @@ -42,7 +42,7 @@ int attribute_hidden _cs_seek(void *cookie, register __offmax_t *pos, int whence int attribute_hidden _cs_close(void *cookie) { - return close(*((int *) cookie)); + return __close(*((int *) cookie)); } /**********************************************************************/ diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c index 508c36d1c..f4df3f2de 100644 --- a/libc/stdio/_fopen.c +++ b/libc/stdio/_fopen.c @@ -132,7 +132,7 @@ FILE attribute_hidden *_stdio_fopen(intptr_t fname_or_mode, & O_LARGEFILE) ); } else { __STDIO_WHEN_LFS( if (filedes < -1) open_mode |= O_LARGEFILE ); - if ((stream->__filedes = open(((const char *) fname_or_mode), + if ((stream->__filedes = __open(((const char *) fname_or_mode), open_mode, 0666)) < 0) { goto FREE_STREAM; } diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c index 9ffa5493e..2024caca1 100644 --- a/libc/stdio/_fpmaxtostr.c +++ b/libc/stdio/_fpmaxtostr.c @@ -417,7 +417,7 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info if (mode == 'f') { round += exp; if (round < -1) { - memset(buf, '0', DECIMAL_DIG); /* OK, since 'f' -> decimal case. */ + __memset(buf, '0', DECIMAL_DIG); /* OK, since 'f' -> decimal case. */ exp = -1; round = -1; } diff --git a/libc/stdio/_fwrite.c b/libc/stdio/_fwrite.c index d9d0bc2a8..600b15e6d 100644 --- a/libc/stdio/_fwrite.c +++ b/libc/stdio/_fwrite.c @@ -5,6 +5,9 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define memrchr __memrchr +#define memchr __memchr + #include "_stdio.h" #ifdef __STDIO_BUFFERS @@ -32,7 +35,7 @@ size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer, if (pending > bytes) { pending = bytes; } - memcpy(stream->__bufpos, buffer, pending); + __memcpy(stream->__bufpos, buffer, pending); stream->__bufpos += pending; __STDIO_STREAM_VALIDATE(stream); return bytes; @@ -40,7 +43,7 @@ size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer, /* RETRY: */ if (bytes <= __STDIO_STREAM_BUFFER_WAVAIL(stream)) { - memcpy(stream->__bufpos, buffer, bytes); + __memcpy(stream->__bufpos, buffer, bytes); stream->__bufpos += bytes; if (__STDIO_STREAM_IS_LBF(stream) && memrchr(buffer, '\n', bytes) /* Search backwards. */ diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index b21beb728..db4b48400 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -178,7 +178,7 @@ void __stdio_init_mutex(pthread_mutex_t *m) static const pthread_mutex_t __stdio_mutex_initializer = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; - memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer)); + __memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer)); } #endif diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h index e900edac6..fdab8b8dc 100644 --- a/libc/stdio/_stdio.h +++ b/libc/stdio/_stdio.h @@ -7,6 +7,7 @@ #define _GNU_SOURCE +#include <features.h> #include <assert.h> #include <errno.h> #include <fcntl.h> @@ -17,7 +18,6 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <features.h> #ifdef __UCLIBC_HAS_WCHAR__ #include <wchar.h> @@ -360,20 +360,20 @@ extern int __stdio_trans2w_o(FILE *__restrict stream, int oflag) attribute_hidde #endif /* __STDIO_BUFFERS */ /**********************************************************************/ -extern int __fputs_unlocked(const char *__restrict s, FILE *__restrict stream); +extern int __fputs_unlocked(const char *__restrict s, FILE *__restrict stream) attribute_hidden; extern int __putchar_unlocked(int c); extern size_t __fwrite_unlocked(const void *__restrict ptr, size_t size, - size_t nmemb, FILE *__restrict stream); + size_t nmemb, FILE *__restrict stream) attribute_hidden; extern size_t __fread_unlocked(void *__restrict ptr, size_t size, - size_t nmemb, FILE *__restrict stream); + size_t nmemb, FILE *__restrict stream) attribute_hidden; -extern int __fputc_unlocked(int c, FILE *stream); +extern int __libc_fputc_unlocked(int c, FILE *stream) attribute_hidden; -extern int __fflush_unlocked(FILE *stream); +extern int __fflush_unlocked(FILE *stream) attribute_hidden; extern int __stdio_adjust_position(FILE *__restrict stream, __offmax_t *pos) attribute_hidden; @@ -381,17 +381,19 @@ extern void __clearerr_unlocked(FILE *stream); extern int __feof_unlocked(FILE *stream); extern int __ferror_unlocked(FILE *stream); -extern int __fgetc_unlocked(FILE *stream); +extern int __libc_fgetc_unlocked(FILE *stream) attribute_hidden; extern char *__fgets_unlocked(char *__restrict s, int n, - FILE * __restrict stream); + FILE * __restrict stream) attribute_hidden; -extern int __fileno_unlocked(FILE *stream); +extern int __fileno_unlocked(FILE *stream) attribute_hidden; -extern int __getchar_unlocked(void); +extern int __getchar_unlocked(void) attribute_hidden; +extern int __fseek(FILE *stream, long int offset, int whence) attribute_hidden; +extern long int __ftell(FILE *stream) attribute_hidden; #ifdef __UCLIBC_HAS_LFS__ -extern int __fseeko64(FILE *stream, __off64_t offset, int whence); -extern __off64_t __ftello64(FILE *stream); +extern int __fseeko64(FILE *stream, __off64_t offset, int whence) attribute_hidden; +extern __off64_t __ftello64(FILE *stream) attribute_hidden; #endif #ifdef __STDIO_HAS_OPENLIST @@ -433,10 +435,10 @@ extern FILE *_stdio_fopen(intptr_t fname_or_mode, #ifdef __UCLIBC_HAS_WCHAR__ extern size_t _wstdio_fwrite(const wchar_t *__restrict ws, size_t n, - FILE *__restrict stream); + FILE *__restrict stream) attribute_hidden; -extern wint_t __fgetwc_unlocked(register FILE *stream); -extern wint_t __fputwc_unlocked(wchar_t wc, FILE *stream); +extern wint_t __fgetwc_unlocked(register FILE *stream) attribute_hidden; +extern wint_t __fputwc_unlocked(wchar_t wc, FILE *stream) attribute_hidden; #endif /**********************************************************************/ diff --git a/libc/stdio/_uintmaxtostr.c b/libc/stdio/_uintmaxtostr.c index 858a39118..847d23560 100644 --- a/libc/stdio/_uintmaxtostr.c +++ b/libc/stdio/_uintmaxtostr.c @@ -17,7 +17,7 @@ #define INTERNAL_DIV_MOD #endif -char *_uintmaxtostr(register char * __restrict bufend, uintmax_t uval, +char attribute_hidden *__libc__uintmaxtostr(register char * __restrict bufend, uintmax_t uval, int base, __UIM_CASE alphacase) { int negative; @@ -61,7 +61,7 @@ char *_uintmaxtostr(register char * __restrict bufend, uintmax_t uval, #ifndef __LOCALE_C_ONLY if (!grouping) { /* Finished a group. */ bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len; - memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, + __memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, __UCLIBC_CURLOCALE_DATA.thousands_sep_len); if (g[1] != 0) { /* g[1] == 0 means repeat last grouping. */ /* Note: g[1] == -1 means no further grouping. But since @@ -79,7 +79,7 @@ char *_uintmaxtostr(register char * __restrict bufend, uintmax_t uval, #ifndef __LOCALE_C_ONLY if (unlikely(outdigit)) { bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]; - memcpy(bufend, + __memcpy(bufend, (&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit], __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]); } else @@ -104,7 +104,7 @@ char *_uintmaxtostr(register char * __restrict bufend, uintmax_t uval, #ifndef __LOCALE_C_ONLY if (!grouping) { /* Finished a group. */ bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len; - memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, + __memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, __UCLIBC_CURLOCALE_DATA.thousands_sep_len); if (g[1] != 0) { /* g[1] == 0 means repeat last grouping. */ /* Note: g[1] == -1 means no further grouping. But since @@ -131,7 +131,7 @@ char *_uintmaxtostr(register char * __restrict bufend, uintmax_t uval, #ifndef __LOCALE_C_ONLY if (unlikely(outdigit)) { bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]; - memcpy(bufend, + __memcpy(bufend, (&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit], __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]); } else @@ -149,3 +149,4 @@ char *_uintmaxtostr(register char * __restrict bufend, uintmax_t uval, return bufend; } +strong_alias(__libc__uintmaxtostr,_uintmaxtostr) diff --git a/libc/stdio/_wfwrite.c b/libc/stdio/_wfwrite.c index 8f9469162..792cff604 100644 --- a/libc/stdio/_wfwrite.c +++ b/libc/stdio/_wfwrite.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define wmemcpy __wmemcpy + #include "_stdio.h" #include <wchar.h> @@ -16,10 +18,10 @@ #warning TODO: Fix prototype. #endif extern size_t __wcsnrtombs(char *__restrict dst, - const wchar_t **__restrict src, - size_t NWC, size_t len, mbstate_t *__restrict ps); + const wchar_t **__restrict src, + size_t NWC, size_t len, mbstate_t *__restrict ps) attribute_hidden; -size_t _wstdio_fwrite(const wchar_t *__restrict ws, size_t n, +size_t attribute_hidden _wstdio_fwrite(const wchar_t *__restrict ws, size_t n, register FILE *__restrict stream) { size_t r, count; diff --git a/libc/stdio/ctermid.c b/libc/stdio/ctermid.c index 118608780..11e43f336 100644 --- a/libc/stdio/ctermid.c +++ b/libc/stdio/ctermid.c @@ -21,6 +21,6 @@ char *ctermid(register char *s) return s; #else /* glibc always returns /dev/tty for linux. */ - return strcpy((s ? s : sbuf), "/dev/tty"); + return __strcpy((s ? s : sbuf), "/dev/tty"); #endif } diff --git a/libc/stdio/fflush.c b/libc/stdio/fflush.c index fa50db15a..b4226d0f1 100644 --- a/libc/stdio/fflush.c +++ b/libc/stdio/fflush.c @@ -31,7 +31,7 @@ #endif -int __fflush_unlocked(register FILE *stream) +int attribute_hidden __fflush_unlocked(register FILE *stream) { #ifdef __STDIO_BUFFERS diff --git a/libc/stdio/fgetc.c b/libc/stdio/fgetc.c index c68c1fdb5..78fca8422 100644 --- a/libc/stdio/fgetc.c +++ b/libc/stdio/fgetc.c @@ -14,7 +14,7 @@ #ifdef __DO_UNLOCKED -int __fgetc_unlocked(FILE *stream) +int attribute_hidden __libc_fgetc_unlocked(FILE *stream) { __STDIO_STREAM_VALIDATE(stream); @@ -69,11 +69,12 @@ int __fgetc_unlocked(FILE *stream) return EOF; } -weak_alias(__fgetc_unlocked,fgetc_unlocked); -weak_alias(__fgetc_unlocked,getc_unlocked); +strong_alias(__libc_fgetc_unlocked,__fgetc_unlocked) +weak_alias(__fgetc_unlocked,fgetc_unlocked) +weak_alias(__fgetc_unlocked,getc_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__fgetc_unlocked,fgetc); -weak_alias(__fgetc_unlocked,getc); +weak_alias(__fgetc_unlocked,fgetc) +weak_alias(__fgetc_unlocked,getc) #endif #elif defined __UCLIBC_HAS_THREADS__ diff --git a/libc/stdio/fgetpos.c b/libc/stdio/fgetpos.c index 84cf0b98c..03c18ab93 100644 --- a/libc/stdio/fgetpos.c +++ b/libc/stdio/fgetpos.c @@ -7,6 +7,10 @@ #include "_stdio.h" +#ifndef __DO_LARGEFILE +#define FTELL __ftell +#endif + int fgetpos(FILE * __restrict stream, register fpos_t * __restrict pos) { #ifdef __STDIO_MBSTATE @@ -16,7 +20,7 @@ int fgetpos(FILE * __restrict stream, register fpos_t * __restrict pos) __STDIO_AUTO_THREADLOCK(stream); - if ((pos->__pos = ftell(stream)) >= 0) { + if ((pos->__pos = FTELL(stream)) >= 0) { __COPY_MBSTATE(&(pos->__mbstate), &(stream->__state)); pos->__mblen_pending = stream->__ungot_width[0]; retval = 0; @@ -28,7 +32,7 @@ int fgetpos(FILE * __restrict stream, register fpos_t * __restrict pos) #else - return ((pos->__pos = ftell(stream)) >= 0) ? 0 : -1; + return ((pos->__pos = FTELL(stream)) >= 0) ? 0 : -1; #endif } diff --git a/libc/stdio/fgetpos64.c b/libc/stdio/fgetpos64.c index d222a1a98..6f46746b1 100644 --- a/libc/stdio/fgetpos64.c +++ b/libc/stdio/fgetpos64.c @@ -1,16 +1,14 @@ /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. * * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ #include "_stdio.h" -#ifdef __UCLIBC_HAS_LFS__ -# define __DO_LARGEFILE -# define fgetpos fgetpos64 -# define fpos_t fpos64_t -# define ftell ftello64 -# include "fgetpos.c" -#endif +#define __DO_LARGEFILE +#define fgetpos fgetpos64 +#define fpos_t fpos64_t +#define FTELL __ftello64 +#include "fgetpos.c" diff --git a/libc/stdio/fgets.c b/libc/stdio/fgets.c index 4b32ad612..743a2ea54 100644 --- a/libc/stdio/fgets.c +++ b/libc/stdio/fgets.c @@ -5,11 +5,13 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define __fgetc_unlocked __libc_fgetc_unlocked + #include "_stdio.h" #ifdef __DO_UNLOCKED -char *__fgets_unlocked(char *__restrict s, int n, +char attribute_hidden *__fgets_unlocked(char *__restrict s, int n, register FILE * __restrict stream) { register char *p; diff --git a/libc/stdio/fgetwc.c b/libc/stdio/fgetwc.c index a78f52212..cb200851b 100644 --- a/libc/stdio/fgetwc.c +++ b/libc/stdio/fgetwc.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define mbrtowc __mbrtowc + #include "_stdio.h" #ifdef __DO_UNLOCKED @@ -17,7 +19,7 @@ static void munge_stream(register FILE *stream, unsigned char *buf) __STDIO_STREAM_DISABLE_PUTC(stream); } -wint_t __fgetwc_unlocked(register FILE *stream) +wint_t attribute_hidden __fgetwc_unlocked(register FILE *stream) { wint_t wi; wchar_t wc[1]; diff --git a/libc/stdio/fgetws.c b/libc/stdio/fgetws.c index 16f8873b3..e31ea3c41 100644 --- a/libc/stdio/fgetws.c +++ b/libc/stdio/fgetws.c @@ -8,11 +8,11 @@ #include "_stdio.h" extern wchar_t *__fgetws_unlocked(wchar_t *__restrict ws, int n, - FILE *__restrict stream); + FILE *__restrict stream) attribute_hidden; #ifdef __DO_UNLOCKED -wchar_t *__fgetws_unlocked(wchar_t *__restrict ws, int n, +wchar_t attribute_hidden *__fgetws_unlocked(wchar_t *__restrict ws, int n, FILE *__restrict stream) { register wchar_t *p = ws; diff --git a/libc/stdio/fileno.c b/libc/stdio/fileno.c index 30ae90ad3..4ea21d748 100644 --- a/libc/stdio/fileno.c +++ b/libc/stdio/fileno.c @@ -9,7 +9,7 @@ #ifdef __DO_UNLOCKED -int __fileno_unlocked(register FILE *stream) +int attribute_hidden __fileno_unlocked(register FILE *stream) { __STDIO_STREAM_VALIDATE(stream); diff --git a/libc/stdio/fmemopen.c b/libc/stdio/fmemopen.c index ff03cb426..7febe1a6e 100644 --- a/libc/stdio/fmemopen.c +++ b/libc/stdio/fmemopen.c @@ -35,7 +35,7 @@ static ssize_t fmo_read(register void *cookie, char *buf, size_t bufsize) bufsize = count; } - memcpy(buf, COOKIE->buf + COOKIE->pos, bufsize); + __memcpy(buf, COOKIE->buf + COOKIE->pos, bufsize); COOKIE->pos += bufsize; return bufsize; @@ -62,7 +62,7 @@ static ssize_t fmo_write(register void *cookie, const char *buf, size_t bufsize) } } - memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); + __memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); COOKIE->pos += bufsize; if (COOKIE->pos > COOKIE->eof) { diff --git a/libc/stdio/fopen64.c b/libc/stdio/fopen64.c index 95cd7a02b..64ba30501 100644 --- a/libc/stdio/fopen64.c +++ b/libc/stdio/fopen64.c @@ -1,15 +1,13 @@ /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. * * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ #include "_stdio.h" -#ifdef __UCLIBC_HAS_LFS__ -# define __DO_LARGEFILE -# define fopen fopen64 -# define FILEDES_ARG (-2) -# include "fopen.c" -#endif +#define __DO_LARGEFILE +#define fopen fopen64 +#define FILEDES_ARG (-2) +#include "fopen.c" diff --git a/libc/stdio/fputc.c b/libc/stdio/fputc.c index ad3c95517..46ebb163c 100644 --- a/libc/stdio/fputc.c +++ b/libc/stdio/fputc.c @@ -14,7 +14,7 @@ #ifdef __DO_UNLOCKED -int __fputc_unlocked(int c, register FILE *stream) +int attribute_hidden __libc_fputc_unlocked(int c, register FILE *stream) { __STDIO_STREAM_VALIDATE(stream); @@ -69,11 +69,12 @@ int __fputc_unlocked(int c, register FILE *stream) return EOF; } -weak_alias(__fputc_unlocked,fputc_unlocked); -weak_alias(__fputc_unlocked,putc_unlocked); +strong_alias(__libc_fputc_unlocked,__fputc_unlocked) +weak_alias(__fputc_unlocked,fputc_unlocked) +weak_alias(__fputc_unlocked,putc_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__fputc_unlocked,fputc); -weak_alias(__fputc_unlocked,putc); +weak_alias(__fputc_unlocked,fputc) +weak_alias(__fputc_unlocked,putc) #endif #elif defined __UCLIBC_HAS_THREADS__ @@ -91,6 +92,6 @@ int fputc(int c, register FILE *stream) } } -weak_alias(fputc,putc); +weak_alias(fputc,putc) #endif diff --git a/libc/stdio/fputs.c b/libc/stdio/fputs.c index e4d10659f..211fc1018 100644 --- a/libc/stdio/fputs.c +++ b/libc/stdio/fputs.c @@ -14,10 +14,10 @@ #ifdef __DO_UNLOCKED -int __fputs_unlocked(register const char * __restrict s, +int attribute_hidden __fputs_unlocked(register const char * __restrict s, FILE * __restrict stream) { - size_t n = strlen(s); + size_t n = __strlen(s); return ((__fwrite_unlocked(s, 1, n, stream) == n) ? n : EOF); } diff --git a/libc/stdio/fputwc.c b/libc/stdio/fputwc.c index ef7a6d627..dbea948dc 100644 --- a/libc/stdio/fputwc.c +++ b/libc/stdio/fputwc.c @@ -9,7 +9,7 @@ #ifdef __DO_UNLOCKED -wint_t __fputwc_unlocked(wchar_t wc, FILE *stream) +wint_t attribute_hidden __fputwc_unlocked(wchar_t wc, FILE *stream) { return _wstdio_fwrite(&wc, 1, stream) ? wc : WEOF; } diff --git a/libc/stdio/fputws.c b/libc/stdio/fputws.c index f3270fde8..e83cc9fcb 100644 --- a/libc/stdio/fputws.c +++ b/libc/stdio/fputws.c @@ -5,14 +5,16 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define wcslen __wcslen + #include "_stdio.h" extern int __fputws_unlocked(const wchar_t *__restrict ws, - FILE *__restrict stream); + FILE *__restrict stream) attribute_hidden; #ifdef __DO_UNLOCKED -int __fputws_unlocked(const wchar_t *__restrict ws, +int attribute_hidden __fputws_unlocked(const wchar_t *__restrict ws, register FILE *__restrict stream) { size_t n = wcslen(ws); @@ -20,9 +22,9 @@ int __fputws_unlocked(const wchar_t *__restrict ws, return (_wstdio_fwrite(ws, n, stream) == n) ? 0 : -1; } -weak_alias(__fputws_unlocked,fputws_unlocked); +weak_alias(__fputws_unlocked,fputws_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__fputws_unlocked,fputws); +weak_alias(__fputws_unlocked,fputws) #endif #elif defined __UCLIBC_HAS_THREADS__ diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c index 73414e26c..42a29b067 100644 --- a/libc/stdio/fread.c +++ b/libc/stdio/fread.c @@ -9,7 +9,7 @@ #ifdef __DO_UNLOCKED -size_t __fread_unlocked(void * __restrict ptr, size_t size, size_t nmemb, +size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, size_t nmemb, FILE * __restrict stream) { __STDIO_STREAM_VALIDATE(stream); @@ -44,7 +44,7 @@ size_t __fread_unlocked(void * __restrict ptr, size_t size, size_t nmemb, if (avail > todo) { avail = todo; } - memcpy(buffer, stream->__bufpos, avail); + __memcpy(buffer, stream->__bufpos, avail); buffer += avail; stream->__bufpos += avail; if (!(todo -= avail)) { diff --git a/libc/stdio/freopen64.c b/libc/stdio/freopen64.c index bc278194d..e44c972f1 100644 --- a/libc/stdio/freopen64.c +++ b/libc/stdio/freopen64.c @@ -1,15 +1,13 @@ /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. * * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ #include "_stdio.h" -#ifdef __UCLIBC_HAS_LFS__ -# define __DO_LARGEFILE -# define freopen freopen64 -# define FILEDES_ARG (-2) -# include "freopen.c" -#endif +#define __DO_LARGEFILE +#define freopen freopen64 +#define FILEDES_ARG (-2) +#include "freopen.c" diff --git a/libc/stdio/fseeko.c b/libc/stdio/fseeko.c index 852557901..c795356e7 100644 --- a/libc/stdio/fseeko.c +++ b/libc/stdio/fseeko.c @@ -12,11 +12,11 @@ #endif #ifndef __DO_LARGEFILE -# define FSEEK fseek -# define OFFSET_TYPE long int +# define FSEEK __fseek +# define OFFSET_TYPE long int #endif -int FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence) +int attribute_hidden FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence) { #if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE) @@ -74,7 +74,8 @@ int FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence) } #ifdef __DO_LARGEFILE -weak_alias(__fseeko64,fseeko64); +weak_alias(__fseeko64,fseeko64) #else -weak_alias(fseek,fseeko); +weak_alias(__fseek,fseek) +weak_alias(fseek,fseeko) #endif diff --git a/libc/stdio/fseeko64.c b/libc/stdio/fseeko64.c index 93768c528..5bc4ae34e 100644 --- a/libc/stdio/fseeko64.c +++ b/libc/stdio/fseeko64.c @@ -1,15 +1,13 @@ /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. * * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ #include "_stdio.h" -#ifdef __UCLIBC_HAS_LFS__ -# define __DO_LARGEFILE -# define FSEEK __fseeko64 -# define OFFSET_TYPE __off64_t -# include "fseeko.c" -#endif +#define __DO_LARGEFILE +#define FSEEK __fseeko64 +#define OFFSET_TYPE __off64_t +#include "fseeko.c" diff --git a/libc/stdio/fsetpos64.c b/libc/stdio/fsetpos64.c index faae7a5b0..92906e302 100644 --- a/libc/stdio/fsetpos64.c +++ b/libc/stdio/fsetpos64.c @@ -1,16 +1,14 @@ /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. * * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ #include "_stdio.h" -#ifdef __UCLIBC_HAS_LFS__ -# define __DO_LARGEFILE -# define fsetpos fsetpos64 -# define fpos_t fpos64_t -# define fseek fseeko64 -# include "fsetpos.c" -#endif +#define __DO_LARGEFILE +#define fsetpos fsetpos64 +#define fpos_t fpos64_t +#define fseek fseeko64 +#include "fsetpos.c" diff --git a/libc/stdio/ftello.c b/libc/stdio/ftello.c index a69ce23df..7f5c53126 100644 --- a/libc/stdio/ftello.c +++ b/libc/stdio/ftello.c @@ -8,11 +8,11 @@ #include "_stdio.h" #ifndef __DO_LARGEFILE -# define FTELL ftell -# define OFFSET_TYPE long int +# define FTELL __ftell +# define OFFSET_TYPE long int #endif -OFFSET_TYPE FTELL(register FILE *stream) +OFFSET_TYPE attribute_hidden FTELL(register FILE *stream) { #if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE) @@ -47,7 +47,8 @@ OFFSET_TYPE FTELL(register FILE *stream) } #ifdef __DO_LARGEFILE -weak_alias(__ftello64,ftello64); +weak_alias(__ftello64,ftello64) #else -weak_alias(ftell,ftello); +weak_alias(__ftell,ftell) +weak_alias(ftell,ftello) #endif diff --git a/libc/stdio/ftello64.c b/libc/stdio/ftello64.c index f3b289eee..32a37d368 100644 --- a/libc/stdio/ftello64.c +++ b/libc/stdio/ftello64.c @@ -1,15 +1,13 @@ /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. * * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ #include "_stdio.h" -#ifdef __UCLIBC_HAS_LFS__ -# define __DO_LARGEFILE -# define FTELL __ftello64 -# define OFFSET_TYPE __off64_t -# include "ftello.c" -#endif +#define __DO_LARGEFILE +#define FTELL __ftello64 +#define OFFSET_TYPE __off64_t +#include "ftello.c" diff --git a/libc/stdio/fwrite.c b/libc/stdio/fwrite.c index 7bb0a8022..50af8f7a5 100644 --- a/libc/stdio/fwrite.c +++ b/libc/stdio/fwrite.c @@ -9,7 +9,7 @@ #ifdef __DO_UNLOCKED -size_t __fwrite_unlocked(const void * __restrict ptr, size_t size, +size_t attribute_hidden __fwrite_unlocked(const void * __restrict ptr, size_t size, size_t nmemb, register FILE * __restrict stream) { __STDIO_STREAM_VALIDATE(stream); diff --git a/libc/stdio/getchar.c b/libc/stdio/getchar.c index 902cec16e..ec578919b 100644 --- a/libc/stdio/getchar.c +++ b/libc/stdio/getchar.c @@ -12,7 +12,7 @@ #ifdef __DO_UNLOCKED -int __getchar_unlocked(void) +int attribute_hidden __getchar_unlocked(void) { register FILE *stream = stdin; diff --git a/libc/stdio/getdelim.c b/libc/stdio/getdelim.c index cf3cf4c10..f21b16062 100644 --- a/libc/stdio/getdelim.c +++ b/libc/stdio/getdelim.c @@ -20,7 +20,7 @@ #define GETDELIM_GROWBY 64 -ssize_t __getdelim(char **__restrict lineptr, size_t *__restrict n, +ssize_t attribute_hidden __libc_getdelim(char **__restrict lineptr, size_t *__restrict n, int delimiter, register FILE *__restrict stream) { register char *buf; @@ -74,4 +74,5 @@ ssize_t __getdelim(char **__restrict lineptr, size_t *__restrict n, return pos; } -weak_alias(__getdelim,getdelim); +strong_alias(__libc_getdelim,__getdelim) +weak_alias(__getdelim,getdelim) diff --git a/libc/stdio/getline.c b/libc/stdio/getline.c index 0708aedaa..7424dc024 100644 --- a/libc/stdio/getline.c +++ b/libc/stdio/getline.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define __getdelim __libc_getdelim + #include "_stdio.h" ssize_t getline(char **__restrict lineptr, size_t *__restrict n, diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c index 8caa3d66d..abf535a16 100644 --- a/libc/stdio/old_vfprintf.c +++ b/libc/stdio/old_vfprintf.c @@ -127,6 +127,9 @@ /**************************************************************************/ +#define _uintmaxtostr __libc__uintmaxtostr +#define strnlen __strnlen + #define _ISOC99_SOURCE /* for ULLONG primarily... */ #define _GNU_SOURCE /* for strnlen */ #include "_stdio.h" @@ -188,7 +191,7 @@ static void _outnstr(FILE *stream, const unsigned char *s, size_t n) if (r > n) { r = n; } - memcpy(f->bufpos, s, r); + __memcpy(f->bufpos, s, r); f->bufpos += r; } } @@ -234,7 +237,7 @@ static void _charpad(FILE * __restrict stream, int padchar, size_t numpad) static void _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf) { if (type & 0x80) { /* Some type of padding needed. */ - int buflen = strlen((const char *) buf); + int buflen = __strlen((const char *) buf); if ((len -= buflen) > 0) { _charpad(fp, (type & 0x7f), len); } diff --git a/libc/stdio/open_memstream.c b/libc/stdio/open_memstream.c index 0e3df43d1..358486010 100644 --- a/libc/stdio/open_memstream.c +++ b/libc/stdio/open_memstream.c @@ -51,7 +51,7 @@ static ssize_t oms_write(register void *cookie, const char *buf, size_t bufsize) } } - memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); + __memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); COOKIE->pos += bufsize; if (COOKIE->pos > COOKIE->eof) { @@ -90,7 +90,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence) if (buf) { *COOKIE->bufloc = COOKIE->buf = buf; COOKIE->len = leastlen; - memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */ + __memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */ } else { /* TODO: check glibc errno setting... */ return -1; @@ -100,7 +100,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence) *pos = COOKIE->pos = --leastlen; if (leastlen > COOKIE->eof) { - memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0); + __memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0); *COOKIE->sizeloc = COOKIE->eof; } diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c index c7887ad41..6de09253c 100644 --- a/libc/stdio/popen.c +++ b/libc/stdio/popen.c @@ -84,23 +84,23 @@ FILE *popen(const char *command, const char *modes) parent_fd = pipe_fd[1-child_writing]; if (!(fp = fdopen(parent_fd, modes))) { - close(parent_fd); - close(child_fd); + __close(parent_fd); + __close(child_fd); goto FREE_PI; } VFORK_LOCK; if ((pid = vfork()) == 0) { /* Child of vfork... */ - close(parent_fd); + __close(parent_fd); if (child_fd != child_writing) { dup2(child_fd, child_writing); - close(child_fd); + __close(child_fd); } /* SUSv3 requires that any previously popen()'d streams in the * parent shall be closed in the child. */ for (po = popen_list ; po ; po = po->next) { - close(po->f->__filedes); + __close(po->f->__filedes); } execl("/bin/sh", "sh", "-c", command, (char *)0); @@ -113,7 +113,7 @@ FILE *popen(const char *command, const char *modes) /* We need to close the child filedes whether vfork failed or * it succeeded and we're in the parent. */ - close(child_fd); + __close(child_fd); if (pid > 0) { /* Parent of vfork... */ pi->pid = pid; diff --git a/libc/stdio/puts.c b/libc/stdio/puts.c index a7d0eaf19..37ae243bf 100644 --- a/libc/stdio/puts.c +++ b/libc/stdio/puts.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define __fputc_unlocked __libc_fputc_unlocked + #include "_stdio.h" int puts(register const char * __restrict s) diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index d99896893..1d6522417 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -43,6 +43,9 @@ * standards and from an official C standard defect report. */ +#define wcslen __wcslen +#define mbsrtowcs __mbsrtowcs +#define mbrtowc __mbrtowc #define _ISOC99_SOURCE /* for LLONG_MAX primarily... */ #define _GNU_SOURCE @@ -247,7 +250,7 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) f.__bufstart = f.__bufpos = (unsigned char *) ((void *) sp); f.__bufread = - f.__bufend = f.__bufstart + strlen(sp); + f.__bufend = f.__bufstart + __strlen(sp); __STDIO_STREAM_ENABLE_GETC(&f); __STDIO_STREAM_DISABLE_PUTC(&f); @@ -261,7 +264,7 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) __FILE_vsscanf f; f.bufpos = (unsigned char *) ((void *) sp); - f.bufread = f.bufpos + strlen(sp); + f.bufread = f.bufpos + __strlen(sp); /* __STDIO_STREAM_RESET_GCS(&f.f); */ #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ @@ -303,7 +306,7 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) FILE *f; int rv = EOF; - if ((f = fmemopen((char *)sp, strlen(sp), "r")) != NULL) { + if ((f = fmemopen((char *)sp, __strlen(sp), "r")) != NULL) { rv = vfscanf(f, fmt, ap); fclose(f); } @@ -1027,7 +1030,7 @@ static int sc_getc(register struct scan_cookie *sc) sc->fp->__modeflags |= __FLAG_EOF; return EOF; } - } else if ((wc = fgetwc_unlocked(sc->fp)) == WEOF) { + } else if ((wc = __fgetwc_unlocked(sc->fp)) == WEOF) { return EOF; } @@ -1073,7 +1076,7 @@ static int scan_getwc(register struct scan_cookie *sc) sc->ungot_flag |= 2; return -1; } - } else if ((wc = fgetwc_unlocked(sc->fp)) == WEOF) { + } else if ((wc = __fgetwc_unlocked(sc->fp)) == WEOF) { sc->ungot_flag |= 2; return -1; } @@ -1197,7 +1200,7 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) #if defined(NL_ARGMAX) && (NL_ARGMAX > 0) psfs.num_pos_args = -1; /* Must start at -1. */ /* Initialize positional arg ptrs to NULL. */ - memset(psfs.pos_args, 0, sizeof(psfs.pos_args)); + __memset(psfs.pos_args, 0, sizeof(psfs.pos_args)); #endif /* defined(NL_ARGMAX) && (NL_ARGMAX > 0) */ __STDIO_AUTO_THREADLOCK(fp); @@ -1429,7 +1432,7 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) ++fmt; invert = 1; } - memset(scanset, invert, sizeof(scanset)); + __memset(scanset, invert, sizeof(scanset)); invert = 1-invert; if (*fmt == ']') { @@ -1978,14 +1981,14 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) if ((psfs->conv_num > CONV_i) /* float conversion */ && (!pass || (i == nblk1)) /* possible last */ - && !memcmp(sc->thousands_sep, sc->fake_decpt, k) + && !__memcmp(sc->thousands_sep, sc->fake_decpt, k) /* and prefix matched, so could be decpt */ ) { __scan_getc(sc); p = sc->fake_decpt + k; do { if (!*++p) { - strcpy(b, sc->decpt); + __strcpy(b, sc->decpt); b += sc->decpt_len; goto GOT_DECPT; } @@ -2079,7 +2082,7 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) p = sc->fake_decpt; do { if (!*p) { - strcpy(b, sc->decpt); + __strcpy(b, sc->decpt); b += sc->decpt_len; break; } diff --git a/libc/stdio/tempnam.c b/libc/stdio/tempnam.c index a11f82b5d..d626dc0f8 100644 --- a/libc/stdio/tempnam.c +++ b/libc/stdio/tempnam.c @@ -38,6 +38,6 @@ tempnam (const char *dir, const char *pfx) if (__gen_tempname (buf, __GT_NOCREATE)) return NULL; - return strdup (buf); + return __strdup (buf); } diff --git a/libc/stdio/tmpfile.c b/libc/stdio/tmpfile.c index 5484d5d6c..488ddd763 100644 --- a/libc/stdio/tmpfile.c +++ b/libc/stdio/tmpfile.c @@ -42,7 +42,7 @@ FILE * tmpfile (void) (void) remove (buf); if ((f = fdopen (fd, "w+b")) == NULL) - close (fd); + __close (fd); return f; } diff --git a/libc/stdio/tmpnam.c b/libc/stdio/tmpnam.c index 802c54498..df2399e66 100644 --- a/libc/stdio/tmpnam.c +++ b/libc/stdio/tmpnam.c @@ -41,7 +41,7 @@ char * tmpnam (char *s) return NULL; if (s == NULL) - return (char *) memcpy (tmpnam_buffer, tmpbuf, L_tmpnam); + return (char *) __memcpy (tmpnam_buffer, tmpbuf, L_tmpnam); return s; } diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c index 73bbe63d3..4675dacc2 100644 --- a/libc/stdio/vfprintf.c +++ b/libc/stdio/vfprintf.c @@ -88,6 +88,12 @@ * treats this as an error. */ +#define _uintmaxtostr __libc__uintmaxtostr +#define strnlen __strnlen +#define wcslen __wcslen +#define wcsnlen __wcsnlen +#define wcsrtombs __wcsrtombs +#define mbsrtowcs __mbsrtowcs #define _ISOC99_SOURCE /* for ULLONG primarily... */ #define _GNU_SOURCE @@ -502,7 +508,7 @@ int attribute_hidden _ppfs_init(register ppfs_t *ppfs, const char *fmt0) int r; /* First, zero out everything... argnumber[], argtype[], argptr[] */ - memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ + __memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ #ifdef NL_ARGMAX --ppfs->maxposarg; /* set to -1 */ #endif /* NL_ARGMAX */ @@ -1108,7 +1114,7 @@ int attribute_hidden _ppfs_parsespec(ppfs_t *ppfs) } else { #endif /* NL_ARGMAX */ ppfs->argnumber[2] = 1; - memcpy(ppfs->argtype, argtype + 2, ppfs->num_data_args * sizeof(int)); + __memcpy(ppfs->argtype, argtype + 2, ppfs->num_data_args * sizeof(int)); #ifdef NL_ARGMAX } @@ -1191,7 +1197,7 @@ static size_t _charpad(FILE * __restrict stream, int padchar, size_t numpad); #define VFPRINTF vfprintf #define FMT_TYPE char #define OUTNSTR _outnstr -#define STRLEN strlen +#define STRLEN __strlen #define _PPFS_init _ppfs_init #define OUTPUT(F,S) __fputs_unlocked(S,F) /* #define _outnstr(stream, string, len) __stdio_fwrite(string, len, stream) */ @@ -1205,7 +1211,7 @@ static size_t _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf size_t r = 0; if (type & 0x80) { /* Some type of padding needed. */ - int buflen = strlen((const char *) buf); + int buflen = __strlen((const char *) buf); if ((len -= buflen) > 0) { if ((r = _charpad(fp, (type & 0x7f), len)) != len) { return r; @@ -1275,7 +1281,7 @@ static size_t _fp_out_wide(FILE *fp, intptr_t type, intptr_t len, intptr_t buf) int i; if (type & 0x80) { /* Some type of padding needed */ - int buflen = strlen(s); + int buflen = __strlen(s); if ((len -= buflen) > 0) { if ((r = _charpad(fp, (type & 0x7f), len)) != len) { return r; @@ -1319,7 +1325,7 @@ static int _ppwfs_init(register ppfs_t *ppfs, const wchar_t *fmt0) int r; /* First, zero out everything... argnumber[], argtype[], argptr[] */ - memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ + __memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ #ifdef NL_ARGMAX --ppfs->maxposarg; /* set to -1 */ #endif /* NL_ARGMAX */ |
