about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-10-17 00:41:39 +0000
committerRoland McGrath <roland@gnu.org>1995-10-17 00:41:39 +0000
commitdeab9deadc372fe1a367aef2e78c0d8f2885bf23 (patch)
tree367eaf76a86934f3883f950da5719ca581185ca5
parent10fd03c6014206b3775be893727f282c4c709ebf (diff)
downloadglibc-deab9deadc372fe1a367aef2e78c0d8f2885bf23.tar.gz
glibc-deab9deadc372fe1a367aef2e78c0d8f2885bf23.tar.xz
glibc-deab9deadc372fe1a367aef2e78c0d8f2885bf23.zip
* Makefile (subdirs): Replace stdio with stdio-common and $(stdio).
	* configure.in: Grok arg --enable-libio.
	($stdio = libio): Define USE_IN_LIBIO.
	* config.h.in (USE_IN_LIBIO): Add #undef.
	* config.make.in (stdio): New variable, set by configure.
	* Makeconfig (stdio): New variable.
	* stdio.h [USE_IN_LIBIO]: Include libio/stdio.h instead of
	stdio/stdio.h.
	* stdio-common/Makefile: New file.
	* stdio/Makefile: Half the contents moved to stdio-common/Makefile.
	* stdio/_itoa.c: Moved to stdio-common.
	* stdio/_itoa.h: Moved to stdio-common.
	* stdio/asprintf.c: Moved to stdio-common.
	* stdio/bug1.c: Moved to stdio-common.
	* stdio/bug1.input: Moved to stdio-common.
	* stdio/bug2.c: Moved to stdio-common.
	* stdio/bug3.c: Moved to stdio-common.
	* stdio/bug4.c: Moved to stdio-common.
	* stdio/bug5.c: Moved to stdio-common.
	* stdio/bug6.c: Moved to stdio-common.
	* stdio/bug6.input: Moved to stdio-common.
	* stdio/bug7.c: Moved to stdio-common.
	* stdio/dprintf.c: Moved to stdio-common.
	* stdio/errnobug.c: Moved to stdio-common.
	* stdio/getline.c: Moved to stdio-common.
	* stdio/getw.c: Moved to stdio-common.
	* stdio/perror.c: Moved to stdio-common.
	* stdio/printf-parse.h: Moved to stdio-common.
	* stdio/printf-prs.c: Moved to stdio-common.
	* stdio/printf.c: Moved to stdio-common.
	* stdio/printf.h: Moved to stdio-common.
	* stdio/printf_fp.c: Moved to stdio-common.
	* stdio/psignal.c: Moved to stdio-common.
	* stdio/putw.c: Moved to stdio-common.
	* stdio/reg-printf.c: Moved to stdio-common.
	* stdio/scanf.c: Moved to stdio-common.
	* stdio/snprintf.c: Moved to stdio-common.
	* stdio/sprintf.c: Moved to stdio-common.
	* stdio/sscanf.c: Moved to stdio-common.
	* stdio/tempnam.c: Moved to stdio-common.
	* stdio/temptest.c: Moved to stdio-common.
	* stdio/test-fseek.c: Moved to stdio-common.
	* stdio/test-fwrite.c: Moved to stdio-common.
	* stdio/test-popen.c: Moved to stdio-common.
	* stdio/test_rdwr.c: Moved to stdio-common.
	* stdio/tmpfile.c: Moved to stdio-common.
	* stdio/tmpnam.c: Moved to stdio-common.
	* stdio/tst-fileno.c: Moved to stdio-common.
	* stdio/tst-printf.c: Moved to stdio-common.
	* stdio/tstgetln.c: Moved to stdio-common.
	* stdio/tstgetln.input: Moved to stdio-common.
	* stdio/tstscanf.c: Moved to stdio-common.
	* stdio/tstscanf.input: Moved to stdio-common.
	* stdio/vfprintf.c: Moved to stdio-common.
	* stdio/vfscanf.c: Moved to stdio-common.
	* stdio/vprintf.c: Moved to stdio-common.
	* stdio/xbug.c: Moved to stdio-common.
	* sysdeps/generic/Makefile (siglist.c rules): Do this in subdir
	stdio-common instead of stdio.
	* sysdeps/unix/Makefile (errlist.c rules): Likewise.
	* stdio-common/asprintf.c [USE_IN_LIBIO]: Call libio primitive
	function.
	* stdio-common/dprintf.c: Likewise.
	* stdio-common/printf.c: Likewise.
	* stdio-common/scanf.c: Likewise.
	* stdio-common/snprintf.c: Likewise.
	* stdio-common/sprintf.c: Likewise.
	* stdio-common/sscanf.c: Likewise.
	* stdio-common/vprintf.c: Likewise.

	* Makerules: Include $(+depfiles) directly instead of generating
	depend-$(subdir).
	(depend-$(subdir)): Target removed.
	(common-clean): Don't remove depend-$(subdir).
-rw-r--r--ChangeLog75
-rw-r--r--Makeconfig6
-rw-r--r--Makefile8
-rw-r--r--Makerules16
-rw-r--r--config.h.in4
-rw-r--r--config.make.in1
-rw-r--r--configure.in8
-rw-r--r--stdio-common/Makefile47
-rw-r--r--stdio-common/_itoa.c (renamed from stdio/_itoa.c)0
-rw-r--r--stdio-common/_itoa.h (renamed from stdio/_itoa.h)0
-rw-r--r--stdio-common/asprintf.c (renamed from stdio/asprintf.c)17
-rw-r--r--stdio-common/bug1.c (renamed from stdio/bug1.c)0
-rw-r--r--stdio-common/bug1.input (renamed from stdio/bug1.input)0
-rw-r--r--stdio-common/bug2.c (renamed from stdio/bug2.c)0
-rw-r--r--stdio-common/bug3.c (renamed from stdio/bug3.c)0
-rw-r--r--stdio-common/bug4.c (renamed from stdio/bug4.c)0
-rw-r--r--stdio-common/bug5.c (renamed from stdio/bug5.c)0
-rw-r--r--stdio-common/bug6.c (renamed from stdio/bug6.c)0
-rw-r--r--stdio-common/bug6.input (renamed from stdio/bug6.input)0
-rw-r--r--stdio-common/bug7.c (renamed from stdio/bug7.c)0
-rw-r--r--stdio-common/dprintf.c (renamed from stdio/dprintf.c)16
-rw-r--r--stdio-common/errnobug.c (renamed from stdio/errnobug.c)0
-rw-r--r--stdio-common/fprintf.c (renamed from stdio/fprintf.c)0
-rw-r--r--stdio-common/fscanf.c (renamed from stdio/fscanf.c)0
-rw-r--r--stdio-common/getline.c (renamed from stdio/getline.c)0
-rw-r--r--stdio-common/getw.c (renamed from stdio/getw.c)0
-rw-r--r--stdio-common/perror.c (renamed from stdio/perror.c)0
-rw-r--r--stdio-common/printf-parse.h (renamed from stdio/printf-parse.h)0
-rw-r--r--stdio-common/printf-prs.c (renamed from stdio/printf-prs.c)0
-rw-r--r--stdio-common/printf.c (renamed from stdio/printf.c)15
-rw-r--r--stdio-common/printf.h (renamed from stdio/printf.h)0
-rw-r--r--stdio-common/printf_fp.c (renamed from stdio/printf_fp.c)0
-rw-r--r--stdio-common/psignal.c (renamed from stdio/psignal.c)0
-rw-r--r--stdio-common/putw.c (renamed from stdio/putw.c)0
-rw-r--r--stdio-common/reg-printf.c (renamed from stdio/reg-printf.c)0
-rw-r--r--stdio-common/scanf.c (renamed from stdio/scanf.c)15
-rw-r--r--stdio-common/snprintf.c (renamed from stdio/snprintf.c)18
-rw-r--r--stdio-common/sprintf.c (renamed from stdio/sprintf.c)16
-rw-r--r--stdio-common/sscanf.c (renamed from stdio/sscanf.c)16
-rw-r--r--stdio-common/tempnam.c (renamed from stdio/tempnam.c)0
-rw-r--r--stdio-common/temptest.c (renamed from stdio/temptest.c)0
-rw-r--r--stdio-common/test-fseek.c (renamed from stdio/test-fseek.c)0
-rw-r--r--stdio-common/test-fwrite.c (renamed from stdio/test-fwrite.c)0
-rw-r--r--stdio-common/test-popen.c (renamed from stdio/test-popen.c)0
-rw-r--r--stdio-common/test_rdwr.c (renamed from stdio/test_rdwr.c)0
-rw-r--r--stdio-common/tmpfile.c (renamed from stdio/tmpfile.c)0
-rw-r--r--stdio-common/tmpnam.c (renamed from stdio/tmpnam.c)0
-rw-r--r--stdio-common/tst-fileno.c (renamed from stdio/tst-fileno.c)0
-rw-r--r--stdio-common/tst-printf.c (renamed from stdio/tst-printf.c)0
-rw-r--r--stdio-common/tstgetln.c (renamed from stdio/tstgetln.c)0
-rw-r--r--stdio-common/tstgetln.input (renamed from stdio/tstgetln.input)0
-rw-r--r--stdio-common/tstscanf.c (renamed from stdio/tstscanf.c)0
-rw-r--r--stdio-common/tstscanf.input (renamed from stdio/tstscanf.input)0
-rw-r--r--stdio-common/vasprintf.c (renamed from stdio/vasprintf.c)0
-rw-r--r--stdio-common/vdprintf.c (renamed from stdio/vdprintf.c)0
-rw-r--r--stdio-common/vfprintf.c (renamed from stdio/vfprintf.c)0
-rw-r--r--stdio-common/vfscanf.c (renamed from stdio/vfscanf.c)0
-rw-r--r--stdio-common/vprintf.c (renamed from stdio/vprintf.c)10
-rw-r--r--stdio-common/vscanf.c (renamed from stdio/vscanf.c)0
-rw-r--r--stdio-common/vsnprintf.c (renamed from stdio/vsnprintf.c)0
-rw-r--r--stdio-common/vsprintf.c (renamed from stdio/vsprintf.c)0
-rw-r--r--stdio-common/vsscanf.c (renamed from stdio/vsscanf.c)0
-rw-r--r--stdio-common/xbug.c (renamed from stdio/xbug.c)0
-rw-r--r--stdio.h4
-rw-r--r--stdio/Makefile26
-rw-r--r--sysdeps/generic/Makefile4
66 files changed, 235 insertions, 87 deletions
diff --git a/ChangeLog b/ChangeLog
index 610def7e75..5e0887b88a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,80 @@
 Mon Oct 16 03:22:37 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
 
+	* Makefile (subdirs): Replace stdio with stdio-common and $(stdio).
+	* configure.in: Grok arg --enable-libio.
+	($stdio = libio): Define USE_IN_LIBIO.
+	* config.h.in (USE_IN_LIBIO): Add #undef.
+	* config.make.in (stdio): New variable, set by configure.
+	* Makeconfig (stdio): New variable.
+	* stdio.h [USE_IN_LIBIO]: Include libio/stdio.h instead of
+	stdio/stdio.h.
+	* stdio-common/Makefile: New file.
+	* stdio/Makefile: Half the contents moved to stdio-common/Makefile.
+	* stdio/_itoa.c: Moved to stdio-common.
+	* stdio/_itoa.h: Moved to stdio-common.
+	* stdio/asprintf.c: Moved to stdio-common.
+	* stdio/bug1.c: Moved to stdio-common.
+	* stdio/bug1.input: Moved to stdio-common.
+	* stdio/bug2.c: Moved to stdio-common.
+	* stdio/bug3.c: Moved to stdio-common.
+	* stdio/bug4.c: Moved to stdio-common.
+	* stdio/bug5.c: Moved to stdio-common.
+	* stdio/bug6.c: Moved to stdio-common.
+	* stdio/bug6.input: Moved to stdio-common.
+	* stdio/bug7.c: Moved to stdio-common.
+	* stdio/dprintf.c: Moved to stdio-common.
+	* stdio/errnobug.c: Moved to stdio-common.
+	* stdio/getline.c: Moved to stdio-common.
+	* stdio/getw.c: Moved to stdio-common.
+	* stdio/perror.c: Moved to stdio-common.
+	* stdio/printf-parse.h: Moved to stdio-common.
+	* stdio/printf-prs.c: Moved to stdio-common.
+	* stdio/printf.c: Moved to stdio-common.
+	* stdio/printf.h: Moved to stdio-common.
+	* stdio/printf_fp.c: Moved to stdio-common.
+	* stdio/psignal.c: Moved to stdio-common.
+	* stdio/putw.c: Moved to stdio-common.
+	* stdio/reg-printf.c: Moved to stdio-common.
+	* stdio/scanf.c: Moved to stdio-common.
+	* stdio/snprintf.c: Moved to stdio-common.
+	* stdio/sprintf.c: Moved to stdio-common.
+	* stdio/sscanf.c: Moved to stdio-common.
+	* stdio/tempnam.c: Moved to stdio-common.
+	* stdio/temptest.c: Moved to stdio-common.
+	* stdio/test-fseek.c: Moved to stdio-common.
+	* stdio/test-fwrite.c: Moved to stdio-common.
+	* stdio/test-popen.c: Moved to stdio-common.
+	* stdio/test_rdwr.c: Moved to stdio-common.
+	* stdio/tmpfile.c: Moved to stdio-common.
+	* stdio/tmpnam.c: Moved to stdio-common.
+	* stdio/tst-fileno.c: Moved to stdio-common.
+	* stdio/tst-printf.c: Moved to stdio-common.
+	* stdio/tstgetln.c: Moved to stdio-common.
+	* stdio/tstgetln.input: Moved to stdio-common.
+	* stdio/tstscanf.c: Moved to stdio-common.
+	* stdio/tstscanf.input: Moved to stdio-common.
+	* stdio/vfprintf.c: Moved to stdio-common.
+	* stdio/vfscanf.c: Moved to stdio-common.
+	* stdio/vprintf.c: Moved to stdio-common.
+	* stdio/xbug.c: Moved to stdio-common.
+	* sysdeps/generic/Makefile (siglist.c rules): Do this in subdir
+	stdio-common instead of stdio.
+	* sysdeps/unix/Makefile (errlist.c rules): Likewise.
+	* stdio-common/asprintf.c [USE_IN_LIBIO]: Call libio primitive
+	function.
+	* stdio-common/dprintf.c: Likewise.
+	* stdio-common/printf.c: Likewise.
+	* stdio-common/scanf.c: Likewise.
+	* stdio-common/snprintf.c: Likewise.
+	* stdio-common/sprintf.c: Likewise.
+	* stdio-common/sscanf.c: Likewise.
+	* stdio-common/vprintf.c: Likewise.
+
+	* Makerules: Include $(+depfiles) directly instead of generating
+	depend-$(subdir).
+	(depend-$(subdir)): Target removed.
+	(common-clean): Don't remove depend-$(subdir).
+
 	* sysdeps/unix/sysv/linux/Makefile (rtld-installed-name): New variable.
 	(config-LDFLAGS): Variable removed.
 
diff --git a/Makeconfig b/Makeconfig
index d21d7114e0..cbb2db0102 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -114,6 +114,12 @@ export sysdep_dir := $(sysdep_dir)
 ####
 
 
+# Set this to either `stdio' or `libio', to compile in either GNU stdio
+# or GNU libio.
+ifndef stdio
+stdio = stdio
+endif
+
 # Common prefix for machine-independent installation directories.
 ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
 prefix = /usr/local
diff --git a/Makefile b/Makefile
index f3d5e1c2f2..f1aae8ed0b 100644
--- a/Makefile
+++ b/Makefile
@@ -51,10 +51,10 @@ sysdep-subdirs := $(subst $(\n), ,$(sysdep-subdirs))
 endif
 
 # These are the subdirectories containing the library source.
-subdirs := csu assert ctype locale intl math setjmp signal stdio stdlib	\
-	   malloc string time dirent grp pwd posix io termios resource	\
-	   misc socket sysvipc gmon gnulib $(wildcard crypt) manual	\
-	   $(sysdep-subdirs) elf
+subdirs = csu assert ctype locale intl math setjmp signal stdlib	\
+	  stdio-common $(stdio) malloc string time dirent grp pwd	\
+	  posix io termios resource misc socket sysvipc gmon gnulib	\
+	  $(wildcard crypt) manual $(sysdep-subdirs) elf
 export subdirs := $(subdirs)	# Benign, useless in GNU make before 3.63.
 
 # The mach and hurd subdirectories have many generated header files which
diff --git a/Makerules b/Makerules
index 56f8cc89e6..ac1ac39b48 100644
--- a/Makerules
+++ b/Makerules
@@ -301,19 +301,10 @@ endif
 			 $(filter-out $(addsuffix .d,$(omit-deps)),\
 				      $(+depfiles)))
 
-$(objpfx)depend-$(subdir): Makefile
 ifdef +depfiles
-	for file in $(+depfiles:$(objpfx)%=%); do \
-	  echo "include \$$(objpfx)$$file";	\
-	done > $@-tmp
-	mv -f $@-tmp $@
-else
-	cp /dev/null $@
-endif
-
 ifneq ($(no_deps),t)
-# Include the generated dependencies of the sources in this directory.
-include $(objpfx)depend-$(subdir)
+include $(+depfiles)
+endif
 endif
 
 # Maximize efficiency by minimizing the number of rules.
@@ -623,8 +614,7 @@ endef
 
 # Also remove the dependencies and generated source files.
 common-clean: common-mostlyclean
-	-rm -f $(objpfx)depend-$(subdir) $(+depfiles)
-	-rm -f $(addprefix $(objpfx),$(generated))
+	-rm -f $(addprefix $(objpfx),$(generated)) $(+depfiles)
 
 # Produce a file `stub-$(subdir)' which contains `#define __stub_FUNCTION'
 # for each function which is a stub.  We grovel over all the .d files
diff --git a/config.h.in b/config.h.in
index 800fe15720..485f86170f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -30,6 +30,10 @@
 #define HAVE_WEAK_SYMBOLS
 #endif
 #endif
+
+/* Define to use GNU libio instead of GNU stdio.
+   This is defined by configure under --enable-libio.  */
+#undef	USE_IN_LIBIO
 /*  */
 /* These symbols might be defined by some sysdeps configures.  */
 
diff --git a/config.make.in b/config.make.in
index 69d4fcbdea..2af925da48 100644
--- a/config.make.in
+++ b/config.make.in
@@ -24,6 +24,7 @@ gnu-ld = @gnu_ld@
 build-shared = @shared@
 build-profile = @profile@
 build-omitfp = @omitfp@
+stdio = @stdio@
 
 # Build tools.
 CC = @CC@
diff --git a/configure.in b/configure.in
index e7d4ecbb39..239e7fd874 100644
--- a/configure.in
+++ b/configure.in
@@ -40,6 +40,11 @@ AC_ARG_WITH(weak-symbols, dnl
   --with-weak-symbols	  if weak symbols are available in as and ld,
 	    weak=$withval, weak=no)
 
+AC_ARG_ENABLE(libio, dnl
+[  --enable-libio          build in GNU libio instead of GNU stdio],
+ 	      stdio=libio, stdio=stdio)
+AC_SUBST(stdio)
+
 dnl Arguments to enable or disable building the shared, profiled, and
 dnl -fomit-frame-pointer libraries.
 AC_ARG_ENABLE(shared, dnl
@@ -485,6 +490,9 @@ fi
 AC_SUBST(profile)
 AC_SUBST(omitfp)
 
+if test $stdio = libio; then
+  AC_DEFINE(USE_IN_LIBIO)
+fi
 
 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
   config_makefile=
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
new file mode 100644
index 0000000000..6ca6c7d1d3
--- /dev/null
+++ b/stdio-common/Makefile
@@ -0,0 +1,47 @@
+# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library 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.
+
+# The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
+# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+# Cambridge, MA 02139, USA.
+
+#
+#	Specific makefile for stdio-common.
+#
+subdir	:= stdio-common
+
+headers	:= stdio_lim.h printf.h
+
+routines	:=							      \
+	ctermid cuserid							      \
+	vfprintf vprintf printf_fp reg-printf printf-prs _itoa		      \
+	vsnprintf vsprintf vasprintf	      				      \
+	fprintf printf snprintf sprintf asprintf			      \
+	dprintf vdprintf						      \
+	vfscanf vscanf vsscanf						      \
+	fscanf scanf sscanf						      \
+	perror psignal							      \
+	tmpfile tmpnam tempnam tempname					      \
+	getline getw putw						      \
+	remove rename
+aux	:= errlist siglist
+distribute := _itoa.h printf-parse.h
+
+tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \
+	 temptest tst-fileno test-fwrite \
+	 xbug errnobug \
+	 bug1 bug2 bug3 bug4 bug5 bug6 bug7
+
+
+include ../Rules
diff --git a/stdio/_itoa.c b/stdio-common/_itoa.c
index caa8179624..caa8179624 100644
--- a/stdio/_itoa.c
+++ b/stdio-common/_itoa.c
diff --git a/stdio/_itoa.h b/stdio-common/_itoa.h
index ab3d1d1d3a..ab3d1d1d3a 100644
--- a/stdio/_itoa.h
+++ b/stdio-common/_itoa.h
diff --git a/stdio/asprintf.c b/stdio-common/asprintf.c
index 9b69800f73..85ab7b1041 100644
--- a/stdio/asprintf.c
+++ b/stdio-common/asprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,24 +16,27 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <stdarg.h>
 #include <stdio.h>
 
+#ifdef USE_IN_LIBIO
+# define vasprintf _IO_vasprintf
+#endif
 
 /* Write formatted output from FORMAT to a string which is
    allocated with malloc and stored in *STRING_PTR.  */
 /* VARARGS2 */
 int
-DEFUN(asprintf, (string_ptr, format),
-      char **string_ptr AND CONST char *format DOTS)
+asprintf (string_ptr, format)
+     char **string_ptr;
+     const char *format;
 {
   va_list arg;
   int done;
 
-  va_start(arg, format);
-  done = vasprintf(string_ptr, format, arg);
-  va_end(arg);
+  va_start (arg, format);
+  done = vasprintf (string_ptr, format, arg);
+  va_end (arg);
 
   return done;
 }
diff --git a/stdio/bug1.c b/stdio-common/bug1.c
index 755bc4231b..755bc4231b 100644
--- a/stdio/bug1.c
+++ b/stdio-common/bug1.c
diff --git a/stdio/bug1.input b/stdio-common/bug1.input
index 5595fa46c0..5595fa46c0 100644
--- a/stdio/bug1.input
+++ b/stdio-common/bug1.input
diff --git a/stdio/bug2.c b/stdio-common/bug2.c
index 2b34c890bf..2b34c890bf 100644
--- a/stdio/bug2.c
+++ b/stdio-common/bug2.c
diff --git a/stdio/bug3.c b/stdio-common/bug3.c
index 1684720b9f..1684720b9f 100644
--- a/stdio/bug3.c
+++ b/stdio-common/bug3.c
diff --git a/stdio/bug4.c b/stdio-common/bug4.c
index 00abf3c502..00abf3c502 100644
--- a/stdio/bug4.c
+++ b/stdio-common/bug4.c
diff --git a/stdio/bug5.c b/stdio-common/bug5.c
index 18f069ae29..18f069ae29 100644
--- a/stdio/bug5.c
+++ b/stdio-common/bug5.c
diff --git a/stdio/bug6.c b/stdio-common/bug6.c
index 4a37ab2584..4a37ab2584 100644
--- a/stdio/bug6.c
+++ b/stdio-common/bug6.c
diff --git a/stdio/bug6.input b/stdio-common/bug6.input
index d996e399c3..d996e399c3 100644
--- a/stdio/bug6.input
+++ b/stdio-common/bug6.input
diff --git a/stdio/bug7.c b/stdio-common/bug7.c
index af06f8d6a5..af06f8d6a5 100644
--- a/stdio/bug7.c
+++ b/stdio-common/bug7.c
diff --git a/stdio/dprintf.c b/stdio-common/dprintf.c
index fc9faa4ca2..5746d49841 100644
--- a/stdio/dprintf.c
+++ b/stdio-common/dprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,22 +16,26 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <stdarg.h>
 #include <stdio.h>
 
+#ifdef USE_IN_LIBIO
+# define vdprintf _IO_vdprintf
+#endif
 
 /* Write formatted output to D, according to the format string FORMAT.  */
 /* VARARGS2 */
 int
-DEFUN(dprintf, (d, format), int d AND CONST char *format DOTS)
+dprintf (d, format)
+     int d;
+     const char *format;
 {
   va_list arg;
   int done;
 
-  va_start(arg, format);
-  done = vdprintf(d, format, arg);
-  va_end(arg);
+  va_start (arg, format);
+  done = vdprintf (d, format, arg);
+  va_end (arg);
 
   return done;
 }
diff --git a/stdio/errnobug.c b/stdio-common/errnobug.c
index cf17be30a2..cf17be30a2 100644
--- a/stdio/errnobug.c
+++ b/stdio-common/errnobug.c
diff --git a/stdio/fprintf.c b/stdio-common/fprintf.c
index bc6d1003b7..bc6d1003b7 100644
--- a/stdio/fprintf.c
+++ b/stdio-common/fprintf.c
diff --git a/stdio/fscanf.c b/stdio-common/fscanf.c
index cbe0103368..cbe0103368 100644
--- a/stdio/fscanf.c
+++ b/stdio-common/fscanf.c
diff --git a/stdio/getline.c b/stdio-common/getline.c
index 1a2f975c75..1a2f975c75 100644
--- a/stdio/getline.c
+++ b/stdio-common/getline.c
diff --git a/stdio/getw.c b/stdio-common/getw.c
index 45d4d8875d..45d4d8875d 100644
--- a/stdio/getw.c
+++ b/stdio-common/getw.c
diff --git a/stdio/perror.c b/stdio-common/perror.c
index 1054acaa7d..1054acaa7d 100644
--- a/stdio/perror.c
+++ b/stdio-common/perror.c
diff --git a/stdio/printf-parse.h b/stdio-common/printf-parse.h
index 0f6e9e287b..0f6e9e287b 100644
--- a/stdio/printf-parse.h
+++ b/stdio-common/printf-parse.h
diff --git a/stdio/printf-prs.c b/stdio-common/printf-prs.c
index 811a9cb7eb..811a9cb7eb 100644
--- a/stdio/printf-prs.c
+++ b/stdio-common/printf-prs.c
diff --git a/stdio/printf.c b/stdio-common/printf.c
index 9cdae768ae..d8aa895a77 100644
--- a/stdio/printf.c
+++ b/stdio-common/printf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,22 +16,25 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <stdarg.h>
 #include <stdio.h>
 
+#ifdef USE_IN_LIBIO
+# define vprintf _IO_vprintf
+#endif
 
 /* Write formatted output to stdout from the format string FORMAT.  */
 /* VARARGS1 */
 int
-DEFUN(printf, (format), CONST char *format DOTS)
+printf (format)
+     const char *format;
 {
   va_list arg;
   int done;
 
-  va_start(arg, format);
-  done = vprintf(format, arg);
-  va_end(arg);
+  va_start (arg, format);
+  done = vprintf (format, arg);
+  va_end (arg);
 
   return done;
 }
diff --git a/stdio/printf.h b/stdio-common/printf.h
index 0f381c77f4..0f381c77f4 100644
--- a/stdio/printf.h
+++ b/stdio-common/printf.h
diff --git a/stdio/printf_fp.c b/stdio-common/printf_fp.c
index 28d13d61b8..28d13d61b8 100644
--- a/stdio/printf_fp.c
+++ b/stdio-common/printf_fp.c
diff --git a/stdio/psignal.c b/stdio-common/psignal.c
index 8997a2ecdf..8997a2ecdf 100644
--- a/stdio/psignal.c
+++ b/stdio-common/psignal.c
diff --git a/stdio/putw.c b/stdio-common/putw.c
index 1b70baeeaf..1b70baeeaf 100644
--- a/stdio/putw.c
+++ b/stdio-common/putw.c
diff --git a/stdio/reg-printf.c b/stdio-common/reg-printf.c
index 95d7a1f3c9..95d7a1f3c9 100644
--- a/stdio/reg-printf.c
+++ b/stdio-common/reg-printf.c
diff --git a/stdio/scanf.c b/stdio-common/scanf.c
index aa7021526f..cf43363958 100644
--- a/stdio/scanf.c
+++ b/stdio-common/scanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,22 +16,25 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <stdarg.h>
 #include <stdio.h>
 
+#ifdef USE_IN_LIBIO
+# define vscanf _IO_vscanf
+#endif
 
 /* Read formatted input from stdin according to the format string FORMAT.  */
 /* VARARGS1 */
 int
-DEFUN(scanf, (format), CONST char *format DOTS)
+scanf (format)
+     const char *format;
 {
   va_list arg;
   int done;
 
-  va_start(arg, format);
-  done = vscanf(format, arg);
-  va_end(arg);
+  va_start (arg, format);
+  done = vscanf (format, arg);
+  va_end (arg);
 
   return done;
 }
diff --git a/stdio/snprintf.c b/stdio-common/snprintf.c
index 9f3e0c4868..00b85f3175 100644
--- a/stdio/snprintf.c
+++ b/stdio-common/snprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,24 +16,28 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <stdarg.h>
 #include <stdio.h>
 
+#ifdef USE_IN_LIBIO
+# define vsnprintf _IO_vsnprintf
+#endif
 
 /* Write formatted output into S, according to the format
    string FORMAT, writing no more than MAXLEN characters.  */
 /* VARARGS3 */
 int
-DEFUN(snprintf, (s, maxlen, format),
-      char *s AND size_t maxlen AND CONST char *format DOTS)
+snprintf (s, maxlen, format)
+      char *s;
+      size_t maxlen;
+      const char *format;
 {
   va_list arg;
   int done;
 
-  va_start(arg, format);
-  done = vsnprintf(s, maxlen, format, arg);
-  va_end(arg);
+  va_start (arg, format);
+  done = vsnprintf (s, maxlen, format, arg);
+  va_end (arg);
 
   return done;
 }
diff --git a/stdio/sprintf.c b/stdio-common/sprintf.c
index ce3a970074..9cfc89cb84 100644
--- a/stdio/sprintf.c
+++ b/stdio-common/sprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,22 +16,26 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <stdarg.h>
 #include <stdio.h>
 
+#ifdef USE_IN_LIBIO
+# define vsprintf _IO_vsprintf
+#endif
 
 /* Write formatted output into S, according to the format string FORMAT.  */
 /* VARARGS2 */
 int
-DEFUN(sprintf, (s, format), char *s AND CONST char *format DOTS)
+sprintf (s, format)
+     char *s;
+     const char *format;
 {
   va_list arg;
   int done;
 
-  va_start(arg, format);
-  done = vsprintf(s, format, arg);
-  va_end(arg);
+  va_start (arg, format);
+  done = vsprintf (s, format, arg);
+  va_end (arg);
 
   return done;
 }
diff --git a/stdio/sscanf.c b/stdio-common/sscanf.c
index 33bc203577..794a3ce628 100644
--- a/stdio/sscanf.c
+++ b/stdio-common/sscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,22 +16,26 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <stdarg.h>
 #include <stdio.h>
 
+#ifdef USE_IN_LIBIO
+# define __vsscanf _IO_vsscanf
+#endif
 
 /* Read formatted input from S, according to the format string FORMAT.  */
 /* VARARGS2 */
 int
-DEFUN(sscanf, (s, format), CONST char *s AND CONST char *format DOTS)
+sscanf (s, format)
+     const char *s;
+     const char *format;
 {
   va_list arg;
   int done;
 
-  va_start(arg, format);
-  done = __vsscanf(s, format, arg);
-  va_end(arg);
+  va_start (arg, format);
+  done = __vsscanf (s, format, arg);
+  va_end (arg);
 
   return done;
 }
diff --git a/stdio/tempnam.c b/stdio-common/tempnam.c
index 14988a8656..14988a8656 100644
--- a/stdio/tempnam.c
+++ b/stdio-common/tempnam.c
diff --git a/stdio/temptest.c b/stdio-common/temptest.c
index 374719896a..374719896a 100644
--- a/stdio/temptest.c
+++ b/stdio-common/temptest.c
diff --git a/stdio/test-fseek.c b/stdio-common/test-fseek.c
index d56c669a54..d56c669a54 100644
--- a/stdio/test-fseek.c
+++ b/stdio-common/test-fseek.c
diff --git a/stdio/test-fwrite.c b/stdio-common/test-fwrite.c
index cc6cdf038e..cc6cdf038e 100644
--- a/stdio/test-fwrite.c
+++ b/stdio-common/test-fwrite.c
diff --git a/stdio/test-popen.c b/stdio-common/test-popen.c
index b452f3f63c..b452f3f63c 100644
--- a/stdio/test-popen.c
+++ b/stdio-common/test-popen.c
diff --git a/stdio/test_rdwr.c b/stdio-common/test_rdwr.c
index f987f16cd4..f987f16cd4 100644
--- a/stdio/test_rdwr.c
+++ b/stdio-common/test_rdwr.c
diff --git a/stdio/tmpfile.c b/stdio-common/tmpfile.c
index dfe11ada50..dfe11ada50 100644
--- a/stdio/tmpfile.c
+++ b/stdio-common/tmpfile.c
diff --git a/stdio/tmpnam.c b/stdio-common/tmpnam.c
index 88dd0a4ca5..88dd0a4ca5 100644
--- a/stdio/tmpnam.c
+++ b/stdio-common/tmpnam.c
diff --git a/stdio/tst-fileno.c b/stdio-common/tst-fileno.c
index 81945f7b44..81945f7b44 100644
--- a/stdio/tst-fileno.c
+++ b/stdio-common/tst-fileno.c
diff --git a/stdio/tst-printf.c b/stdio-common/tst-printf.c
index c177da18b2..c177da18b2 100644
--- a/stdio/tst-printf.c
+++ b/stdio-common/tst-printf.c
diff --git a/stdio/tstgetln.c b/stdio-common/tstgetln.c
index ea8ea817da..ea8ea817da 100644
--- a/stdio/tstgetln.c
+++ b/stdio-common/tstgetln.c
diff --git a/stdio/tstgetln.input b/stdio-common/tstgetln.input
index d04ed5bf78..d04ed5bf78 100644
--- a/stdio/tstgetln.input
+++ b/stdio-common/tstgetln.input
diff --git a/stdio/tstscanf.c b/stdio-common/tstscanf.c
index 53d4b0ac47..53d4b0ac47 100644
--- a/stdio/tstscanf.c
+++ b/stdio-common/tstscanf.c
diff --git a/stdio/tstscanf.input b/stdio-common/tstscanf.input
index 26158652dd..26158652dd 100644
--- a/stdio/tstscanf.input
+++ b/stdio-common/tstscanf.input
diff --git a/stdio/vasprintf.c b/stdio-common/vasprintf.c
index d2ad6b1da6..d2ad6b1da6 100644
--- a/stdio/vasprintf.c
+++ b/stdio-common/vasprintf.c
diff --git a/stdio/vdprintf.c b/stdio-common/vdprintf.c
index 9df4e537bc..9df4e537bc 100644
--- a/stdio/vdprintf.c
+++ b/stdio-common/vdprintf.c
diff --git a/stdio/vfprintf.c b/stdio-common/vfprintf.c
index 63a5148463..63a5148463 100644
--- a/stdio/vfprintf.c
+++ b/stdio-common/vfprintf.c
diff --git a/stdio/vfscanf.c b/stdio-common/vfscanf.c
index a778346287..a778346287 100644
--- a/stdio/vfscanf.c
+++ b/stdio-common/vfscanf.c
diff --git a/stdio/vprintf.c b/stdio-common/vprintf.c
index 97264f475c..77f1da47e2 100644
--- a/stdio/vprintf.c
+++ b/stdio-common/vprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,18 +16,22 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <stdarg.h>
 #undef	__OPTIMIZE__	/* Avoid inline `vprintf' function.  */
 #include <stdio.h>
 
 #undef	vprintf
 
+#ifdef USE_IN_LIBIO
+# define vfprintf _IO_vfprintf
+#endif
 
 /* Write formatted output to stdout according to the
    format string FORMAT, using the argument list in ARG.  */
 int
-DEFUN(vprintf, (format, arg), CONST char *format AND __gnuc_va_list arg)
+vprintf (format, arg)
+     const char *format;
+     __gnuc_va_list arg;
 {
   return vfprintf (stdout, format, arg);
 }
diff --git a/stdio/vscanf.c b/stdio-common/vscanf.c
index 0d829440e9..0d829440e9 100644
--- a/stdio/vscanf.c
+++ b/stdio-common/vscanf.c
diff --git a/stdio/vsnprintf.c b/stdio-common/vsnprintf.c
index a02c259131..a02c259131 100644
--- a/stdio/vsnprintf.c
+++ b/stdio-common/vsnprintf.c
diff --git a/stdio/vsprintf.c b/stdio-common/vsprintf.c
index 82be90f1fa..82be90f1fa 100644
--- a/stdio/vsprintf.c
+++ b/stdio-common/vsprintf.c
diff --git a/stdio/vsscanf.c b/stdio-common/vsscanf.c
index 6f027d5065..6f027d5065 100644
--- a/stdio/vsscanf.c
+++ b/stdio-common/vsscanf.c
diff --git a/stdio/xbug.c b/stdio-common/xbug.c
index ec648f5566..ec648f5566 100644
--- a/stdio/xbug.c
+++ b/stdio-common/xbug.c
diff --git a/stdio.h b/stdio.h
index a82be070c3..457eabe32f 100644
--- a/stdio.h
+++ b/stdio.h
@@ -1 +1,5 @@
+#ifdef USE_IN_LIBIO
+#include <libio/stdio.h>
+#else
 #include <stdio/stdio.h>
+#endif
diff --git a/stdio/Makefile b/stdio/Makefile
index 955d7f1fcd..a15aa56aff 100644
--- a/stdio/Makefile
+++ b/stdio/Makefile
@@ -21,39 +21,23 @@
 #
 subdir	:= stdio
 
-headers	:= stdio.h stdio_lim.h printf.h
+headers	:= stdio.h
 
 routines	:=							      \
-	ctermid cuserid							      \
 	feof ferror clearerr fileno					      \
 	newstream fopen freopen fdopen fopncook fmemopen		      \
 	setbuf setvbuf setbuffer setlinebuf				      \
 	fseek ftell rewind fgetpos fsetpos				      \
-	vfprintf vprintf printf_fp reg-printf printf-prs _itoa		      \
-	vsnprintf vsprintf vasprintf	      				      \
-	fprintf printf snprintf sprintf asprintf			      \
-	dprintf vdprintf						      \
-	vfscanf vscanf vsscanf						      \
-	fscanf scanf sscanf						      \
 	fread fwrite							      \
 	ungetc								      \
-	fgetc getc getchar getw						      \
-	fputc putc putchar putw						      \
+	fgetc getc getchar						      \
+	fputc putc putchar						      \
 	fgets gets fputs puts						      \
-	getdelim getline						      \
-	perror psignal							      \
-	tmpfile tmpnam tempnam tempname					      \
+	getdelim							      \
 	fclose fflush							      \
-	remove rename							      \
 	memstream obstream						      \
 	internals sysd-stdio pipestream stdio_init libc_fatal
-aux	:= errlist siglist defs glue
-distribute := _itoa.h printf-parse.h
-
-tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \
-	 temptest tst-fileno test-fwrite \
-	 xbug errnobug \
-	 bug1 bug2 bug3 bug4 bug5 bug6 bug7
+aux	:= defs glue
 
 
 include ../Rules
diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile
index b80b073d0c..1315a26b95 100644
--- a/sysdeps/generic/Makefile
+++ b/sysdeps/generic/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -42,7 +42,7 @@ common-generated := $(common-generated) bytesex.h det_endian
 
 endif
 
-ifeq ($(subdir),stdio)
+ifeq ($(subdir),stdio-common)
 
 ifeq	"$(filter $(objpfx)siglist.c,$(before-compile))" ""
 before-compile := $(before-compile) $(objpfx)siglist.c