summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/Makefile.in23
-rw-r--r--libc/stdio/fgetpos.c10
-rw-r--r--libc/stdio/fgetpos64.c16
-rw-r--r--libc/stdio/fopen.c9
-rw-r--r--libc/stdio/fopen64.c15
-rw-r--r--libc/stdio/freopen.c9
-rw-r--r--libc/stdio/freopen64.c15
-rw-r--r--libc/stdio/fseeko.c13
-rw-r--r--libc/stdio/fseeko64.c15
-rw-r--r--libc/stdio/fsetpos.c11
-rw-r--r--libc/stdio/fsetpos64.c16
-rw-r--r--libc/stdio/ftello.c12
-rw-r--r--libc/stdio/ftello64.c15
13 files changed, 99 insertions, 80 deletions
diff --git a/libc/stdio/Makefile.in b/libc/stdio/Makefile.in
index ba9468971..3de5436e3 100644
--- a/libc/stdio/Makefile.in
+++ b/libc/stdio/Makefile.in
@@ -7,8 +7,6 @@
# 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 \
@@ -19,6 +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
+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
@@ -52,12 +53,6 @@ CUSRC := \
# 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
ifneq ($(USE_OLD_VFPRINTF),y)
@@ -104,8 +99,6 @@ 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_MSRC1 := $(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC1))
STDIO_MSRC2 := $(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC2))
@@ -129,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)
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/fgetpos64.c b/libc/stdio/fgetpos64.c
new file mode 100644
index 000000000..d222a1a98
--- /dev/null
+++ b/libc/stdio/fgetpos64.c
@@ -0,0 +1,16 @@
+/* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * 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
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/fopen64.c b/libc/stdio/fopen64.c
new file mode 100644
index 000000000..7510f9a93
--- /dev/null
+++ b/libc/stdio/fopen64.c
@@ -0,0 +1,15 @@
+/* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * 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
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/freopen64.c b/libc/stdio/freopen64.c
new file mode 100644
index 000000000..d3151bab8
--- /dev/null
+++ b/libc/stdio/freopen64.c
@@ -0,0 +1,15 @@
+/* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * 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
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/fseeko64.c b/libc/stdio/fseeko64.c
new file mode 100644
index 000000000..66778e963
--- /dev/null
+++ b/libc/stdio/fseeko64.c
@@ -0,0 +1,15 @@
+/* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * 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
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/fsetpos64.c b/libc/stdio/fsetpos64.c
new file mode 100644
index 000000000..faae7a5b0
--- /dev/null
+++ b/libc/stdio/fsetpos64.c
@@ -0,0 +1,16 @@
+/* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * 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
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)
diff --git a/libc/stdio/ftello64.c b/libc/stdio/ftello64.c
new file mode 100644
index 000000000..3ba201968
--- /dev/null
+++ b/libc/stdio/ftello64.c
@@ -0,0 +1,15 @@
+/* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * 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 "fgetpos.c"
+#endif