summaryrefslogtreecommitdiffstats
path: root/libc/stdio
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2005-11-19 21:04:15 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2005-11-19 21:04:15 +0000
commitaebf0c050a8598c864dda377b4fadb79225d34ca (patch)
treef67c89bb2536f64c390654810b1aa1b95ae0a11e /libc/stdio
parent6f728cdcf296054020c8606cb8cb841d84a64245 (diff)
downloaduClibc-alpine-aebf0c050a8598c864dda377b4fadb79225d34ca.tar.bz2
uClibc-alpine-aebf0c050a8598c864dda377b4fadb79225d34ca.tar.xz
Sync up with trunk.
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/Makefile.in109
-rw-r--r--libc/stdio/_stdio.h1
-rw-r--r--libc/stdio/fgetpos.c10
-rw-r--r--libc/stdio/fopen.c9
-rw-r--r--libc/stdio/freopen.c9
-rw-r--r--libc/stdio/fseeko.c13
-rw-r--r--libc/stdio/fsetpos.c11
-rw-r--r--libc/stdio/ftello.c12
8 files changed, 54 insertions, 120 deletions
diff --git a/libc/stdio/Makefile.in b/libc/stdio/Makefile.in
index a928e0872..dfdf4ff14 100644
--- a/libc/stdio/Makefile.in
+++ b/libc/stdio/Makefile.in
@@ -7,10 +7,9 @@
# Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
#
-# 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 \
+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 \
@@ -18,102 +17,102 @@ CSRC:= fclose.c fcloseall.c fdopen.c fgetpos.c fopen.c freopen.c \
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
+CSRC += fgetpos64.c fopen64.c freopen64.c fseeko64.c fsetpos64.c ftello64.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 \
+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 ($(UCLIBC_HAS_FLOATS),y)
-CSRC+=_fpmaxtostr.c
+CSRC += _fpmaxtostr.c
endif
# stdio_ext.h functions
-CSRC+= __fbufsize.c __flbf.c __fpending.c __fpurge.c __freadable.c \
+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 ($(UCLIBC_HAS_GLIBC_CUSTOM_STREAMS),y)
-CSRC+=fopencookie.c fmemopen.c open_memstream.c
+CSRC += fopencookie.c fmemopen.c open_memstream.c
endif
# pthread functions
-CSRC+=flockfile.c ftrylockfile.c funlockfile.c
+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 \
+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 (%64.o)
-CLSRC:=
-ifeq ($(UCLIBC_HAS_LFS),y)
-CLSRC:=fgetpos.c fopen.c freopen.c fseeko.c fsetpos.c ftello.c # tmpfile
-endif
-
# vfprintf and support functions
-MSRC1:=vfprintf.c
+MSRC1 := vfprintf.c
ifneq ($(USE_OLD_VFPRINTF),y)
-MOBJ1:= vfprintf.o \
+MOBJ1 := \
+ vfprintf.o \
_ppfs_init.o _ppfs_prepargs.o _ppfs_setargs.o _ppfs_parsespec.o \
register_printf_function.o parse_printf_format.o
else
-MOBJ1:=
-CSRC+=old_vfprintf.c
+MOBJ1 :=
+CSRC += old_vfprintf.c
endif
# vfscanf and support functions plus other *scanf funcs
-MSRC2:=scanf.c
-MOBJ2:= vfscanf.o __scan_cookie.o __psfs_parse_spec.o __psfs_do_numeric.o \
+MSRC2 := scanf.c
+MOBJ2 := \
+ vfscanf.o __scan_cookie.o __psfs_parse_spec.o __psfs_do_numeric.o \
scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o
-CWSRC:=
+CWSRC :=
ifeq ($(UCLIBC_HAS_WCHAR),y)
-CWSRC+=_wfwrite.c fwprintf.c swprintf.c vswprintf.c vwprintf.c wprintf.c \
+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
+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)
-MOBJ1+=vfwprintf.o
-MOBJ2+=wscanf.o swscanf.o fwscanf.o vwscanf.o vswscanf.o vfwscanf.o
+MOBJ1 += vfwprintf.o
+MOBJ2 += wscanf.o swscanf.o fwscanf.o vwscanf.o vswscanf.o vfwscanf.o
endif
-CSRC+=$(CUSRC) $(CWSRC)
+CSRC += $(CUSRC) $(CWSRC)
ifneq ($(DOMULTI),n)
-STDIO_CSRC_NO_MULTI:=fwrite.c fputc.c fputs.c fprintf.c _fpmaxtostr.c
-CSRC:=$(filter-out $(STDIO_CSRC_NO_MULTI),$(CSRC))
+STDIO_CSRC_NO_MULTI := fwrite.c fputc.c fputs.c fprintf.c _fpmaxtostr.c
+CSRC := $(filter-out $(STDIO_CSRC_NO_MULTI),$(CSRC))
endif
-STDIO_MOBJ1_NO_MULTI:=vfprintf.o vfwprintf.o register_printf_function.o
-STDIO_MOBJ2_NO_MULTI:=vfscanf.o vfwscanf.o fscanf.o
-STDIO_MOBJ_NO_MULTI:=$(STDIO_MOBJ1_NO_MULTI) $(STDIO_MOBJ2_NO_MULTI)
+STDIO_MOBJ1_NO_MULTI := vfprintf.o vfwprintf.o register_printf_function.o
+STDIO_MOBJ2_NO_MULTI := vfscanf.o vfwscanf.o fscanf.o
+STDIO_MOBJ_NO_MULTI := $(STDIO_MOBJ1_NO_MULTI) $(STDIO_MOBJ2_NO_MULTI)
-STDIO_DIR:=$(top_srcdir)libc/stdio
-STDIO_OUT:=$(top_builddir)libc/stdio
+STDIO_DIR := $(top_srcdir)libc/stdio
+STDIO_OUT := $(top_builddir)libc/stdio
-STDIO_SRC:=$(patsubst %.c,$(STDIO_DIR)/%.c,$(CSRC))
-STDIO_OBJ:=$(patsubst %.c,$(STDIO_OUT)/%.o,$(CSRC))
-STDIO_CUSRC:=$(patsubst %.c,$(STDIO_DIR)/%.c,$(CUSRC))
-STDIO_CUOBJ:=$(patsubst %.c,$(STDIO_OUT)/%_unlocked.o,$(CUSRC))
-STDIO_CLSRC:=$(patsubst %.c,$(STDIO_OUT)/%64.c,$(CLSRC))
-STDIO_CLOBJ:=$(patsubst %.c,$(STDIO_OUT)/%64.o,$(CLSRC))
+STDIO_SRC := $(patsubst %.c,$(STDIO_DIR)/%.c,$(CSRC))
+STDIO_OBJ := $(patsubst %.c,$(STDIO_OUT)/%.o,$(CSRC))
+STDIO_CUSRC := $(patsubst %.c,$(STDIO_DIR)/%.c,$(CUSRC))
+STDIO_CUOBJ := $(patsubst %.c,$(STDIO_OUT)/%_unlocked.o,$(CUSRC))
-STDIO_MSRC1:=$(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC1))
-STDIO_MSRC2:=$(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC2))
-STDIO_MOBJ1:=$(patsubst %.o,$(STDIO_OUT)/%.o,$(MOBJ1))
-STDIO_MOBJ2:=$(patsubst %.o,$(STDIO_OUT)/%.o,$(MOBJ2))
+STDIO_MSRC1 := $(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC1))
+STDIO_MSRC2 := $(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC2))
+STDIO_MOBJ1 := $(patsubst %.o,$(STDIO_OUT)/%.o,$(MOBJ1))
+STDIO_MOBJ2 := $(patsubst %.o,$(STDIO_OUT)/%.o,$(MOBJ2))
-STDIO_MSRC:=$(STDIO_MSRC1) $(STDIO_MSRC2)
-STDIO_MOBJ:=$(STDIO_MOBJ1) $(STDIO_MOBJ2)
+STDIO_MSRC := $(STDIO_MSRC1) $(STDIO_MSRC2)
+STDIO_MOBJ := $(STDIO_MOBJ1) $(STDIO_MOBJ2)
-STDIO_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(filter-out $(STDIO_MOBJ_NO_MULTI),$(notdir $(STDIO_MOBJ)))))
+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_CLOBJ)
-STDIO_NO_MULTI:=$(STDIO_CUOBJ) $(STDIO_CLOBJ)
+STDIO_NO_MULTI := $(STDIO_CUOBJ) $(STDIO_CLOBJ)
# these need special handling or rewrite to support multi-build
# CUOBJ
@@ -123,16 +122,6 @@ STDIO_NO_MULTI:=$(STDIO_CUOBJ) $(STDIO_CLOBJ)
%_unlocked.os: %.c
$(compile.c) -D__DO_UNLOCKED
-# need this, else the other %64 files will get false rules
-$(STDIO_CLSRC): $(STDIO_OUT)/%64.c : $(STDIO_DIR)/%.c
- @cp $< $@
-
-$(STDIO_CLOBJ): %.o : %.c
- $(compile.c) -D__DO_LARGEFILE
-
-$(STDIO_CLOBJ:.o=.os): %.os : %.c
- $(compile.c) -D__DO_LARGEFILE
-
$(STDIO_MOBJ1): $(STDIO_MSRC1)
$(compile.m)
@@ -157,4 +146,4 @@ libc-nomulti-y+=$(patsubst %.o,$(STDIO_OUT)/%.o,$(STDIO_MOBJ_NO_MULTI))
objclean-y+=stdio_objclean
stdio_objclean:
- $(RM) $(STDIO_OUT)/*.{o,os} $(STDIO_OUT)/*64.c
+ $(RM) $(STDIO_OUT)/*.{o,os}
diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h
index 1ed349533..e900edac6 100644
--- a/libc/stdio/_stdio.h
+++ b/libc/stdio/_stdio.h
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <features.h>
#ifdef __UCLIBC_HAS_WCHAR__
#include <wchar.h>
diff --git a/libc/stdio/fgetpos.c b/libc/stdio/fgetpos.c
index 9c6c26297..84cf0b98c 100644
--- a/libc/stdio/fgetpos.c
+++ b/libc/stdio/fgetpos.c
@@ -7,16 +7,6 @@
#include "_stdio.h"
-#ifdef __DO_LARGEFILE
-# ifndef __UCLIBC_HAS_LFS__
-# error large file support is not enabled!
-# endif
-
-# define fgetpos fgetpos64
-# define fpos_t fpos64_t
-# define ftell ftello64
-#endif
-
int fgetpos(FILE * __restrict stream, register fpos_t * __restrict pos)
{
#ifdef __STDIO_MBSTATE
diff --git a/libc/stdio/fopen.c b/libc/stdio/fopen.c
index 8303fa88c..244304acf 100644
--- a/libc/stdio/fopen.c
+++ b/libc/stdio/fopen.c
@@ -7,14 +7,7 @@
#include "_stdio.h"
-#ifdef __DO_LARGEFILE
-# ifndef __UCLIBC_HAS_LFS__
-# error large file support is not enabled!
-# endif
-
-# define fopen fopen64
-# define FILEDES_ARG (-2)
-#else
+#ifndef __DO_LARGEFILE
# define FILEDES_ARG (-1)
#endif
diff --git a/libc/stdio/freopen.c b/libc/stdio/freopen.c
index 0eccaac1f..7df035d48 100644
--- a/libc/stdio/freopen.c
+++ b/libc/stdio/freopen.c
@@ -7,14 +7,7 @@
#include "_stdio.h"
-#ifdef __DO_LARGEFILE
-# ifndef __UCLIBC_HAS_LFS__
-# error large file support is not enabled!
-# endif
-
-# define freopen freopen64
-# define FILEDES_ARG (-2)
-#else
+#ifndef __DO_LARGEFILE
# define FILEDES_ARG (-1)
#endif
diff --git a/libc/stdio/fseeko.c b/libc/stdio/fseeko.c
index 48979a06b..242292a43 100644
--- a/libc/stdio/fseeko.c
+++ b/libc/stdio/fseeko.c
@@ -11,22 +11,11 @@
# error Assumption violated -- values of SEEK_SET, SEEK_CUR, SEEK_END
#endif
-#ifdef __DO_LARGEFILE
-# ifndef __UCLIBC_HAS_LFS__
-# error large file support is not enabled!
-# endif
-
-# define FSEEK __fseeko64
-# define OFFSET_TYPE __off64_t
-
-#else
-
+#ifndef __DO_LARGEFILE
# define FSEEK fseek
# define OFFSET_TYPE long int
-
#endif
-
int FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence)
{
#if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE)
diff --git a/libc/stdio/fsetpos.c b/libc/stdio/fsetpos.c
index 44104b4df..2b02f25e0 100644
--- a/libc/stdio/fsetpos.c
+++ b/libc/stdio/fsetpos.c
@@ -7,16 +7,6 @@
#include "_stdio.h"
-#ifdef __DO_LARGEFILE
-# ifndef __UCLIBC_HAS_LFS__
-# error large file support is not enabled!
-# endif
-
-# define fsetpos fsetpos64
-# define fpos_t fpos64_t
-# define fseek fseeko64
-#endif
-
int fsetpos(FILE *stream, register const fpos_t *pos)
{
#ifdef __STDIO_MBSTATE
@@ -41,4 +31,3 @@ int fsetpos(FILE *stream, register const fpos_t *pos)
#endif
}
-
diff --git a/libc/stdio/ftello.c b/libc/stdio/ftello.c
index 38517acbd..a28333efc 100644
--- a/libc/stdio/ftello.c
+++ b/libc/stdio/ftello.c
@@ -7,19 +7,9 @@
#include "_stdio.h"
-#ifdef __DO_LARGEFILE
-# ifndef __UCLIBC_HAS_LFS__
-# error large file support is not enabled!
-# endif
-
-# define FTELL __ftello64
-# define OFFSET_TYPE __off64_t
-
-#else
-
+#ifndef __DO_LARGEFILE
# define FTELL ftell
# define OFFSET_TYPE long int
-
#endif
OFFSET_TYPE FTELL(register FILE *stream)