aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makeconfig8
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure281
-rw-r--r--configure.in18
-rw-r--r--stdio/.cvsignore8
-rw-r--r--stdio/Makefile46
-rw-r--r--stdio/Versions70
-rw-r--r--stdio/__fbufsize.c25
-rw-r--r--stdio/__flbf.c25
-rw-r--r--stdio/__fpending.c25
-rw-r--r--stdio/__fpurge.c25
-rw-r--r--stdio/__freadable.c25
-rw-r--r--stdio/__freading.c26
-rw-r--r--stdio/__fsetlocking.c41
-rw-r--r--stdio/__fwritable.c25
-rw-r--r--stdio/__fwriting.c26
-rw-r--r--stdio/clearerr.c32
-rw-r--r--stdio/fclose.c60
-rw-r--r--stdio/fcloseall.c37
-rw-r--r--stdio/feof.c39
-rw-r--r--stdio/ferror.c40
-rw-r--r--stdio/fflush.c47
-rw-r--r--stdio/fgetc.c35
-rw-r--r--stdio/fgetpos.c41
-rw-r--r--stdio/fgets.c125
-rw-r--r--stdio/fileno.c50
-rw-r--r--stdio/fmemopen.c109
-rw-r--r--stdio/fopen.c112
-rw-r--r--stdio/fopncook.c49
-rw-r--r--stdio/fputc.c40
-rw-r--r--stdio/fputs.c35
-rw-r--r--stdio/fread.c135
-rw-r--r--stdio/freopen.c75
-rw-r--r--stdio/fseek.c179
-rw-r--r--stdio/fsetpos.c38
-rw-r--r--stdio/ftell.c54
-rw-r--r--stdio/fwrite.c222
-rw-r--r--stdio/getc.c6
-rw-r--r--stdio/getchar.c31
-rw-r--r--stdio/getdelim.c177
-rw-r--r--stdio/gets.c59
-rw-r--r--stdio/glue.c112
-rw-r--r--stdio/internals.c688
-rw-r--r--stdio/linewrap.c521
-rw-r--r--stdio/linewrap.h200
-rw-r--r--stdio/memstream.c176
-rw-r--r--stdio/newstream.c53
-rw-r--r--stdio/obstream.c185
-rw-r--r--stdio/putc.c6
-rw-r--r--stdio/putchar.c31
-rw-r--r--stdio/puts.c31
-rw-r--r--stdio/rewind.c32
-rw-r--r--stdio/setbuf.c29
-rw-r--r--stdio/setbuffer.c29
-rw-r--r--stdio/setlinebuf.c28
-rw-r--r--stdio/setvbuf.c88
-rw-r--r--stdio/stdio.h832
-rw-r--r--stdio/ungetc.c59
-rw-r--r--stdio/vasprintf.c85
-rw-r--r--stdio/vscanf.c32
-rw-r--r--stdio/vsnprintf.c59
-rw-r--r--stdio/vsprintf.c51
-rw-r--r--stdio/vsscanf.c59
-rw-r--r--sysdeps/generic/defs.c47
-rw-r--r--sysdeps/generic/fdopen.c34
-rw-r--r--sysdeps/generic/pipestream.c60
-rw-r--r--sysdeps/generic/stdio_init.c30
-rw-r--r--sysdeps/generic/sysd-stdio.c191
-rw-r--r--sysdeps/generic/vdprintf.c33
-rwxr-xr-xsysdeps/mach/hurd/configure13
-rw-r--r--sysdeps/mach/hurd/configure.in9
-rw-r--r--sysdeps/mach/hurd/defs.c87
-rw-r--r--sysdeps/mach/hurd/fdopen.c72
-rw-r--r--sysdeps/mach/hurd/pipestream.c2
-rw-r--r--sysdeps/mach/hurd/stdio_init.c62
-rw-r--r--sysdeps/mach/hurd/sysd-stdio.c257
-rw-r--r--sysdeps/mach/hurd/vdprintf.c57
-rw-r--r--sysdeps/posix/defs.c74
-rw-r--r--sysdeps/posix/fdopen.c75
-rw-r--r--sysdeps/posix/pipestream.c221
-rw-r--r--sysdeps/posix/stdio_init.c69
-rw-r--r--sysdeps/posix/vdprintf.c49
-rw-r--r--sysdeps/unix/pipestream.c2
-rw-r--r--sysdeps/unix/sysv/linux/configure.in3
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/pipestream.c3
-rw-r--r--sysdeps/unix/sysv/sysd-stdio.c2
-rw-r--r--sysdeps/unix/sysv/sysv4/pipestream.c2
87 files changed, 142 insertions, 7200 deletions
diff --git a/Makeconfig b/Makeconfig
index 2d2f727d85..ce2d16dcc5 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -139,10 +139,10 @@ endif
####
-# Set this to either `stdio' or `libio', to compile in either GNU stdio
-# or GNU libio.
+# Set this to the name of the subdirectory that implements stdio.
+# The only option right now is `libio'.
ifndef stdio
-stdio = stdio
+stdio = libio
endif
# Common prefix for machine-independent installation directories.
@@ -762,6 +762,7 @@ $(common-objpfx)shlib-versions.v.i: \
$(add-ons) \
$(subdirs)))
$(common-objpfx)soversions.i: $(common-objpfx)shlib-versions.v
+ default_setname='$(filter-out %_default,$(oldest-abi:%=GLIBC_%))'; \
while read conf version setname; do \
test -n "$$version" && \
test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \
@@ -769,6 +770,7 @@ $(common-objpfx)soversions.i: $(common-objpfx)shlib-versions.v
if test "x$$version" = xDEFAULT; then \
default_setname="$$setname"; \
else \
+ $(abi-default_setname) \
lib=`echo $$version | sed 's/=.*$$//'`; \
if eval test -z "\$${versioned_$${lib}}"; then \
eval versioned_$${lib}=yes; \
diff --git a/config.make.in b/config.make.in
index edd47a51bc..ae756afd58 100644
--- a/config.make.in
+++ b/config.make.in
@@ -75,7 +75,6 @@ build-profile = @profile@
build-omitfp = @omitfp@
build-bounded = @bounded@
build-static-nss = @static_nss@
-stdio = @stdio@
add-ons = @subdirs@
cross-compiling = @cross_compiling@
force-install = @force_install@
diff --git a/configure b/configure
index 7388206f06..bb663a7983 100755
--- a/configure
+++ b/configure
@@ -45,8 +45,6 @@ ac_help="$ac_help
[e.g. /usr/src/linux/include]
[default=compiler default]"
ac_help="$ac_help
- --enable-libio build in GNU libio instead of GNU stdio"
-ac_help="$ac_help
--disable-sanity-checks really do not use threads (should not be used
except in special situations) [default=yes]"
ac_help="$ac_help
@@ -734,19 +732,6 @@ else
fi
-# Check whether --enable-libio or --disable-libio was given.
-if test "${enable_libio+set}" = set; then
- enableval="$enable_libio"
- if test $enableval = yes; then
- stdio=libio
- else
- stdio=stdio
- fi
-else
- stdio=default
-fi
-
-
# Check whether --enable-sanity-checks or --disable-sanity-checks was given.
if test "${enable_sanity_checks+set}" = set; then
enableval="$enable_sanity_checks"
@@ -922,7 +907,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:926: checking host system type" >&5
+echo "configure:911: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -1070,7 +1055,7 @@ fi
# This can take a while to compute.
sysdep_dir=$srcdir/sysdeps
echo $ac_n "checking sysdep dirs""... $ac_c" 1>&6
-echo "configure:1074: checking sysdep dirs" >&5
+echo "configure:1059: checking sysdep dirs" >&5
# Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
@@ -1293,7 +1278,7 @@ echo "$ac_t""$default_sysnames" 1>&6
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1297: checking for a BSD compatible install" >&5
+echo "configure:1282: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1350,7 +1335,7 @@ if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
INSTALL='\$(..)./scripts/install-sh -c'
fi
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1354: checking whether ln -s works" >&5
+echo "configure:1339: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1379,7 +1364,7 @@ fi
# Extract the first word of "pwd", so it can be a program name with args.
set dummy pwd; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1383: checking for $ac_word" >&5
+echo "configure:1368: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PWD_P'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1418,7 +1403,7 @@ fi
# These programs are version sensitive.
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1422: checking build system type" >&5
+echo "configure:1407: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -1446,7 +1431,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1450: checking for $ac_word" >&5
+echo "configure:1435: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1480,7 +1465,7 @@ if test -z "$CC"; then
else
# Found it, now check the version.
echo $ac_n "checking version of $CC""... $ac_c" 1>&6
-echo "configure:1484: checking version of $CC" >&5
+echo "configure:1469: checking version of $CC" >&5
ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustpi-]*[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
@@ -1500,7 +1485,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1504: checking for $ac_word" >&5
+echo "configure:1489: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MAKE'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1534,7 +1519,7 @@ if test -z "$MAKE"; then
else
# Found it, now check the version.
echo $ac_n "checking version of $MAKE""... $ac_c" 1>&6
-echo "configure:1538: checking version of $MAKE" >&5
+echo "configure:1523: checking version of $MAKE" >&5
ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
@@ -1563,7 +1548,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1567: checking for $ac_word" >&5
+echo "configure:1552: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1597,7 +1582,7 @@ if test -z "$MSGFMT"; then
else
# Found it, now check the version.
echo $ac_n "checking version of $MSGFMT""... $ac_c" 1>&6
-echo "configure:1601: checking version of $MSGFMT" >&5
+echo "configure:1586: checking version of $MSGFMT" >&5
ac_prog_version=`$MSGFMT --version 2>&1 | sed -n 's/^.*GNU gettext.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
@@ -1617,7 +1602,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1621: checking for $ac_word" >&5
+echo "configure:1606: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1651,7 +1636,7 @@ if test -z "$MAKEINFO"; then
else
# Found it, now check the version.
echo $ac_n "checking version of $MAKEINFO""... $ac_c" 1>&6
-echo "configure:1655: checking version of $MAKEINFO" >&5
+echo "configure:1640: checking version of $MAKEINFO" >&5
ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
@@ -1671,7 +1656,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1675: checking for $ac_word" >&5
+echo "configure:1660: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_SED'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1705,7 +1690,7 @@ if test -z "$SED"; then
else
# Found it, now check the version.
echo $ac_n "checking version of $SED""... $ac_c" 1>&6
-echo "configure:1709: checking version of $SED" >&5
+echo "configure:1694: checking version of $SED" >&5
ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed version \([0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
@@ -1723,7 +1708,7 @@ fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1727: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1712: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1737,12 +1722,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 1741 "configure"
+#line 1726 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:1746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -1773,7 +1758,7 @@ else
cross_linkable=yes
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1777: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1762: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_cross'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1785,7 +1770,7 @@ echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1789: checking whether we are using GNU C" >&5
+echo "configure:1774: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1794,7 +1779,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1798: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1783: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -1807,7 +1792,7 @@ if test $ac_cv_prog_gcc != yes; then
fi
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1811: checking build system type" >&5
+echo "configure:1796: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -1830,7 +1815,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1834: checking for $ac_word" >&5
+echo "configure:1819: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_BUILD_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1862,7 +1847,7 @@ done
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1866: checking how to run the C preprocessor" >&5
+echo "configure:1851: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1877,13 +1862,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1881 "configure"
+#line 1866 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1887: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1872: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1894,13 +1879,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1898 "configure"
+#line 1883 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1904: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1889: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1911,13 +1896,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1915 "configure"
+#line 1900 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1921: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1906: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1960,7 +1945,7 @@ if test $RANLIB = ranlib; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1964: checking for $ac_word" >&5
+echo "configure:1949: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1992,7 +1977,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1996: checking for $ac_word" >&5
+echo "configure:1981: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2029,7 +2014,7 @@ fi
# Determine whether we are using GNU binutils.
echo $ac_n "checking whether $AS is GNU as""... $ac_c" 1>&6
-echo "configure:2033: checking whether $AS is GNU as" >&5
+echo "configure:2018: checking whether $AS is GNU as" >&5
if eval "test \"`echo '$''{'libc_cv_prog_as_gnu'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2048,7 +2033,7 @@ rm -f a.out
gnu_as=$libc_cv_prog_as_gnu
echo $ac_n "checking whether $LD is GNU ld""... $ac_c" 1>&6
-echo "configure:2052: checking whether $LD is GNU ld" >&5
+echo "configure:2037: checking whether $LD is GNU ld" >&5
if eval "test \"`echo '$''{'libc_cv_prog_ld_gnu'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2068,7 +2053,7 @@ gnu_ld=$libc_cv_prog_ld_gnu
# Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args.
set dummy ${ac_tool_prefix}mig; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2072: checking for $ac_word" >&5
+echo "configure:2057: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2125,7 +2110,7 @@ fi
# check if ranlib is necessary
echo $ac_n "checking whether ranlib is necessary""... $ac_c" 1>&6
-echo "configure:2129: checking whether ranlib is necessary" >&5
+echo "configure:2114: checking whether ranlib is necessary" >&5
if eval "test \"`echo '$''{'libc_cv_ranlib_necessary'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2159,7 +2144,7 @@ fi
# - two terminals occur directly after each other
# - the path contains an element with a dot in it
echo $ac_n "checking LD_LIBRARY_PATH variable""... $ac_c" 1>&6
-echo "configure:2163: checking LD_LIBRARY_PATH variable" >&5
+echo "configure:2148: checking LD_LIBRARY_PATH variable" >&5
case ${LD_LIBRARY_PATH} in
[:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
ld_library_path_setting="contains current directory"
@@ -2177,7 +2162,7 @@ if test "$ld_library_path_setting" != "ok"; then
fi
echo $ac_n "checking whether GCC supports -static-libgcc""... $ac_c" 1>&6
-echo "configure:2181: checking whether GCC supports -static-libgcc" >&5
+echo "configure:2166: checking whether GCC supports -static-libgcc" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_static_libgcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2194,7 +2179,7 @@ echo "$ac_t""$libc_cv_gcc_static_libgcc" 1>&6
# Extract the first word of "bash", so it can be a program name with args.
set dummy bash; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2198: checking for $ac_word" >&5
+echo "configure:2183: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_BASH'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2240,7 +2225,7 @@ if test "$BASH" = no; then
# Extract the first word of "ksh", so it can be a program name with args.
set dummy ksh; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2244: checking for $ac_word" >&5
+echo "configure:2229: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2285,12 +2270,12 @@ else
fi
-for ac_prog in mawk gawk nawk awk
+for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2294: checking for $ac_word" >&5
+echo "configure:2279: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2322,7 +2307,7 @@ done
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2326: checking for $ac_word" >&5
+echo "configure:2311: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2362,7 +2347,7 @@ fi
# Extract the first word of "install-info", so it can be a program name with args.
set dummy install-info; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2366: checking for $ac_word" >&5
+echo "configure:2351: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_INSTALL_INFO'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2397,7 +2382,7 @@ fi
if test "$INSTALL_INFO" != "no"; then
echo $ac_n "checking for old Debian install-info""... $ac_c" 1>&6
-echo "configure:2401: checking for old Debian install-info" >&5
+echo "configure:2386: checking for old Debian install-info" >&5
if eval "test \"`echo '$''{'libc_cv_old_debian_install_info'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2432,7 +2417,7 @@ fi
# Extract the first word of "bison", so it can be a program name with args.
set dummy bison; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2436: checking for $ac_word" >&5
+echo "configure:2421: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_BISON'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2467,7 +2452,7 @@ fi
echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
-echo "configure:2471: checking for signed size_t type" >&5
+echo "configure:2456: checking for signed size_t type" >&5
if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2491,12 +2476,12 @@ EOF
fi
echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6
-echo "configure:2495: checking for libc-friendly stddef.h" >&5
+echo "configure:2480: checking for libc-friendly stddef.h" >&5
if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2500 "configure"
+#line 2485 "configure"
#include "confdefs.h"
#define __need_size_t
#define __need_wchar_t
@@ -2511,7 +2496,7 @@ size_t size; wchar_t wchar;
if (&size == NULL || &wchar == NULL) abort ();
; return 0; }
EOF
-if { (eval echo configure:2515: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_friendly_stddef=yes
else
@@ -2530,7 +2515,7 @@ override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
fi
echo $ac_n "checking whether we need to use -P to assemble .S files""... $ac_c" 1>&6
-echo "configure:2534: checking whether we need to use -P to assemble .S files" >&5
+echo "configure:2519: checking whether we need to use -P to assemble .S files" >&5
if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2553,7 +2538,7 @@ asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
fi
echo $ac_n "checking whether .text pseudo-op must be used""... $ac_c" 1>&6
-echo "configure:2557: checking whether .text pseudo-op must be used" >&5
+echo "configure:2542: checking whether .text pseudo-op must be used" >&5
if eval "test \"`echo '$''{'libc_cv_dot_text'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2574,7 +2559,7 @@ else
fi
echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6
-echo "configure:2578: checking for assembler global-symbol directive" >&5
+echo "configure:2563: checking for assembler global-symbol directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2604,7 +2589,7 @@ EOF
fi
echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
-echo "configure:2608: checking for .set assembler directive" >&5
+echo "configure:2593: checking for .set assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2647,7 +2632,7 @@ EOF
esac
echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6
-echo "configure:2651: checking for .symver assembler directive" >&5
+echo "configure:2636: checking for .symver assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_symver_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2666,7 +2651,7 @@ fi
echo "$ac_t""$libc_cv_asm_symver_directive" 1>&6
echo $ac_n "checking for ld --version-script""... $ac_c" 1>&6
-echo "configure:2670: checking for ld --version-script" >&5
+echo "configure:2655: checking for ld --version-script" >&5
if eval "test \"`echo '$''{'libc_cv_ld_version_script_option'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2689,7 +2674,7 @@ EOF
if { ac_try='${CC-cc} $CFLAGS -shared -o conftest.so conftest.o
-nostartfiles -nostdlib
-Wl,--version-script,conftest.map
- 1>&5'; { (eval echo configure:2693: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+ 1>&5'; { (eval echo configure:2678: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
then
libc_cv_ld_version_script_option=yes
else
@@ -2728,7 +2713,7 @@ if test $elf = yes && test $shared != no && test $VERSIONING = no; then
fi
if test $elf = yes; then
echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
-echo "configure:2732: checking for .previous assembler directive" >&5
+echo "configure:2717: checking for .previous assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2736,7 +2721,7 @@ else
.section foo_section
.previous
EOF
- if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2740: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_asm_previous_directive=yes
else
libc_cv_asm_previous_directive=no
@@ -2752,7 +2737,7 @@ EOF
else
echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
-echo "configure:2756: checking for .popsection assembler directive" >&5
+echo "configure:2741: checking for .popsection assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2760,7 +2745,7 @@ else
.pushsection foo_section
.popsection
EOF
- if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2764: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_asm_popsection_directive=yes
else
libc_cv_asm_popsection_directive=no
@@ -2777,7 +2762,7 @@ EOF
fi
fi
echo $ac_n "checking for .protected and .hidden assembler directive""... $ac_c" 1>&6
-echo "configure:2781: checking for .protected and .hidden assembler directive" >&5
+echo "configure:2766: checking for .protected and .hidden assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_protected_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2787,7 +2772,7 @@ foo:
.hidden bar
bar:
EOF
- if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2791: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2776: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_asm_protected_directive=yes
else
libc_cv_asm_protected_directive=no
@@ -2804,7 +2789,7 @@ EOF
if test $libc_cv_asm_protected_directive = yes; then
echo $ac_n "checking whether __attribute__((visibility())) is supported""... $ac_c" 1>&6
-echo "configure:2808: checking whether __attribute__((visibility())) is supported" >&5
+echo "configure:2793: checking whether __attribute__((visibility())) is supported" >&5
if eval "test \"`echo '$''{'libc_cv_visibility_attribute'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2835,7 +2820,7 @@ EOF
if test $libc_cv_visibility_attribute = yes -a $gnu_ld = yes; then
echo $ac_n "checking whether to put _rtld_local into .sdata section""... $ac_c" 1>&6
-echo "configure:2839: checking whether to put _rtld_local into .sdata section" >&5
+echo "configure:2824: checking whether to put _rtld_local into .sdata section" >&5
if eval "test \"`echo '$''{'libc_cv_have_sdata_section'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2859,7 +2844,7 @@ EOF
fi
echo $ac_n "checking for .preinit_array/.init_array/.fini_array support""... $ac_c" 1>&6
-echo "configure:2863: checking for .preinit_array/.init_array/.fini_array support" >&5
+echo "configure:2848: checking for .preinit_array/.init_array/.fini_array support" >&5
if eval "test \"`echo '$''{'libc_cv_initfinit_array'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2870,7 +2855,7 @@ int foo (void) { return 1; }
int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
EOF
if { ac_try='${CC-cc} -o conftest conftest.c
- -static -nostartfiles -nostdlib 1>&5'; { (eval echo configure:2874: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
+ -static -nostartfiles -nostdlib 1>&5'; { (eval echo configure:2859: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
then
if readelf -S conftest | fgrep INIT_ARRAY > /dev/null; then
libc_cv_initfinit_array=yes
@@ -2893,7 +2878,7 @@ EOF
fi
echo $ac_n "checking for -z nodelete option""... $ac_c" 1>&6
-echo "configure:2897: checking for -z nodelete option" >&5
+echo "configure:2882: checking for -z nodelete option" >&5
if eval "test \"`echo '$''{'libc_cv_z_nodelete'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2902,7 +2887,7 @@ int _start (void) { return 42; }
EOF
if { ac_try='${CC-cc} -shared -o conftest.so conftest.c
-nostartfiles -nostdlib
- -Wl,--enable-new-dtags,-z,nodelete 1>&5'; { (eval echo configure:2906: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
+ -Wl,--enable-new-dtags,-z,nodelete 1>&5'; { (eval echo configure:2891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
then
libc_cv_z_nodelete=yes
else
@@ -2915,7 +2900,7 @@ echo "$ac_t""$libc_cv_z_nodelete" 1>&6
echo $ac_n "checking for -z nodlopen option""... $ac_c" 1>&6
-echo "configure:2919: checking for -z nodlopen option" >&5
+echo "configure:2904: checking for -z nodlopen option" >&5
if eval "test \"`echo '$''{'libc_cv_z_nodlopen'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2924,7 +2909,7 @@ int _start (void) { return 42; }
EOF
if { ac_try='${CC-cc} -shared -o conftest.so conftest.c
-nostartfiles -nostdlib
- -Wl,--enable-new-dtags,-z,nodlopen 1>&5'; { (eval echo configure:2928: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
+ -Wl,--enable-new-dtags,-z,nodlopen 1>&5'; { (eval echo configure:2913: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
then
libc_cv_z_nodlopen=yes
else
@@ -2937,7 +2922,7 @@ echo "$ac_t""$libc_cv_z_nodlopen" 1>&6
echo $ac_n "checking for -z initfirst option""... $ac_c" 1>&6
-echo "configure:2941: checking for -z initfirst option" >&5
+echo "configure:2926: checking for -z initfirst option" >&5
if eval "test \"`echo '$''{'libc_cv_z_initfirst'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2946,7 +2931,7 @@ int _start (void) { return 42; }
EOF
if { ac_try='${CC-cc} -shared -o conftest.so conftest.c
-nostartfiles -nostdlib
- -Wl,--enable-new-dtags,-z,initfirst 1>&5'; { (eval echo configure:2950: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
+ -Wl,--enable-new-dtags,-z,initfirst 1>&5'; { (eval echo configure:2935: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
then
libc_cv_z_initfirst=yes
else
@@ -2959,14 +2944,14 @@ echo "$ac_t""$libc_cv_z_initfirst" 1>&6
echo $ac_n "checking for -Bgroup option""... $ac_c" 1>&6
-echo "configure:2963: checking for -Bgroup option" >&5
+echo "configure:2948: checking for -Bgroup option" >&5
if eval "test \"`echo '$''{'libc_cv_Bgroup'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
int _start (void) { return 42; }
EOF
- if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -Wl,-Bgroup -nostdlib 1>&5'; { (eval echo configure:2970: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
+ if { ac_try='${CC-cc} -shared -o conftest.so conftest.c -Wl,-Bgroup -nostdlib 1>&5'; { (eval echo configure:2955: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
then
libc_cv_Bgroup=yes
else
@@ -2979,7 +2964,7 @@ echo "$ac_t""$libc_cv_Bgroup" 1>&6
echo $ac_n "checking for -z combreloc""... $ac_c" 1>&6
-echo "configure:2983: checking for -z combreloc" >&5
+echo "configure:2968: checking for -z combreloc" >&5
if eval "test \"`echo '$''{'libc_cv_z_combreloc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2990,7 +2975,7 @@ int foo (void) { return bar (mumble); }
EOF
if { ac_try='${CC-cc} -shared -o conftest.so conftest.c
-nostdlib -nostartfiles
- -Wl,-z,combreloc 1>&5'; { (eval echo configure:2994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
+ -Wl,-z,combreloc 1>&5'; { (eval echo configure:2979: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
then
if readelf -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
libc_cv_z_combreloc=yes
@@ -3015,12 +3000,12 @@ fi
if test $elf != yes; then
echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:3019: checking for .init and .fini sections" >&5
+echo "configure:3004: checking for .init and .fini sections" >&5
if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3024 "configure"
+#line 3009 "configure"
#include "confdefs.h"
int main() {
@@ -3029,7 +3014,7 @@ asm (".section .init");
asm ("${libc_cv_dot_text}");
; return 0; }
EOF
-if { (eval echo configure:3033: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3018: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_have_initfini=yes
else
@@ -3052,7 +3037,7 @@ fi
if test $elf = yes -a $gnu_ld = yes; then
echo $ac_n "checking whether cc puts quotes around section names""... $ac_c" 1>&6
-echo "configure:3056: checking whether cc puts quotes around section names" >&5
+echo "configure:3041: checking whether cc puts quotes around section names" >&5
if eval "test \"`echo '$''{'libc_cv_have_section_quotes'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3089,19 +3074,19 @@ if test $elf = yes; then
else
if test $ac_cv_prog_cc_works = yes; then
echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:3093: checking for _ prefix on C symbol names" >&5
+echo "configure:3078: checking for _ prefix on C symbol names" >&5
if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3098 "configure"
+#line 3083 "configure"
#include "confdefs.h"
asm ("_glibc_foobar:");
int main() {
glibc_foobar ();
; return 0; }
EOF
-if { (eval echo configure:3105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
libc_cv_asm_underscores=yes
else
@@ -3116,17 +3101,17 @@ fi
echo "$ac_t""$libc_cv_asm_underscores" 1>&6
else
echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:3120: checking for _ prefix on C symbol names" >&5
+echo "configure:3105: checking for _ prefix on C symbol names" >&5
if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3125 "configure"
+#line 3110 "configure"
#include "confdefs.h"
void underscore_test(void) {
return; }
EOF
-if { (eval echo configure:3130: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if grep _underscore_test conftest* >/dev/null; then
rm -f conftest*
libc_cv_asm_underscores=yes
@@ -3158,7 +3143,7 @@ if test $elf = yes; then
fi
echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:3162: checking for assembler .weak directive" >&5
+echo "configure:3147: checking for assembler .weak directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3181,7 +3166,7 @@ echo "$ac_t""$libc_cv_asm_weak_directive" 1>&6
if test $libc_cv_asm_weak_directive = no; then
echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6
-echo "configure:3185: checking for assembler .weakext directive" >&5
+echo "configure:3170: checking for assembler .weakext directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3228,14 +3213,14 @@ EOF
;;
hppa*linux*)
echo $ac_n "checking for assembler line separator""... $ac_c" 1>&6
-echo "configure:3232: checking for assembler line separator" >&5
+echo "configure:3217: checking for assembler line separator" >&5
if eval "test \"`echo '$''{'libc_cv_asm_line_sep'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.s <<EOF
nop ; is_old_puffin
EOF
- if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:3239: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:3224: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_asm_line_sep='!'
else
if test -z "$enable_hacker_mode"; then
@@ -3257,7 +3242,7 @@ EOF
esac
echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:3261: checking for ld --no-whole-archive" >&5
+echo "configure:3246: checking for ld --no-whole-archive" >&5
if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3268,7 +3253,7 @@ __throw () {}
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles -Wl,--no-whole-archive
- -o conftest conftest.c 1>&5'; { (eval echo configure:3272: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c 1>&5'; { (eval echo configure:3257: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_ld_no_whole_archive=yes
else
libc_cv_ld_no_whole_archive=no
@@ -3282,7 +3267,7 @@ if test $libc_cv_ld_no_whole_archive = yes; then
fi
echo $ac_n "checking for gcc -fexceptions""... $ac_c" 1>&6
-echo "configure:3286: checking for gcc -fexceptions" >&5
+echo "configure:3271: checking for gcc -fexceptions" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_exceptions'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3293,7 +3278,7 @@ __throw () {}
EOF
if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles -fexceptions
- -o conftest conftest.c 1>&5'; { (eval echo configure:3297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c 1>&5'; { (eval echo configure:3282: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_gcc_exceptions=yes
else
libc_cv_gcc_exceptions=no
@@ -3308,14 +3293,14 @@ fi
if test "$base_machine" = alpha ; then
echo $ac_n "checking for function ..ng prefix""... $ac_c" 1>&6
-echo "configure:3312: checking for function ..ng prefix" >&5
+echo "configure:3297: checking for function ..ng prefix" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_alpha_ng_prefix'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<\EOF
foo () { }
EOF
-if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:3319: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:3304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
then
libc_cv_gcc_alpha_ng_prefix=yes
else
@@ -3342,19 +3327,19 @@ if test "$host_cpu" = powerpc ; then
# Check for a bug present in at least versions 2.8.x of GCC
# and versions 1.0.x of EGCS.
echo $ac_n "checking whether clobbering cr0 causes problems""... $ac_c" 1>&6
-echo "configure:3346: checking whether clobbering cr0 causes problems" >&5
+echo "configure:3331: checking whether clobbering cr0 causes problems" >&5
if eval "test \"`echo '$''{'libc_cv_c_asmcr0_bug'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3351 "configure"
+#line 3336 "configure"
#include "confdefs.h"
int tester(int x) { asm ("" : : : "cc"); return x & 123; }
int main() {
; return 0; }
EOF
-if { (eval echo configure:3358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3343: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libc_cv_c_asmcr0_bug='no'
else
@@ -3376,12 +3361,12 @@ fi
fi
echo $ac_n "checking for DWARF2 unwind info support""... $ac_c" 1>&6
-echo "configure:3380: checking for DWARF2 unwind info support" >&5
+echo "configure:3365: checking for DWARF2 unwind info support" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_dwarf2_unwind_info'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
-#line 3385 "configure"
+#line 3370 "configure"
static char *__EH_FRAME_BEGIN__;
_start ()
{
@@ -3408,14 +3393,14 @@ __bzero () {}
EOF
if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame_info
-nostdlib -nostartfiles
- -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3397: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_gcc_dwarf2_unwind_info=static
else
libc_cv_gcc_dwarf2_unwind_info=no
fi
if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame_info
-nostdlib -nostartfiles
- -o conftest conftest.c -lgcc -lgcc_eh >&5'; { (eval echo configure:3419: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c -lgcc -lgcc_eh >&5'; { (eval echo configure:3404: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
if ${CC-cc} $CFLAGS -DCHECK__register_frame_info -nostdlib -nostartfiles \
-o conftest conftest.c -lgcc -lgcc_eh -v 2>&1 >/dev/null \
| grep -q -- --eh-frame-hdr; then
@@ -3429,7 +3414,7 @@ fi
if test $libc_cv_gcc_dwarf2_unwind_info = no; then
if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame
-nostdlib -nostartfiles
- -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3418: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_gcc_dwarf2_unwind_info=yes
else
libc_cv_gcc_dwarf2_unwind_info=no
@@ -3459,12 +3444,12 @@ EOF
esac
echo $ac_n "checking for __builtin_expect""... $ac_c" 1>&6
-echo "configure:3463: checking for __builtin_expect" >&5
+echo "configure:3448: checking for __builtin_expect" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_builtin_expect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
-#line 3468 "configure"
+#line 3453 "configure"
int foo (int a)
{
a = __builtin_expect (a, 10);
@@ -3472,7 +3457,7 @@ int foo (int a)
}
EOF
if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles
- -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3476: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3461: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_gcc_builtin_expect=yes
else
libc_cv_gcc_builtin_expect=no
@@ -3489,7 +3474,7 @@ EOF
fi
echo $ac_n "checking for __builtin_memset""... $ac_c" 1>&6
-echo "configure:3493: checking for __builtin_memset" >&5
+echo "configure:3478: checking for __builtin_memset" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_builtin_memset'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3499,7 +3484,7 @@ void zero (void *x)
__builtin_memset (x, 0, 1000);
}
EOF
-if { ac_try='${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null'; { (eval echo configure:3503: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+if { ac_try='${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null'; { (eval echo configure:3488: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
then
libc_cv_gcc_builtin_memset=no
else
@@ -3517,12 +3502,12 @@ EOF
fi
echo $ac_n "checking for local label subtraction""... $ac_c" 1>&6
-echo "configure:3521: checking for local label subtraction" >&5
+echo "configure:3506: checking for local label subtraction" >&5
if eval "test \"`echo '$''{'libc_cv_gcc_subtract_local_labels'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
-#line 3526 "configure"
+#line 3511 "configure"
int foo (int a)
{
static const int ar[] = { &&l1 - &&l1, &&l2 - &&l1 };
@@ -3535,7 +3520,7 @@ int foo (int a)
}
EOF
if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles
- -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3539: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+ -o conftest conftest.c -lgcc >&5'; { (eval echo configure:3524: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_gcc_subtract_local_labels=yes
else
libc_cv_gcc_subtract_local_labels=no
@@ -3552,7 +3537,7 @@ EOF
fi
echo $ac_n "checking for libgd""... $ac_c" 1>&6
-echo "configure:3556: checking for libgd" >&5
+echo "configure:3541: checking for libgd" >&5
if test "$with_gd" != "no"; then
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $libgd_include"
@@ -3561,14 +3546,14 @@ if test "$with_gd" != "no"; then
old_LIBS="$LIBS"
LIBS="$LIBS -lgd -lpng -lz -lm"
cat > conftest.$ac_ext <<EOF
-#line 3565 "configure"
+#line 3550 "configure"
#include "confdefs.h"
#include <gd.h>
int main() {
gdImagePng (0, 0)
; return 0; }
EOF
-if { (eval echo configure:3572: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
LIBGD=yes
else
@@ -3588,7 +3573,7 @@ echo "$ac_t""$LIBGD" 1>&6
echo $ac_n "checking size of long double""... $ac_c" 1>&6
-echo "configure:3592: checking size of long double" >&5
+echo "configure:3577: checking size of long double" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3596,18 +3581,18 @@ else
ac_cv_sizeof_long_double=0
else
cat > conftest.$ac_ext <<EOF
-#line 3600 "configure"
+#line 3585 "configure"
#include "confdefs.h"
#include <stdio.h>
-main()
+int main()
{
FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
+ if (!f) return(1);
fprintf(f, "%d\n", sizeof(long double));
- exit(0);
+ return(0);
}
EOF
-if { (eval echo configure:3611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_double=`cat conftestval`
else
@@ -3685,7 +3670,7 @@ if test "$uname" = "sysdeps/generic"; then
fi
echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:3689: checking OS release for uname" >&5
+echo "configure:3674: checking OS release for uname" >&5
if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3707,7 +3692,7 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6
uname_release="$libc_cv_uname_release"
echo $ac_n "checking OS version for uname""... $ac_c" 1>&6
-echo "configure:3711: checking OS version for uname" >&5
+echo "configure:3696: checking OS version for uname" >&5
if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3728,22 +3713,15 @@ else
config_uname=
fi
-echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:3733: checking stdio selection" >&5
-
-case $stdio in
-libio) cat >> confdefs.h <<\EOF
+cat >> confdefs.h <<\EOF
#define USE_IN_LIBIO 1
EOF
- ;;
-default) stdio=stdio ;;
-esac
-echo "$ac_t""$stdio" 1>&6
+
# Test for old glibc 2.0.x headers so that they can be removed properly
# Search only in includedir.
echo $ac_n "checking for old glibc 2.0.x headers""... $ac_c" 1>&6
-echo "configure:3747: checking for old glibc 2.0.x headers" >&5
+echo "configure:3725: checking for old glibc 2.0.x headers" >&5
if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
then
old_glibc_headers=yes
@@ -3804,7 +3782,7 @@ if test $shared = default; then
fi
echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6
-echo "configure:3808: checking whether -fPIC is default" >&5
+echo "configure:3786: checking whether -fPIC is default" >&5
if eval "test \"`echo '$''{'pic_default'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4047,7 +4025,6 @@ s%@libc_cv_gcc_unwind_find_fde@%$libc_cv_gcc_unwind_find_fde%g
s%@uname_sysname@%$uname_sysname%g
s%@uname_release@%$uname_release%g
s%@uname_version@%$uname_version%g
-s%@stdio@%$stdio%g
s%@old_glibc_headers@%$old_glibc_headers%g
s%@libc_cv_slibdir@%$libc_cv_slibdir%g
s%@libc_cv_localedir@%$libc_cv_localedir%g
diff --git a/configure.in b/configure.in
index 4b5deb54a4..3501f858c0 100644
--- a/configure.in
+++ b/configure.in
@@ -86,15 +86,6 @@ AC_ARG_WITH(headers, dnl
[default=compiler default]],
sysheaders=$withval, sysheaders='')
-AC_ARG_ENABLE(libio, dnl
-[ --enable-libio build in GNU libio instead of GNU stdio],
- [if test $enableval = yes; then
- stdio=libio
- else
- stdio=stdio
- fi],
- stdio=default)
-
AC_ARG_ENABLE(sanity-checks, dnl
[ --disable-sanity-checks really do not use threads (should not be used
except in special situations) [default=yes]],
@@ -1646,13 +1637,8 @@ else
config_uname=
fi
-AC_MSG_CHECKING(stdio selection)
-AC_SUBST(stdio)
-case $stdio in
-libio) AC_DEFINE(USE_IN_LIBIO) ;;
-default) stdio=stdio ;;
-esac
-AC_MSG_RESULT($stdio)
+dnl This is tested by existing code and it's simpler to avoid changing it.
+AC_DEFINE(USE_IN_LIBIO)
# Test for old glibc 2.0.x headers so that they can be removed properly
# Search only in includedir.
diff --git a/stdio/.cvsignore b/stdio/.cvsignore
deleted file mode 100644
index 602b74c1ae..0000000000
--- a/stdio/.cvsignore
+++ /dev/null
@@ -1,8 +0,0 @@
-*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps
-*.gz *.Z *.tar *.tgz
-=*
-TODO COPYING* AUTHORS copyr-* copying.*
-glibc-*
-
-mpn-copy.mk
-distinfo
diff --git a/stdio/Makefile b/stdio/Makefile
deleted file mode 100644
index 53cf73cdb4..0000000000
--- a/stdio/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (C) 1991,92,93,94,95,96,2001 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 Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 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
-# Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public
-# License along with the GNU C Library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA.
-
-#
-# Specific makefile for stdio.
-#
-subdir := stdio
-
-headers := stdio.h linewrap.h
-
-routines := \
- feof ferror clearerr fileno \
- newstream fopen freopen fdopen fopncook fmemopen \
- setbuf setvbuf setbuffer setlinebuf \
- fseek ftell rewind fgetpos fsetpos \
- fread fwrite \
- ungetc \
- fgetc getc getchar \
- fputc putc putchar \
- fgets gets fputs puts \
- getdelim \
- fclose fcloseall fflush \
- vdprintf vsnprintf vsprintf vasprintf vsscanf vscanf \
- memstream obstream linewrap \
- __fbufsize __freading __fwriting __freadable __fwritable __flbf \
- __fpurge __fpending __fsetlocking \
- internals sysd-stdio pipestream stdio_init libc_fatal
-aux := defs glue
-
-
-include ../Rules
diff --git a/stdio/Versions b/stdio/Versions
deleted file mode 100644
index ccfda9c268..0000000000
--- a/stdio/Versions
+++ /dev/null
@@ -1,70 +0,0 @@
-libc {
- GLIBC_2.0 {
- # more or less standard functions
- __fillbf; __flshfp;
-
- # functions used in inline functions or macros
- __getdelim; __line_wrap_output; __line_wrap_update;
- __vfscanf; __vsscanf;
-
- # variables in normal name space
- stderr; stdin; stdout;
-
- # c*
- clearerr;
-
- # f*
- fclose; fcloseall; fdopen; feof; ferror; fflush; fgetc; fgetpos; fgets;
- fileno; fmemopen; fopen; fopencookie; fputc; fputs; fread; freopen;
- fseek; fsetpos; ftell; fwrite;
-
- # g*
- getc; getchar; getdelim; gets;
-
- # l*
- line_wrap_stream; line_unwrap_stream; line_wrapped; line_wrap_lmargin;
- line_wrap_set_lmargin; line_wrap_rmargin; line_wrap_set_rmargin;
- line_wrap_wmargin; line_wrap_set_wmargin; line_wrap_point;
-
- # o*
- open_memstream; open_obstack_stream; obstack_printf; obstack_vprintf;
-
- # p*
- pclose; popen; putc; putchar; puts;
-
- # r*
- rewind;
-
- # s*
- setbuf; setbuffer; setlinebuf; setvbuf;
-
- # u*
- ungetc;
-
- # v*
- vasprintf; vdprintf; vscanf; vsnprintf; vsprintf; vsscanf;
- }
- GLIBC_2.1 {
- # functions used in other libraries
- __asprintf;
-
- # c*
- clearerr_unlocked;
-
- # f*
- feof_unlocked; ferror_unlocked; fflush_unlocked; fgets_unlocked;
- fileno_unlocked; fputc_unlocked; fputs_unlocked;
- fread_unlocked; fwrite_unlocked;
-
- # g*
- getc_unlocked; getchar_unlocked;
-
- # p*
- putc_unlocked; putchar_unlocked;
- }
- GLIBC_2.2.4 {
- # Functions to access FILE internals.
- __fbufsize; __freading; __fwriting; __freadable; __fwritable; __flbf;
- __fpurge; __fpending; __fsetlocking; _flushlbf;
- }
-}
diff --git a/stdio/__fbufsize.c b/stdio/__fbufsize.c
deleted file mode 100644
index ad42ee2427..0000000000
--- a/stdio/__fbufsize.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2001 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio_ext.h>
-
-size_t
-__fbufsize (FILE *fp)
-{
- return fp->__bufsize;
-}
diff --git a/stdio/__flbf.c b/stdio/__flbf.c
deleted file mode 100644
index 9eb80abdbf..0000000000
--- a/stdio/__flbf.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2001 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio_ext.h>
-
-int
-__flbf (FILE *fp)
-{
- return fp->__linebuf;
-}
diff --git a/stdio/__fpending.c b/stdio/__fpending.c
deleted file mode 100644
index 0e7b8f02f0..0000000000
--- a/stdio/__fpending.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2001 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio_ext.h>
-
-size_t
-__fpending (FILE *fp)
-{
- return (fp->__put_limit >= fp->__bufp ? fp->__bufp - fp->__buffer : 0);
-}
diff --git a/stdio/__fpurge.c b/stdio/__fpurge.c
deleted file mode 100644
index db882b68f5..0000000000
--- a/stdio/__fpurge.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2001 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio_ext.h>
-
-void
-__fpurge (FILE *fp)
-{
- fp->__get_limit = fp->__put_limit = fp->__bufp = fp->__buffer;
-}
diff --git a/stdio/__freadable.c b/stdio/__freadable.c
deleted file mode 100644
index 5674d5bef5..0000000000
--- a/stdio/__freadable.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2001 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio_ext.h>
-
-int
-__freadable (FILE *fp)
-{
- return !!fp->__mode.__read;
-}
diff --git a/stdio/__freading.c b/stdio/__freading.c
deleted file mode 100644
index 16d0fd97f8..0000000000
--- a/stdio/__freading.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 2001 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio_ext.h>
-
-int
-__freading (FILE *fp)
-{
- /* This is not really right for unbuffered streams. */
- return (!fp->__mode.__write || fp->__put_limit == fp->__buffer);
-}
diff --git a/stdio/__fsetlocking.c b/stdio/__fsetlocking.c
deleted file mode 100644
index a0e40d71c9..0000000000
--- a/stdio/__fsetlocking.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 2001 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio_ext.h>
-#include <errno.h>
-#include <stdlib.h>
-
-int
-__fsetlocking (FILE *fp, int type)
-{
- /* We don't really support locking. */
-
- switch (type)
- {
- case FSETLOCKING_QUERY:
- case FSETLOCKING_BYCALLER:
- break;
- case FSETLOCKING_INTERNAL:
- abort ();
- default:
- __set_errno (EINVAL);
- return -1;
- }
-
- return FSETLOCKING_BYCALLER;
-}
diff --git a/stdio/__fwritable.c b/stdio/__fwritable.c
deleted file mode 100644
index 396629542c..0000000000
--- a/stdio/__fwritable.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2001 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio_ext.h>
-
-int
-__fwritable (FILE *fp)
-{
- return !!fp->__mode.__write;
-}
diff --git a/stdio/__fwriting.c b/stdio/__fwriting.c
deleted file mode 100644
index 36266ef34d..0000000000
--- a/stdio/__fwriting.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 2001 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio_ext.h>
-
-int
-__fwriting (FILE *fp)
-{
- /* This is not really right for unbuffered streams. */
- return (!fp->__mode.__read || fp->__get_limit == fp->__buffer);
-}
diff --git a/stdio/clearerr.c b/stdio/clearerr.c
deleted file mode 100644
index 02a1d77780..0000000000
--- a/stdio/clearerr.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1991, 1997, 1998 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-#undef clearerr
-
-
-/* Clear the EOF and error indicators for STREAM. */
-void
-clearerr (FILE *stream)
-{
- __clearerr (stream);
-}
-
-weak_alias (clearerr, clearerr_unlocked)
diff --git a/stdio/fclose.c b/stdio/fclose.c
deleted file mode 100644
index 6af0903f9b..0000000000
--- a/stdio/fclose.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1998 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-
-/* Close a stream. */
-int
-fclose (stream)
- FILE *stream;
-{
- int status;
-
- if (!__validfp (stream))
- {
- __set_errno (EINVAL);
- return EOF;
- }
-
- if (stream->__mode.__write &&
- /* Flush the buffer. */
- __flshfp (stream, EOF) == EOF)
- return EOF;
-
- /* Free the buffer's storage. */
- if (stream->__buffer != NULL && !stream->__userbuf)
- free (stream->__buffer);
-
- /* Close the system file descriptor. */
- if (stream->__io_funcs.__close != NULL)
- status = (*stream->__io_funcs.__close) (stream->__cookie);
- else if (!stream->__seen && stream->__cookie != NULL)
- status = __stdio_close (stream->__cookie);
- else
- status = 0;
-
- /* Nuke the stream, making it available for re-use. */
- __invalidate (stream);
-
- return status < 0 ? EOF : 0;
-}
diff --git a/stdio/fcloseall.c b/stdio/fcloseall.c
deleted file mode 100644
index b247506be1..0000000000
--- a/stdio/fcloseall.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-
-/* Close a stream. */
-int
-__fcloseall ()
-{
- /* Close all streams. */
- register FILE *f;
- for (f = __stdio_head; f != NULL; f = f->__next)
- if (__validfp(f))
- (void) fclose(f);
- return 0;
-}
-weak_alias (__fcloseall, fcloseall)
diff --git a/stdio/feof.c b/stdio/feof.c
deleted file mode 100644
index 87d0463350..0000000000
--- a/stdio/feof.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1991, 1996, 1998 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-#undef feof
-#undef feof_unlocked
-
-/* Return non-zero if STREAM has its EOF indicator set. */
-int
-feof (stream)
- FILE *stream;
-{
- if (!__validfp (stream))
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- return stream->__eof;
-}
-
-weak_alias (feof, feof_unlocked)
diff --git a/stdio/ferror.c b/stdio/ferror.c
deleted file mode 100644
index 5ccc9abb37..0000000000
--- a/stdio/ferror.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997, 1998 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-#undef ferror
-#undef ferror_unlocked
-
-
-/* Return non-zero if STREAM has its error indicator set. */
-int
-ferror (stream)
- FILE *stream;
-{
- if (!__validfp (stream))
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- return stream->__error;
-}
-
-weak_alias (ferror, ferror_unlocked)
diff --git a/stdio/fflush.c b/stdio/fflush.c
deleted file mode 100644
index b184e187e2..0000000000
--- a/stdio/fflush.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 1991, 1996, 1998 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/* Flush STREAM's buffer.
- If STREAM is NULL, flush the buffers of all streams that are writing. */
-int
-fflush (stream)
- register FILE *stream;
-{
- if (stream == NULL)
- {
- int lossage = 0;
- for (stream = __stdio_head; stream != NULL; stream = stream->__next)
- if (__validfp (stream) && stream->__mode.__write)
- lossage |= fflush (stream) == EOF;
- return lossage ? EOF : 0;
- }
-
- if (!__validfp (stream) || !stream->__mode.__write)
- {
- __set_errno (EINVAL);
- return EOF;
- }
-
- return __flshfp (stream, EOF);
-}
-
-weak_alias(fflush, fflush_unlocked)
diff --git a/stdio/fgetc.c b/stdio/fgetc.c
deleted file mode 100644
index f196c3ddda..0000000000
--- a/stdio/fgetc.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-
-/* Read a character from STREAM. */
-int
-fgetc (stream)
- FILE *stream;
-{
- if (!__validfp (stream) || !stream->__mode.__read)
- {
- __set_errno (EINVAL);
- return EOF;
- }
-
- return __getc (stream);
-}
diff --git a/stdio/fgetpos.c b/stdio/fgetpos.c
deleted file mode 100644
index 647d63b999..0000000000
--- a/stdio/fgetpos.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-#undef fgetpos
-
-
-/* Put the current position of STREAM in *POS. */
-int
-fgetpos (stream, pos)
- FILE *stream;
- fpos_t *pos;
-{
- if (!__validfp (stream) || pos == NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- *pos = ftell (stream);
- if (*pos < 0L)
- return -1;
- return 0;
-}
diff --git a/stdio/fgets.c b/stdio/fgets.c
deleted file mode 100644
index fbf5973a71..0000000000
--- a/stdio/fgets.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Copyright (C) 1991, 92, 95, 96, 97, 98 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-/* Reads characters from STREAM into S, until either a newline character
- is read, N - 1 characters have been read, or EOF is seen. Returns
- the newline, unlike gets. Finishes by appending a null character and
- returning S. If EOF is seen before any characters have been written
- to S, the function returns NULL without appending the null character.
- If there is a file error, always return NULL. */
-char *
-fgets (s, n, stream)
- char *s;
- int n;
- FILE *stream;
-{
- register char *p = s;
-
- if (!__validfp (stream) || s == NULL || n <= 0)
- {
- __set_errno (EINVAL);
- return NULL;
- }
-
- if (ferror (stream))
- return NULL;
-
- if (stream->__buffer == NULL && stream->__userbuf)
- {
- /* Unbuffered stream. Not much optimization to do. */
- register int c = 0;
- while (--n > 0 && (c = getc (stream)) != EOF)
- if ((*p++ = c) == '\n')
- break;
- if (c == EOF && (p == s || ferror (stream)))
- return NULL;
- *p = '\0';
- return s;
- }
-
- /* Leave space for the null. */
- --n;
-
- if (n > 0 &&
- (!stream->__seen || stream->__buffer == NULL || stream->__pushed_back))
- {
- /* Do one with getc to allocate a buffer. */
- int c = getc (stream);
- if (c == EOF)
- return NULL;
- *p++ = c;
- if (c == '\n')
- {
- *p = '\0';
- return s;
- }
- else
- --n;
- }
-
- while (n > 0)
- {
- size_t i;
- char *found;
-
- i = stream->__get_limit - stream->__bufp;
- if (i == 0)
- {
- /* Refill the buffer. */
- int c = __fillbf (stream);
- if (c == EOF)
- break;
- *p++ = c;
- --n;
- if (c == '\n')
- {
- *p = '\0';
- return s;
- }
- i = stream->__get_limit - stream->__bufp;
- }
-
- if (i > (size_t) n)
- i = n;
-
- found = (char *) __memccpy ((void *) p, stream->__bufp, '\n', i);
-
- if (found != NULL)
- {
- stream->__bufp += found - p;
- p = found;
- break;
- }
-
- stream->__bufp += i;
- n -= i;
- p += i;
- }
-
- if (p == s)
- return NULL;
-
- *p = '\0';
- return ferror (stream) ? NULL : s;
-}
-
-weak_alias (fgets, fgets_unlocked)
diff --git a/stdio/fileno.c b/stdio/fileno.c
deleted file mode 100644
index bfab916cb2..0000000000
--- a/stdio/fileno.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 1991, 93, 94, 96, 97, 98 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-/* Return the system file descriptor associated with STREAM. */
-int
-fileno (stream)
- FILE *stream;
-{
- extern void __stdio_check_funcs __P ((FILE *));
-
- if (! __validfp (stream))
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- __stdio_check_funcs (stream);
-
- if (stream->__io_funcs.__fileno == NULL)
- {
-#ifdef EOPNOTSUPP
- __set_errno (EOPNOTSUPP);
-#else
- __set_errno (ENOSYS);
-#endif
- return -1;
- }
-
- return (*stream->__io_funcs.__fileno) (stream->__cookie);
-}
-
-weak_alias(fileno, fileno_unlocked)
diff --git a/stdio/fmemopen.c b/stdio/fmemopen.c
deleted file mode 100644
index 1ae0e5b7ae..0000000000
--- a/stdio/fmemopen.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/* Defined in fopen.c. */
-extern int __getmode __P ((const char *mode, __io_mode *mptr));
-
-/* Open a new stream that will read and/or write from the buffer in
- S, which is of LEN bytes. If the mode indicates appending, the
- buffer pointer is set to point to the first '\0' in the buffer.
- If S is NULL, the buffer is allocated by malloc and will be freed
- when the stream is closed. The only purpose of this is to write
- things and then read what's been written. If LEN is zero, writes will
- always return errors and reads will always return end-of-file.
-
- The stream is set up such that seeks and tells will always fail and
- once the buffer is full of written characters or empty of characters
- to read, attempted writes always return an output error and attempted
- reads always return end-of-file. */
-FILE *
-fmemopen (s, len, mode)
- void *s;
- size_t len;
- const char *mode;
-{
- __io_mode m;
- register FILE *stream;
-
- if (!__getmode (mode, &m))
- return NULL;
-
- stream = __newstream ();
- if (stream == NULL)
- return NULL;
-
- stream->__mode = m;
-
- /* Input gets EOF. */
- stream->__room_funcs.__input = NULL;
- /* Output gets error. */
- stream->__room_funcs.__output = NULL;
-
- /* Do nothing for close. */
- stream->__io_funcs.__close = NULL;
- /* Can't seek outside the buffer. */
- stream->__io_funcs.__seek = NULL;
- /* There is no associated file descriptor to fetch. */
- stream->__io_funcs.__fileno = NULL;
-
- stream->__seen = 1;
-
- stream->__userbuf = s != NULL && len > 0;
- if (s == NULL)
- {
- s = malloc (len);
- if (s == NULL)
- {
- int save = errno;
- (void) fclose (stream);
- __set_errno (save);
- return NULL;
- }
- }
-
- stream->__buffer = (char *) s;
- stream->__bufsize = len;
-
- stream->__bufp = stream->__buffer;
- stream->__get_limit = (stream->__buffer +
- (stream->__mode.__read ? stream->__bufsize : 0));
- stream->__put_limit = (stream->__buffer +
- (stream->__mode.__write ? stream->__bufsize : 0));
- stream->__cookie = NULL;
-
- if (stream->__mode.__append)
- {
- char *p = memchr (stream->__bufp, '\0',
- stream->__get_limit - stream->__bufp);
- if (p == NULL)
- stream->__bufp = stream->__get_limit;
- else
- stream->__bufp = p;
- }
- else if (stream->__mode.__truncate)
- memset ((void *) stream->__buffer, 0, len);
-
- return stream;
-}
diff --git a/stdio/fopen.c b/stdio/fopen.c
deleted file mode 100644
index 62e78e39bf..0000000000
--- a/stdio/fopen.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 96, 97, 98 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-#define badmode() return ((__set_errno (EINVAL)), 0)
-
-/* Dissect the given mode string into an __io_mode. */
-int
-__getmode (const char *mode, __io_mode *mptr)
-{
- register unsigned char i;
-
- if (mode == NULL)
- badmode ();
-
- memset ((void *) mptr, 0, sizeof (*mptr));
-
- switch (*mode)
- {
- case 'a':
- mptr->__write = mptr->__create = mptr->__append = 1;
- break;
- case 'w':
- mptr->__write = mptr->__create = mptr->__truncate = 1;
- break;
- case 'r':
- mptr->__read = 1;
- break;
- default:
- badmode ();
- }
-
- for (i = 1; i < 4; ++i)
- {
- switch (*++mode)
- {
- case '\0':
- break;
- case '+':
- mptr->__read = mptr->__write = 1;
- continue;
- case 'b':
- mptr->__binary = 1;
- continue;
- case 'x':
- mptr->__exclusive = 1;
- continue;
- }
- break;
- }
-
- if (!mptr->__read && !mptr->__write)
- badmode ();
-
- return 1;
-}
-
-/* Open a new stream on the given file. */
-FILE *
-fopen (filename, mode)
- const char *filename;
- const char *mode;
-{
- FILE *stream;
- __io_mode m;
-
- if (filename == NULL)
- {
- __set_errno (EINVAL);
- return NULL;
- }
-
- if (!__getmode (mode, &m))
- return NULL;
-
- stream = __newstream ();
- if (stream == NULL)
- return NULL;
-
- if (__stdio_open (filename, m, &stream->__cookie))
- {
- int save = errno;
- (void) fclose (stream);
- __set_errno (save);
- return NULL;
- }
-
- stream->__mode = m;
-
- return stream;
-}
diff --git a/stdio/fopncook.c b/stdio/fopncook.c
deleted file mode 100644
index adbbc48c0e..0000000000
--- a/stdio/fopncook.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-
-
-/* Defined in fopen.c. */
-extern int __getmode __P ((const char *mode, __io_mode *mptr));
-
-/* Open a new stream on the given magic cookie descriptor. */
-FILE *
-fopencookie (cookie, mode, functions)
- void *cookie;
- const char *mode;
- __io_functions functions;
-{
- __io_mode m;
- FILE *f;
-
- if (!__getmode (mode, &m))
- return NULL;
-
- f = __newstream ();
- if (f == NULL)
- return NULL;
-
- f->__cookie = cookie;
- f->__mode = m;
- f->__io_funcs = functions;
- f->__room_funcs = __default_room_functions;
- f->__seen = 1;
-
- return f;
-}
diff --git a/stdio/fputc.c b/stdio/fputc.c
deleted file mode 100644
index 57d618cf07..0000000000
--- a/stdio/fputc.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997, 1998, 1999 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-
-/* Write the character C to STREAM. */
-int
-fputc (c, stream)
- int c;
- FILE *stream;
-{
- if (!__validfp (stream) || !stream->__mode.__write)
- {
- __set_errno (EINVAL);
- return EOF;
- }
-
- return __putc (c, stream);
-}
-
-#ifndef fputc
-weak_alias (fputc, fputc_unlocked)
-#endif
diff --git a/stdio/fputs.c b/stdio/fputs.c
deleted file mode 100644
index f2457f7fbd..0000000000
--- a/stdio/fputs.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997, 1998 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-
-/* Write the string S to STREAM. */
-int
-fputs (const char *s, FILE *stream)
-{
- const size_t len = strlen (s);
- if (len == 1)
- return putc (*s, stream) == EOF ? EOF : 0;
- if (fwrite ((void *) s, 1, len, stream) != len)
- return EOF;
- return 0;
-}
-weak_alias (fputs, fputs_unlocked)
diff --git a/stdio/fread.c b/stdio/fread.c
deleted file mode 100644
index 528c567114..0000000000
--- a/stdio/fread.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Copyright (C) 1991, 92, 95, 96, 97, 98 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-
-#define default_func __default_room_functions.__input
-
-/* Read NMEMB chunks of SIZE bytes each from STREAM into P. */
-size_t
-fread (p, size, nmemb, stream)
- void *p;
- size_t size;
- size_t nmemb;
- register FILE *stream;
-{
- register char *ptr = (char *) p;
- register size_t to_read = size * nmemb;
- size_t bytes = to_read;
-
- if (!__validfp (stream) || !stream->__mode.__read)
- {
- __set_errno (EINVAL);
- return 0;
- }
- if (feof (stream) || ferror (stream))
- return 0;
- if (p == NULL || to_read == 0)
- return 0;
-
- if (!stream->__seen || stream->__buffer == NULL || stream->__pushed_back)
- {
- /* This stream has never been seen before, or it has a character
- pushed back. Call __fillbf to deal with those cases. Life will
- be simpler after this call. */
- int c = __fillbf (stream);
- if (c == EOF)
- return 0;
- *ptr++ = c;
- if (--to_read == 0)
- return 1;
- }
-
- read_from_buffer:;
- if (stream->__bufp < stream->__get_limit)
- {
- /* First off, empty out the buffer. */
- register size_t copy = stream->__get_limit - stream->__bufp;
- if (copy > to_read)
- copy = to_read;
- to_read -= copy;
- if (copy > 20)
- memcpy((void *) ptr, (void *) stream->__bufp, copy);
- else
- {
- register size_t i;
- for (i = 0; i < copy; ++i)
- ptr[i] = stream->__bufp[i];
- }
- stream->__bufp += copy;
- if (to_read == 0)
- return nmemb;
- ptr += copy;
- }
-
- /* Reading directly into the user's buffer doesn't help when
- using a user-specified input buffer filling/expanding function,
- so we don't do it in that case. */
- if (to_read >= stream->__bufsize &&
- stream->__room_funcs.__input == default_func &&
- stream->__offset == stream->__target)
- {
- /* Read directly into the user's buffer. */
- if (stream->__io_funcs.__read != NULL)
- while (to_read > 0)
- {
- register int count;
- count = (*stream->__io_funcs.__read) (stream->__cookie,
- ptr, to_read);
- if (count > 0)
- {
- to_read -= count;
- if (stream->__offset != -1)
- {
- stream->__offset += count;
- stream->__target += count;
- }
- ptr += count;
- }
- else if (count == 0)
- {
- stream->__eof = 1;
- break;
- }
- else
- {
- stream->__error = 1;
- break;
- }
- }
- else
- stream->__eof = 1;
- }
- else
- {
- int c = __fillbf (stream);
- if (c == EOF)
- return (bytes - to_read) / size;
- *ptr++ = (char) c;
- --to_read;
- if (to_read > 0)
- goto read_from_buffer;
- }
-
- return (bytes - to_read) / size;
-}
-
-weak_alias (fread, fread_unlocked)
diff --git a/stdio/freopen.c b/stdio/freopen.c
deleted file mode 100644
index dc4ff3feb1..0000000000
--- a/stdio/freopen.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright (C) 1991, 1994, 1995, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-
-/* Defined in fopen.c. */
-extern int __getmode __P ((const char *, __io_mode *));
-
-/* Defined in sysd-stdio.c. */
-extern int __stdio_reopen __P ((const char *filename, __io_mode mode,
- void *cookieptr, __io_close_fn closefn));
-
-/* Replace STREAM, opening it on FILENAME. */
-FILE *
-freopen (filename, mode, stream)
- const char *filename;
- const char *mode;
- register FILE *stream;
-{
- __io_mode m;
- void *cookie;
-
- if (!__getmode (mode, &m))
- {
- (void) fclose (stream);
- __set_errno (EINVAL);
- return NULL;
- }
-
- if (stream->__mode.__write)
- /* Flush the stream. */
- (void) fflush (stream);
-
- /* Open the file, attempting to preserve the old cookie value. */
- cookie = stream->__cookie;
- if (__stdio_reopen (filename, m, &cookie,
- stream->__seen ?
- stream->__io_funcs.__close :
- __stdio_close))
- {
- int save = errno;
- (void) fclose (stream);
- __set_errno (save);
- return NULL;
- }
-
- /* Close the stream, first disabling its cookie close function because
- __stdio_reopen has already dealt with closing the old cookie. */
- stream->__seen = 1; /* It might have no functions yet. */
- stream->__io_funcs.__close = NULL;
- (void) fclose (stream);
-
- stream->__magic = _IOMAGIC;
- stream->__cookie = cookie;
- stream->__mode = m;
-
- return stream;
-}
diff --git a/stdio/fseek.c b/stdio/fseek.c
deleted file mode 100644
index fb2e580fd0..0000000000
--- a/stdio/fseek.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 95, 96, 97 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-
-/* Move the file position of STREAM to OFFSET
- bytes from the beginning of the file if WHENCE
- is SEEK_SET, the end of the file is it is SEEK_END,
- or the current position if it is SEEK_CUR. */
-int
-fseek (stream, offset, whence)
- register FILE *stream;
- long int offset;
- int whence;
-{
- long int o;
-
- if (!__validfp (stream))
- {
- __set_errno (EINVAL);
- return EOF;
- }
-
- /* Write out any pending data. */
- if (stream->__mode.__write && __flshfp (stream, EOF) == EOF)
- return EOF;
-
- /* Make sure we know the current offset info. */
- stream->__offset = -1;
- if (__stdio_check_offset (stream) == EOF)
- return EOF;
-
- /* We are moving the file position, so we are no longer at EOF. */
- stream->__eof = 0;
-
- if (stream->__pushed_back)
- {
- /* Discard the character pushed back by ungetc. */
- stream->__bufp = stream->__pushback_bufp;
- stream->__pushed_back = 0;
- }
-
- /* Check the WHENCE argument for validity, and process OFFSET
- into an absolute position in O. By the end of this switch,
- either we have returned, or O contains an absolute position. */
- o = offset;
- switch (whence)
- {
- default:
- __set_errno (EINVAL);
- return EOF;
-
- case SEEK_END:
- /* We don't know where the end of the file is,
- so seek to the position in the file the user asked
- for, and then look where that is. */
- if (stream->__io_funcs.__seek == NULL)
- {
- __set_errno (ESPIPE);
- return EOF;
- }
- else
- {
- fpos_t pos = (fpos_t) o;
- if ((*stream->__io_funcs.__seek)
- (stream->__cookie, &pos, SEEK_END) < 0)
- {
- if (errno == ESPIPE)
- stream->__io_funcs.__seek = NULL;
- return EOF;
- }
- stream->__offset = pos;
- /* Make O be absolute, rather than
- relative to the end of the file. */
- o = pos;
- }
-
- /* Fall through to try an absolute seek. */
-
- case SEEK_SET:
- /* Make O be relative to the buffer. */
- o -= stream->__target;
- /* Make O be relative to the current position in the buffer. */
- o -= stream->__bufp - stream->__buffer;
-
- /* Fall through to see if we can do it by
- moving the pointer around in the buffer. */
-
- case SEEK_CUR:
- /* If the offset is small enough, we can just
- move the pointer around in the buffer. */
-
-#if 0 /* Why did I think this would ever work??? */
- if (stream->__put_limit > stream->__buffer)
- {
- /* We are writing. */
- if (stream->__bufp + o >= stream->__buffer &&
- stream->__put_limit > stream->__bufp + o &&
- stream->__get_limit > stream->__bufp + o)
- {
- /* We have read all the data we will change soon.
- We can just move the pointer around. */
- stream->__bufp += o;
- return 0;
- }
- else
- {
- /* Flush the buffer. */
- if (__flshfp(stream, EOF) == EOF)
- return EOF;
- }
- } else
-#endif
- if (o < 0 ?
- (-o <= stream->__bufp - stream->__buffer) :
- (o <= stream->__get_limit - stream->__bufp))
- {
- stream->__bufp += o;
- return 0;
- }
-
- /* Turn it into an absolute seek. */
- o += stream->__bufp - stream->__buffer;
- o += stream->__target;
- break;
- }
-
- if (o < 0)
- {
- /* Negative file position is meaningless. */
- __set_errno (EINVAL);
- return -1;
- }
-
- /* O is now an absolute position, the new target. */
- stream->__target = o;
-
- /* Set bufp and both end pointers to the beginning of the buffer.
- The next i/o will force a call to the input/output room function. */
- stream->__bufp
- = stream->__get_limit = stream->__put_limit = stream->__buffer;
-
- /* Make sure __flshfp doesn't think the put_limit is at the beginning
- of the buffer because of line-buffering magic. */
- stream->__linebuf_active = 0;
-
- /* If there is no seek function, seeks always fail. */
- if (stream->__io_funcs.__seek == NULL)
- {
- /* This is preemptive, since we don't actually do the seeking.
- But it makes more sense for fseek to to fail with ESPIPE
- than for the next reading or writing operation to fail
- that way. */
- __set_errno (ESPIPE);
- return EOF;
- }
-
- /* Don't actually seek. The next reading or writing operation
- will force a call to the input or output room function,
- which will move to the target file position before reading or writing. */
- return 0;
-}
diff --git a/stdio/fsetpos.c b/stdio/fsetpos.c
deleted file mode 100644
index 073644369f..0000000000
--- a/stdio/fsetpos.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-#undef fsetpos
-
-
-/* Set the file position of STREAM to *POS. */
-int
-fsetpos (stream, pos)
- FILE *stream;
- const fpos_t *pos;
-{
- if (pos == NULL)
- {
- __set_errno (EINVAL);
- return EOF;
- }
-
- return fseek (stream, *pos, SEEK_SET);
-}
diff --git a/stdio/ftell.c b/stdio/ftell.c
deleted file mode 100644
index 03c3ebc332..0000000000
--- a/stdio/ftell.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1991, 1992, 1994, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-/* Return the offset in bytes from the beginning
- of the file of the file position of STREAM. */
-long int
-ftell (stream)
- FILE *stream;
-{
- long int pos;
-
- if (!__validfp (stream))
- {
- __set_errno (EINVAL);
- return -1L;
- }
-
- if (__stdio_check_offset (stream) == EOF)
- return -1L;
-
- /* Start with the file position associated with the beginning
- of our buffer. */
- pos = stream->__target;
-
- if (stream->__pushed_back)
- /* ungetc was just called, so our real buffer pointer is squirreled
- away in STREAM->__pushback_bufp, not in STREAM->__bufp as normal.
- Calling ungetc is supposed to decrement the file position. ANSI
- says the file position is unspecified if you ungetc when the
- position is zero; -1 seems as good as anything to me. */
- pos += stream->__pushback_bufp - stream->__buffer - 1;
- else
- pos += stream->__bufp - stream->__buffer;
-
- return pos;
-}
diff --git a/stdio/fwrite.c b/stdio/fwrite.c
deleted file mode 100644
index 588e40b48f..0000000000
--- a/stdio/fwrite.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 94, 96, 97, 98 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-
-/* Write NMEMB chunks of SIZE bytes each from PTR onto STREAM. */
-size_t
-fwrite (ptr, size, nmemb, stream)
- const void *ptr;
- size_t size;
- size_t nmemb;
- register FILE *stream;
-{
- register const unsigned char *p = (const unsigned char *) ptr;
- register size_t to_write = size * nmemb;
- register size_t written = 0;
- int newlinep;
- size_t buffer_space;
- int default_func;
-
- if (!__validfp (stream) || !stream->__mode.__write)
- {
- __set_errno (EINVAL);
- return 0;
- }
-
- if (ferror (stream))
- return 0;
- if (p == NULL || to_write == 0)
- return 0;
-
- if (!stream->__seen || stream->__put_limit == stream->__buffer)
- {
- /* This stream has never been seen before.
- Calling __flshfp will give it a buffer
- and I/O functions if it needs them. */
- if (__flshfp (stream, *p++) == EOF)
- return 0;
- if (--to_write == 0)
- return 1;
- else
- ++written;
- }
-
- default_func
- = stream->__room_funcs.__output == __default_room_functions.__output;
-
- {
- int save = errno;
-
- if (__stdio_check_offset (stream) == EOF && errno != ESPIPE)
- {
- stream->__error = 1;
- goto done;
- }
-
- __set_errno (save);
- }
-
- if (stream->__buffer == NULL && default_func &&
- stream->__offset == stream->__target)
- write_through:
- /* This is an unbuffered stream using the standard output
- buffer-flushing function, so we just do a straight write. */
- {
- int count = (stream->__io_funcs.__write == NULL ? to_write :
- (*stream->__io_funcs.__write) (stream->__cookie,
- (const char *) p,
- to_write));
- if (count > 0)
- {
- written += count;
- if (stream->__offset != -1)
- {
- stream->__offset += count;
- stream->__target = stream->__offset;
- }
- to_write -= count;
- p += count;
- }
- else
- stream->__error = 1;
- goto done;
- }
-
- /* We ignore the end pointer here since we want to find out how much space
- is really in the buffer, even for a line-buffered stream. */
- buffer_space = stream->__bufsize - (stream->__bufp - stream->__buffer);
-
- newlinep = (stream->__linebuf &&
- memchr ((const void *) p, '\n', to_write) != NULL);
-
- if (newlinep && stream->__bufp == stream->__buffer &&
- stream->__offset == stream->__target)
- /* The buffer's empty, and we want to write our data
- out soon anyway, so just write it straight out. */
- goto write_through;
-
- if (stream->__bufsize == 0 && !default_func)
- {
- /* No buffer, and a special function.
- We can't do much better than putc. */
- while (to_write-- > 0)
- {
- if (__flshfp (stream, *p++) == EOF)
- break;
- else
- ++written;
- }
- }
- else if (!default_func || buffer_space >= to_write)
- {
- /* There is enough room in the buffer for everything we want to write
- or the user has specified his own output buffer-flushing/expanding
- function. */
- fill_buffer:
- while (to_write > 0)
- {
- register size_t n = to_write;
-
- if (n > buffer_space)
- n = buffer_space;
-
- buffer_space -= n;
-
- written += n;
- to_write -= n;
-
- if (n < 20)
- while (n-- > 0)
- *stream->__bufp++ = *p++;
- else
- {
- memcpy ((void *) stream->__bufp, (void *) p, n);
- stream->__bufp += n;
- p += n;
- }
-
- if (to_write == 0)
- /* Done writing. */
- break;
- else if (buffer_space == 0)
- {
- /* We have filled the buffer, so flush it. */
- if (fflush (stream) == EOF)
- break;
-
- /* Reset our record of the space available in the buffer,
- since we have just flushed it. */
- check_space:
- buffer_space = (stream->__bufsize -
- (stream->__bufp - stream->__buffer));
- if (buffer_space == 0)
- {
- /* With a custom output-room function, flushing might
- not create any buffer space. Try writing a single
- character to create the space. */
- if (__flshfp (stream, *p++) == EOF)
- goto done;
- ++written;
- --to_write;
- goto check_space;
- }
- }
- }
-
- /* We have written all the data into the buffer. If we are
- line-buffered and just put a newline in the buffer, flush now to
- make sure it gets out. */
- if (newlinep)
- fflush (stream);
- }
- else
- {
- /* It won't all fit in the buffer. */
-
- if (stream->__bufp != stream->__buffer)
- {
- /* There are characters in the buffer. Flush them. */
- if (__flshfp (stream, EOF) == EOF)
- goto done;
- }
-
- /* The buffer has been flushed.
- Now either fill it or write directly. */
-
- buffer_space = stream->__bufsize - (stream->__bufp - stream->__buffer);
-
- if (stream->__offset == stream->__target &&
- (buffer_space < to_write || newlinep))
- /* What we have to write is bigger than the buffer,
- or it contains a newline and we're line-buffered,
- so write it out. */
- goto write_through;
- else
- /* It will fit in the buffer. */
- goto fill_buffer;
- }
-
- done:;
- return (size_t) written / size;
-}
-
-weak_alias (fwrite, fwrite_unlocked)
diff --git a/stdio/getc.c b/stdio/getc.c
deleted file mode 100644
index eee136a902..0000000000
--- a/stdio/getc.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdio.h>
-#undef getc
-#define fgetc getc
-#include <fgetc.c>
-
-weak_alias (getc, getc_unlocked)
diff --git a/stdio/getchar.c b/stdio/getchar.c
deleted file mode 100644
index 49f47c41ac..0000000000
--- a/stdio/getchar.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1991, 1997, 1998 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-
-#undef getchar
-
-
-/* Read a character from stdin. */
-int
-getchar (void)
-{
- return __getc (stdin);
-}
-
-weak_alias (getchar, getchar_unlocked)
diff --git a/stdio/getdelim.c b/stdio/getdelim.c
deleted file mode 100644
index b8c9e74950..0000000000
--- a/stdio/getdelim.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <errno.h>
-
-/* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR
- (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
- NULL), pointing to *N characters of space. It is realloc'd as
- necessary. Returns the number of characters read (not including the
- null terminator), or -1 on error or EOF. */
-
-ssize_t
-__getdelim (lineptr, n, terminator, stream)
- char **lineptr;
- size_t *n;
- int terminator;
- FILE *stream;
-{
- char *line, *p;
- size_t size, copy;
-
- if (!__validfp (stream) || lineptr == NULL || n == NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- if (ferror (stream))
- return -1;
-
- /* Make sure we have a line buffer to start with. */
- if (*lineptr == NULL || *n < 2) /* !seen and no buf yet need 2 chars. */
- {
-#ifndef MAX_CANON
-#define MAX_CANON 256
-#endif
- line = realloc (*lineptr, MAX_CANON);
- if (line == NULL)
- return -1;
- *lineptr = line;
- *n = MAX_CANON;
- }
-
- line = *lineptr;
- size = *n;
-
- copy = size;
- p = line;
-
- if (stream->__buffer == NULL && stream->__userbuf)
- {
- /* Unbuffered stream. Not much optimization to do. */
-
- while (1)
- {
- size_t len;
-
- while (--copy > 0)
- {
- register int c = getc (stream);
- if (c == EOF)
- goto lose;
- else if ((*p++ = c) == terminator)
- goto win;
- }
-
- /* Need to enlarge the line buffer. */
- len = p - line;
- size *= 2;
- line = realloc (line, size);
- if (line == NULL)
- goto lose;
- *lineptr = line;
- *n = size;
- p = line + len;
- copy = size - len;
- }
- }
- else
- {
- /* Leave space for the terminating null. */
- --copy;
-
- if (!stream->__seen || stream->__buffer == NULL || stream->__pushed_back)
- {
- /* Do one with getc to allocate a buffer. */
- int c = getc (stream);
- if (c == EOF)
- goto lose;
- *p++ = c;
- if (c == terminator)
- goto win;
- --copy;
- }
-
- while (1)
- {
- size_t i;
- char *found;
-
- i = stream->__get_limit - stream->__bufp;
- if (i == 0)
- {
- /* Refill the buffer. */
- int c = __fillbf (stream);
- if (c == EOF)
- goto lose;
- *p++ = c;
- if (c == terminator)
- goto win;
- --copy;
- i = stream->__get_limit - stream->__bufp;
- }
-
- if (i > copy)
- i = copy;
-
- found = (char *) __memccpy ((void *) p, stream->__bufp,
- terminator, i);
- if (found != NULL)
- {
- stream->__bufp += found - p;
- p = found;
- goto win;
- }
-
- stream->__bufp += i;
- p += i;
- copy -= i;
- if (copy == 0)
- {
- /* Need to enlarge the line buffer. */
- size_t len = p - line;
- size *= 2;
- line = realloc (line, size);
- if (line == NULL)
- goto lose;
- *lineptr = line;
- *n = size;
- p = line + len;
- copy = size - len;
- /* Leave space for the terminating null. */
- --copy;
- }
- }
- }
-
- lose:
- if (p == *lineptr)
- return -1;
- /* Return a partial line since we got an error in the middle. */
- win:
- *p = '\0';
- return p - *lineptr;
-}
-
-weak_alias (__getdelim, getdelim)
diff --git a/stdio/gets.c b/stdio/gets.c
deleted file mode 100644
index 992e17f8ac..0000000000
--- a/stdio/gets.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 1991, 1994, 1995, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-
-link_warning (gets, "the `gets' function is dangerous and should not be used.")
-
-/* Read a newline-terminated string from stdin into S,
- removing the trailing newline. Return S or NULL. */
-char *
-gets (s)
- char *s;
-{
- register char *p = s;
- register int c;
- FILE *stream = stdin;
-
- if (!__validfp (stream) || p == NULL)
- {
- __set_errno (EINVAL);
- return NULL;
- }
-
- if (feof (stream) || ferror (stream))
- return NULL;
-
- while ((c = getchar ()) != EOF)
- if (c == '\n')
- break;
- else
- *p++ = c;
-
- *p = '\0';
-
- /* Return null if we had an error, or if we got EOF
- before writing any characters. */
-
- if (ferror (stream) || (feof (stream) && p == s))
- return NULL;
-
- return s;
-}
diff --git a/stdio/glue.c b/stdio/glue.c
deleted file mode 100644
index a320f461ea..0000000000
--- a/stdio/glue.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-/* This file provides glue between Unix stdio and GNU stdio.
- It supports use of Unix stdio `getc' and `putc' (and, by extension,
- `getchar' and `putchar') macros on GNU stdio streams (they are slow, but
- they work). It also supports all stdio operations (including Unix
- `getc' and `putc') on Unix's stdin, stdout, and stderr (the elements of
- `_iob').
-
- The reasoning behind this is to allow programs (and especially
- libraries) compiled with Unix header files to work with the GNU C
- library. */
-
-#include <stdio.h>
-#include <errno.h>
-
-typedef union
- {
- struct
- {
- int magic;
- FILE **streamp; /* Overlaps GNU stdio `bufp' member. */
- /* These two overlap the GNU stdio `get_limit' and `put_limit'
- members. They must be <= `streamp'/`bufp' for GNU getc and putc
- to do the right thing. */
- FILE **streamp2, **streamp3;
- } glue;
- struct _iobuf
- {
- int _cnt;
- unsigned char *_ptr;
- unsigned char *_base;
- int _bufsiz;
- short int _flag;
- char _file;
- } unix_iobuf;
- FILE gnu_stream;
- } unix_FILE;
-
-/* These are the Unix stdio's stdin, stdout, and stderr.
- In Unix stdin is (&_iob[0]), stdout is (&_iob[1]), and stderr is
- (&_iob[2]). The magic number marks these as glued streams. The
- __validfp macro in stdio.h is used by every stdio function. It checks
- for glued streams, and replaces them with the GNU stdio stream. */
-unix_FILE _iob[] =
- {
-#define S(name) { { _GLUEMAGIC, &name, &name, &name } }
- S (stdin),
- S (stdout),
- S (stderr),
-#undef S
- };
-
-/* Called by the Unix stdio `getc' macro.
- The macro is assumed to look something like:
- (--file->_cnt < 0 ? _filbuf (file) ...)
- In a Unix stdio FILE `_cnt' is the first element.
- In a GNU stdio or glued FILE, the first element is the magic number. */
-int
-_filbuf (unix_FILE *file)
-{
- switch (++file->glue.magic) /* Compensate for Unix getc's decrement. */
- {
- case _GLUEMAGIC:
- /* This is a glued stream. */
- return getc (*file->glue.streamp);
-
- case _IOMAGIC:
- /* This is a normal GNU stdio stream. */
- return getc ((FILE *) file);
-
- default:
- /* Bogus stream. */
- __set_errno (EINVAL);
- return EOF;
- }
-}
-
-/* Called by the Unix stdio `putc' macro. Much like getc, above. */
-int
-_flsbuf (int c, unix_FILE *file)
-{
- /* Compensate for putc's decrement. */
- switch (++file->glue.magic)
- {
- case _GLUEMAGIC:
- return putc (c, *file->glue.streamp);
-
- case _IOMAGIC:
- return putc (c, (FILE *) file);
-
- default:
- __set_errno (EINVAL);
- return EOF;
- }
-}
diff --git a/stdio/internals.c b/stdio/internals.c
deleted file mode 100644
index 81f15deb18..0000000000
--- a/stdio/internals.c
+++ /dev/null
@@ -1,688 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/* Make sure that FP has its functions set. */
-void
-__stdio_check_funcs (register FILE *fp)
-{
- if (!fp->__seen)
- {
- /* Initialize the stream's info, including buffering info.
- This may give a buffer, change I/O functions, etc.
- If no buffer is set (and the stream is not made explicitly
- unbuffered), we allocate a buffer below, using the bufsize
- set by this function. */
- extern void __stdio_init_stream __P ((FILE *));
- fp->__room_funcs = __default_room_functions;
- fp->__io_funcs = __default_io_functions;
- __stdio_init_stream (fp);
- fp->__seen = 1;
- }
-}
-
-
-/* Minimum size of a buffer we will allocate by default.
- If this much memory is not available,
- the stream in question will be made unbuffered instead. */
-#define MIN_BUFSIZE 128
-
-/* Figure out what kind of buffering (none, line, or full)
- and what buffer size to give FP. */
-static void
-init_stream (register FILE *fp)
-{
- __stdio_check_funcs (fp);
-
- if (fp->__buffer == NULL && !fp->__userbuf)
- {
- int save;
-
- if (fp->__bufsize == 0)
- fp->__bufsize = BUFSIZ;
-
- /* Try to get however many bytes of buffering __stdio_pickbuf
- specified, but if that much memory isn't available,
- try half as much each time until it succeeds or the buffer
- size becomes too small to be useful. */
- save = errno;
- while (fp->__bufsize >= MIN_BUFSIZE)
- {
- fp->__buffer = (char *) malloc (fp->__bufsize);
- if (fp->__buffer == NULL)
- fp->__bufsize /= 2;
- else
- break;
- }
- __set_errno (save);
-
- if (fp->__buffer == NULL)
- {
- /* We can't get space for the buffer, so make it unbuffered. */
- fp->__userbuf = 1;
- fp->__bufsize = 0;
- }
- }
-
- if (fp->__bufp == NULL)
- {
- /* Set the buffer pointer to the beginning of the buffer. */
- fp->__bufp = fp->__buffer;
- fp->__put_limit = fp->__get_limit = fp->__buffer;
- }
-}
-
-
-/* Determine the current file position of STREAM if it is unknown. */
-int
-__stdio_check_offset (stream)
- FILE *stream;
-{
- init_stream (stream);
-
- if (stream->__offset == (fpos_t) -1)
- {
- /* This stream's offset is unknown or unknowable. */
- if (stream->__io_funcs.__seek == NULL)
- {
- /* Unknowable. */
- __set_errno (ESPIPE);
- return EOF;
- }
- else
- {
- /* Unknown. Find it out. */
- fpos_t pos = (fpos_t) 0;
- if ((*stream->__io_funcs.__seek) (stream->__cookie,
- &pos, SEEK_CUR) < 0)
- {
- if (errno == ESPIPE)
- /* Object is incapable of seeking. */
- stream->__io_funcs.__seek = NULL;
- return EOF;
- }
- stream->__offset = pos;
- }
- }
-
- if (stream->__target == (fpos_t) -1)
- /* This stream was opened on an existing object with
- an unknown file position. The position is now known.
- Make this the target position. */
- stream->__target = stream->__offset;
-
- return 0;
-}
-
-
-/* Move FP's file position to its target file position,
- seeking as necessary and updating its `offset' field.
- Sets ferror(FP) (and possibly errno) for errors. */
-static void
-seek_to_target (FILE *fp)
-{
- int save = errno;
- if (__stdio_check_offset (fp) == EOF)
- {
- if (errno == ESPIPE)
- __set_errno (save);
- else
- fp->__error = 1;
- }
- else if (fp->__target != fp->__offset)
- {
- /* We are not at the target file position.
- Seek to that position. */
- if (fp->__io_funcs.__seek == NULL)
- {
- /* We can't seek! */
- __set_errno (ESPIPE);
- fp->__error = 1;
- }
- else
- {
- fpos_t pos = fp->__target;
- if ((*fp->__io_funcs.__seek) (fp->__cookie, &pos, SEEK_SET) < 0)
- /* Seek failed! */
- fp->__error = 1;
- else
- {
- fp->__offset = pos;
- if (pos != fp->__target)
- {
- /* Seek didn't go to the right place!
- This should never happen. */
-#ifdef EGRATUITOUS
- /* It happens in the Hurd when the io server doesn't
- obey the protocol for io_seek. */
- __set_errno (EGRATUITOUS);
-#else
- /* I don't think this can happen in Unix. */
- __set_errno (ESPIPE); /* ??? */
-#endif
- fp->__error = 1;
- }
- }
- }
- }
-}
-
-/* Flush the buffer for FP.
- If C is not EOF, it is also to be written.
- If the stream is line buffered and C is a newline, it is written
- to the output, otherwise it is put in the buffer after it has been
- flushed to avoid a system call for a single character.
- This is the default `output room' function. */
-static void
-flushbuf (register FILE *fp, int c)
-{
- int flush_only = c == EOF;
- size_t buffer_written;
- size_t to_write;
-
- /* Set if target and get_limit have already been twiddled appropriately. */
- int twiddled = 0;
-
- if (fp->__put_limit == fp->__buffer)
- {
- /* The stream needs to be primed for writing. */
-
- size_t buffer_offset = 0;
-
- if (fp->__target == -1)
- /* For an unseekable object, data recently read bears no relation
- to data we will write later. Discard the buffer. */
- fp->__get_limit = fp->__buffer;
- else
- /* If the user has read some of the buffer, the target position
- is incremented for each character he has read. */
- fp->__target += fp->__bufp - fp->__buffer;
-
- if (fp->__mode.__read && fp->__room_funcs.__input != NULL &&
- !fp->__mode.__append)
- {
- int save = errno;
- const int aligned = (fp->__buffer == NULL ||
- __stdio_check_offset (fp) == EOF ||
- fp->__target % fp->__bufsize == 0);
- __set_errno (save);
-
- if (!aligned)
- {
- /* Move to a block (buffer size) boundary and read in a block.
- Then the output will be written as a whole block, too. */
- const size_t o = fp->__target % fp->__bufsize;
- fp->__target -= o;
- if ((*fp->__room_funcs.__input) (fp) == EOF && ferror (fp))
- return;
- else
- __clearerr (fp);
-
- if ((size_t) (fp->__get_limit - fp->__buffer) < o)
- /* Oops. We didn't read enough (probably because we got EOF).
- Forget we even mentioned it. */
- fp->__target += o;
- else
- /* Start bufp as far into the buffer as we were into
- this block before we read it. */
- buffer_offset = o;
-
- /* The target position is now set to where the beginning of the
- buffer maps to; and the get_limit was set by the input-room
- function. */
- twiddled = 1;
- }
- }
-
- if (fp->__buffer != NULL)
- {
- /* Set up to write output into the buffer. */
- fp->__put_limit = fp->__buffer + fp->__bufsize;
- fp->__bufp = fp->__buffer + buffer_offset;
-
- if (!flush_only)
- {
- /* Put C in the buffer to be written out.
- We only need to actually write it out now if
- it is a newline on a line-buffered stream. */
- *fp->__bufp++ = (unsigned char) c;
- if (!fp->__linebuf || (unsigned char) c != '\n')
- {
- /* There is no need to flush C from the buffer right now.
- Record that nothing was written from the buffer,
- and go do clean-up at end. */
- buffer_written = 0;
- goto end;
- }
- else
- /* We put C in the buffer, so don't write it again later. */
- flush_only = 1;
- }
- }
-
- if ((size_t) (fp->__bufp - fp->__buffer) <= buffer_offset && flush_only)
- {
- /* There is nothing new in the buffer, only data that
- was read back aligned from the file. */
- buffer_written = 0;
- goto end;
- }
- }
-
- /* If there is read data in the buffer past what was written,
- write all of that as well. Otherwise, just write what has been
- written into the buffer. */
- buffer_written = fp->__bufp - fp->__buffer;
- to_write = (buffer_written == 0 ? 0 :
- fp->__get_limit > fp->__bufp ?
- fp->__get_limit - fp->__buffer :
- buffer_written);
-
- if (fp->__io_funcs.__write == NULL || (to_write == 0 && flush_only))
- {
- /* There is no writing function or we're coming from an fflush
- call with nothing in the buffer, so just say the buffer's
- been flushed, increment the file offset, and return. */
- fp->__bufp = fp->__buffer;
- if (fp->__offset != -1)
- fp->__offset += to_write;
- goto end;
- }
-
- if (to_write > 0)
- {
- int wrote;
-
- /* Go to the target file position. Don't bother if appending;
- the write will just ignore the file position anyway. */
- if (!fp->__mode.__append)
- seek_to_target (fp);
-
- if (!ferror(fp))
- {
- /* Write out the buffered data. */
- wrote = (*fp->__io_funcs.__write) (fp->__cookie, fp->__buffer,
- to_write);
- if (wrote > 0)
- {
- if (fp->__mode.__append)
- /* The write has written the data to the end of the file
- and updated the file position to after the data. Don't
- bother to find the current position; we can get it
- later if we need it. */
- fp->__offset = fp->__target = -1;
- else if (fp->__offset != -1)
- /* Record that we've moved forward in the file. */
- fp->__offset += wrote;
- }
- if (wrote < (int) to_write)
- /* The writing function should always write
- the whole buffer unless there is an error. */
- fp->__error = 1;
- }
- }
-
- /* Reset the buffer pointer to the beginning of the buffer. */
- fp->__bufp = fp->__buffer;
-
- /* If we're not just flushing, write the last character, C. */
- if (!flush_only && !ferror (fp))
- {
- if (fp->__buffer == NULL || (fp->__linebuf && (unsigned char) c == '\n'))
- {
- /* Either we're unbuffered, or we're line-buffered and
- C is a newline, so really write it out immediately. */
- char cc = (unsigned char) c;
- if ((*fp->__io_funcs.__write)(fp->__cookie, &cc, 1) < 1)
- fp->__error = 1;
- else if (fp->__offset != -1)
- {
- /* Record that we've moved forward in the file. */
- ++fp->__offset;
- ++fp->__target;
- }
- }
- else
- /* Just put C in the buffer. */
- *fp->__bufp++ = (unsigned char) c;
- }
-
- end:
-
- if (!twiddled)
- {
- if (fp->__target != -1)
- /* The new target position moves up as
- much as the user wrote into the buffer. */
- fp->__target += buffer_written;
-
- /* Set the reading limit to the beginning of the buffer,
- so the next `getc' will call __fillbf. */
- fp->__get_limit = fp->__buffer;
- }
-
- if (feof (fp) || ferror (fp))
- fp->__bufp = fp->__put_limit;
-}
-
-
-/* Fill the buffer for FP and return the first character read (or EOF).
- This is the default `input_room' function. */
-static int
-fillbuf (register FILE *fp)
-{
- /* How far into the buffer we read we want to start bufp. */
- size_t buffer_offset = 0;
- register char *buffer;
- register size_t to_read, nread = 0;
- /* This must be unsigned to avoid sign extension in return. */
- unsigned char c;
-
- if (fp->__io_funcs.__read == NULL)
- {
- /* There is no read function, so always return EOF. */
- fp->__eof = 1;
- goto end;
- }
-
- if (fp->__buffer == NULL)
- {
- /* We're unbuffered, so we want to read only one character. */
- buffer = (char *) &c;
- to_read = 1;
- }
- else
- {
- /* We're buffered, so try to fill the buffer. */
- buffer = fp->__buffer;
- to_read = fp->__bufsize;
- }
-
- /* We're reading, so we're not at the end-of-file. */
- fp->__eof = 0;
-
- /* Go to the target file position. */
- {
- int save = errno;
- if (__stdio_check_offset (fp) == 0 && fp->__target != fp->__offset)
- {
- /* Move to a block (buffer size) boundary. */
- if (fp->__bufsize != 0)
- {
- buffer_offset = fp->__target % fp->__bufsize;
- fp->__target -= buffer_offset;
- }
- seek_to_target (fp);
- }
- __set_errno (save);
- }
-
- while (!ferror (fp) && !feof (fp) && nread <= buffer_offset)
- {
- /* Try to fill the buffer. */
- int count = (*fp->__io_funcs.__read) (fp->__cookie, buffer, to_read);
- if (count == 0)
- fp->__eof = 1;
- else if (count < 0)
- fp->__error = 1;
- else
- {
- buffer += count;
- nread += count;
- to_read -= count;
- if (fp->__offset != -1)
- /* Record that we've moved forward in the file. */
- fp->__offset += count;
- }
- }
-
- if (fp->__buffer == NULL)
- /* There is no buffer, so return the character we read
- without all the buffer pointer diddling. */
- return (feof (fp) || ferror (fp)) ? EOF : c;
-
- /* Reset the buffer pointer to the beginning of the buffer
- (plus whatever offset we may have set above). */
- fp->__bufp = fp->__buffer + buffer_offset;
-
- end:;
-
- if (feof (fp) || ferror (fp))
- {
- /* Set both end pointers to the beginning of the buffer so
- the next i/o call will force a call to __fillbf/__flshfp. */
- fp->__put_limit = fp->__get_limit = fp->__buffer;
- return EOF;
- }
-
- /* Set the end pointer to one past the last character we read. */
- fp->__get_limit = fp->__buffer + nread;
-
- /* Make it so the next `putc' will call __flshfp. */
- fp->__put_limit = fp->__buffer;
-
- /* Return the first character in the buffer. */
- return *((unsigned char *) (fp->__bufp++));
-}
-
-
-/* Default I/O and room functions. */
-
-extern __io_read_fn __stdio_read;
-extern __io_write_fn __stdio_write;
-extern __io_seek_fn __stdio_seek;
-extern __io_close_fn __stdio_close;
-extern __io_fileno_fn __stdio_fileno;
-const __io_functions __default_io_functions =
- {
- __stdio_read, __stdio_write, __stdio_seek, __stdio_close, __stdio_fileno
- };
-
-const __room_functions __default_room_functions =
- {
- fillbuf, flushbuf
- };
-
-
-/* Flush the buffer for FP and also write C if FLUSH_ONLY is nonzero.
- This is the function used by putc and fflush. */
-int
-__flshfp (fp, c)
- register FILE *fp;
- int c;
-{
- int flush_only = c == EOF;
-
- if (!__validfp (fp) || !fp->__mode.__write)
- {
- __set_errno (EINVAL);
- return EOF;
- }
-
- if (ferror (fp))
- return EOF;
-
- if (fp->__pushed_back)
- {
- /* Discard the char pushed back by ungetc. */
- fp->__bufp = fp->__pushback_bufp;
- fp->__pushed_back = 0;
- }
-
- /* Make sure the stream is initialized (has functions and buffering). */
- init_stream (fp);
-
- /* Do this early, so a `putc' on such a stream will never return success. */
- if (fp->__room_funcs.__output == NULL)
- {
- /* A NULL `output room' function means
- to always return an output error. */
- fp->__error = 1;
- return EOF;
- }
-
- if (!flush_only &&
- /* Will C fit into the buffer?
- See below about linebuf_active. */
- fp->__bufp < (fp->__linebuf_active ? fp->__buffer + fp->__bufsize :
- fp->__put_limit))
- {
- /* The character will fit in the buffer, so put it there. */
- *fp->__bufp++ = (unsigned char) c;
- if (fp->__linebuf && (unsigned char) c == '\n')
- flush_only = 1;
- else
- return (unsigned char) c;
- }
-
- if (fp->__linebuf_active)
- /* This is an active line-buffered stream, so its put-limit is set
- to the beginning of the buffer in order to force a __flshfp call
- on each putc (see below). We undo this hack here (by setting
- the limit to the end of the buffer) to simplify the interface
- with the output-room function. */
- fp->__put_limit = fp->__buffer + fp->__bufsize;
-
- /* Make room in the buffer. */
- (*fp->__room_funcs.__output) (fp, flush_only ? EOF : (unsigned char) c);
-
- if (fp->__linebuf)
- {
- /* This is a line-buffered stream, and it is now ready to do
- some output. We call this an "active line-buffered stream".
- We set the put_limit to the beginning of the buffer,
- so the next `putc' call will force a call to this function.
- Setting the linebuf_active flag tells the code above
- (on the next call) to undo this hackery. */
- fp->__put_limit = fp->__buffer;
- fp->__linebuf_active = 1;
- }
-
- if (ferror (fp))
- return EOF;
- if (flush_only)
- return 0;
- return (unsigned char) c;
-}
-
-
-/* Fill the buffer for FP and return the first character read.
- This is the function used by getc. */
-int
-__fillbf (fp)
- register FILE *fp;
-{
- register int c;
- fpos_t new_target;
-
- if (!__validfp (fp) || !fp->__mode.__read)
- {
- __set_errno (EINVAL);
- return EOF;
- }
-
- if (fp->__pushed_back)
- {
- /* Return the char pushed back by ungetc. */
- fp->__bufp = fp->__pushback_bufp;
- fp->__pushed_back = 0;
- return fp->__pushback;
- }
-
- /* Make sure the stream is initialized (has functions and buffering). */
- init_stream (fp);
-
- /* If we're trying to read the first character of a new
- line of input from an unbuffered or line buffered stream,
- we must flush all line-buffered output streams. */
- if (fp->__buffer == NULL || fp->__linebuf)
- {
- register FILE *f;
- for (f = __stdio_head; f != NULL; f = f->__next)
- if (__validfp (f) && f->__linebuf && f->__mode.__write)
- (void) __flshfp (f, EOF);
- }
-
- /* Note we must do this after flushing all line-buffered
- streams, or else __flshfp would undo it! */
- if (fp->__linebuf_active)
- {
- /* This is an active line-buffered stream, meaning it is in the midst
- of writing, but has a bogus put_limit. Restore it to normality. */
- fp->__put_limit = fp->__buffer + fp->__bufsize;
- fp->__linebuf_active = 0;
- }
-
- /* We want the beginning of the buffer to now
- map to just past the last data we read. */
- new_target = fp->__target + (fp->__get_limit - fp->__buffer);
-
- if (fp->__put_limit > fp->__buffer)
- {
- /* There is written data in the buffer.
- Flush it out. */
- if (fp->__room_funcs.__output == NULL)
- fp->__error = 1;
- else
- (*fp->__room_funcs.__output) (fp, EOF);
- }
-
- fp->__target = new_target;
-
- if (ferror (fp))
- c = EOF;
- else if (fp->__room_funcs.__input != NULL)
- {
- c = (*fp->__room_funcs.__input) (fp);
- if (fp->__buffer == NULL)
- /* This is an unbuffered stream, so the target sync above
- won't do anything the next time around. Instead, note that
- we have read one character. The (nonexistent) buffer now
- maps to the position just past that character. */
- ++fp->__target;
- }
- else
- {
- /* A NULL `input_room' function means always return EOF. */
- fp->__eof = 1;
- c = EOF;
- }
-
- return c;
-}
-
-
-/* Nuke a stream, but don't kill its link in the chain. */
-void
-__invalidate (stream)
- register FILE *stream;
-{
- /* Save its link. */
- register FILE *next = stream->__next;
-
- /* Pulverize the deceased. */
- memset((void *) stream, 0, sizeof(FILE));
-
- /* Restore the deceased's link. */
- stream->__next = next;
-}
diff --git a/stdio/linewrap.c b/stdio/linewrap.c
deleted file mode 100644
index eab8c75ff3..0000000000
--- a/stdio/linewrap.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/* Word-wrapping and line-truncating streams.
- Copyright (C) 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <linewrap.h>
-
-void __line_wrap_output (FILE *, int);
-
-/* Install our hooks into a stream. */
-static inline void
-wrap_stream (FILE *stream, struct line_wrap_data *d)
-{
- static __io_close_fn lwclose;
- static __io_fileno_fn lwfileno;
-
- stream->__cookie = d;
- stream->__room_funcs.__output = &__line_wrap_output;
- stream->__io_funcs.__close = &lwclose;
- stream->__io_funcs.__fileno = &lwfileno;
- stream->__io_funcs.__seek = NULL; /* Cannot seek. */
-}
-
-/* Restore a stream to its original state. */
-static inline void
-unwrap_stream (FILE *stream, struct line_wrap_data *d)
-{
- stream->__cookie = d->cookie;
- stream->__room_funcs.__output = d->output;
- stream->__io_funcs.__close = d->close;
- stream->__io_funcs.__fileno = d->fileno;
- stream->__io_funcs.__seek = d->seek;
-}
-
-/* If WRAPPER_COOKIE points to a 0 pointer, then STREAM is assumed to be
- wrapped, and will be unwrapped, storing the wrapper cookie into
- WRAPPER_COOKIE. Otherwise, nothing is done. */
-static inline void
-ensure_unwrapped (FILE *stream, struct line_wrap_data **wrapper_cookie)
-{
- if (*wrapper_cookie == 0)
- {
- *wrapper_cookie = stream->__cookie;
- unwrap_stream (stream, *wrapper_cookie);
- }
-}
-
-/* If WRAPPER_COOKIE points to a non-0 pointer, then STREAM is assumed to
- *have been unwrapped with ensure_unwrapped, will be wrapped with
- *WRAPPER_COOKIE, and *WRAPPER_COOKIE zeroed. Otherwise, nothing is done. */
-static inline void
-ensure_wrapped (FILE *stream, struct line_wrap_data **wrapper_cookie)
-{
- if (*wrapper_cookie)
- {
- wrap_stream (stream, *wrapper_cookie);
- *wrapper_cookie = 0;
- }
-}
-
-/* Cookie io functions that might get called on a wrapped stream.
- Must pass the original cookie to the original functions. */
-
-static int
-lwclose (void *cookie)
-{
- struct line_wrap_data *d = cookie;
- return (*d->close) (d->cookie);
-}
-
-static int
-lwfileno (void *cookie)
-{
- struct line_wrap_data *d = cookie;
- return (*d->fileno) (d->cookie);
-}
-
-/* Process STREAM's buffer so that line wrapping is done from POINT_OFFS to
- the end of its buffer. If WRAPPER_COOKIE is 0, and it's necessary to
- flush some data, STREAM is unwrapped, and the line wrap stdio cookie
- stored in WRAPPER_COOKIE; otherwise, stream is assumed to already be
- unwrapped, and WRAPPER_COOKIE to point to the line wrap data. Returns C
- or EOF if C was output. */
-static inline int
-lwupdate (FILE *stream, int c, struct line_wrap_data **wrapper_cookie)
-{
- char *buf, *nl;
- size_t len;
- struct line_wrap_data *d = *wrapper_cookie ?: stream->__cookie;
-
- /* Scan the buffer for newlines. */
- buf = stream->__buffer + d->point_offs;
- while ((buf < stream->__bufp || (c != EOF && c != '\n')) && !stream->__error)
- {
- size_t r;
-
- if (d->point_col == 0 && d->lmargin != 0)
- {
- /* We are starting a new line. Print spaces to the left margin. */
- const size_t pad = d->lmargin;
- if (stream->__bufp + pad < stream->__put_limit)
- {
- /* We can fit in them in the buffer by moving the
- buffer text up and filling in the beginning. */
- memmove (buf + pad, buf, stream->__bufp - buf);
- stream->__bufp += pad; /* Compensate for bigger buffer. */
- memset (buf, ' ', pad); /* Fill in the spaces. */
- buf += pad; /* Don't bother searching them. */
- }
- else
- {
- /* No buffer space for spaces. Must flush. */
- size_t i;
- char *olimit;
-
- ensure_unwrapped (stream, wrapper_cookie);
-
- len = stream->__bufp - buf;
- olimit = stream->__put_limit;
- stream->__bufp = stream->__put_limit = buf;
- for (i = 0; i < pad; ++i)
- (*d->output) (stream, ' ');
- stream->__put_limit = olimit;
- memmove (stream->__bufp, buf, len);
- stream->__bufp += len;
- }
- d->point_col = pad;
- }
-
- len = stream->__bufp - buf;
- nl = memchr (buf, '\n', len);
-
- if (d->point_col < 0)
- d->point_col = 0;
-
- if (!nl)
- {
- /* The buffer ends in a partial line. */
-
- if (d->point_col + len + (c != EOF && c != '\n') < d->rmargin)
- {
- /* The remaining buffer text is a partial line and fits
- within the maximum line width. Advance point for the
- characters to be written and stop scanning. */
- d->point_col += len;
- break;
- }
- else
- /* Set the end-of-line pointer for the code below to
- the end of the buffer. */
- nl = stream->__bufp;
- }
- else if ((size_t) d->point_col + (nl - buf) < d->rmargin)
- {
- /* The buffer contains a full line that fits within the maximum
- line width. Reset point and scan the next line. */
- d->point_col = 0;
- buf = nl + 1;
- continue;
- }
-
- /* This line is too long. */
- r = d->rmargin - 1;
-
- if (d->wmargin < 0)
- {
- /* Truncate the line by overwriting the excess with the
- newline and anything after it in the buffer. */
- if (nl < stream->__bufp)
- {
- memmove (buf + (r - d->point_col), nl, stream->__bufp - nl);
- stream->__bufp -= buf + (r - d->point_col) - nl;
- /* Reset point for the next line and start scanning it. */
- d->point_col = 0;
- buf += r + 1; /* Skip full line plus \n. */
- }
- else
- {
- /* The buffer ends with a partial line that is beyond the
- maximum line width. Advance point for the characters
- written, and discard those past the max from the buffer. */
- d->point_col += len;
- stream->__bufp -= d->point_col - r;
- if (c != '\n')
- /* Swallow the extra character too. */
- c = EOF;
- break;
- }
- }
- else
- {
- /* Do word wrap. Go to the column just past the maximum line
- width and scan back for the beginning of the word there.
- Then insert a line break. */
-
- char *p, *nextline;
- int i;
-
- p = buf + (r + 1 - d->point_col);
- while (p >= buf && !isblank (*p))
- --p;
- nextline = p + 1; /* This will begin the next line. */
-
- if (nextline > buf)
- {
- /* Swallow separating blanks. */
- do
- --p;
- while (isblank (*p));
- nl = p + 1; /* The newline will replace the first blank. */
- }
- else
- {
- /* A single word that is greater than the maximum line width.
- Oh well. Put it on an overlong line by itself. */
- p = buf + (r + 1 - d->point_col);
- /* Find the end of the long word. */
- do
- ++p;
- while (p < nl && !isblank (*p));
- if (p == nl)
- {
- /* It already ends a line. No fussing required. */
- d->point_col = 0;
- buf = nl + 1;
- continue;
- }
- /* We will move the newline to replace the first blank. */
- nl = p;
- /* Swallow separating blanks. */
- do
- ++p;
- while (isblank (*p));
- /* The next line will start here. */
- nextline = p;
- }
-
- /* Temporarily reset bufp to include just the first line. */
- stream->__bufp = nl;
- if (nextline - (nl + 1) < d->wmargin)
- /* The margin needs more blanks than we removed.
- Output the first line so we can use the space. */
- {
- ensure_unwrapped (stream, wrapper_cookie);
- (*d->output) (stream, '\n');
- }
- else
- /* We can fit the newline and blanks in before
- the next word. */
- *stream->__bufp++ = '\n';
-
- /* Reset the counter of what has been output this line. If wmargin
- is 0, we want to avoid the lmargin getting added, so we set
- point_col to a magic value of -1 in that case. */
- d->point_col = d->wmargin ? d->wmargin : -1;
-
- /* Add blanks up to the wrap margin column. */
- for (i = 0; i < d->wmargin; ++i)
- *stream->__bufp++ = ' ';
-
- /* Copy the tail of the original buffer into the current buffer
- position. */
- if (stream->__bufp != nextline)
- memmove (stream->__bufp, nextline, buf + len - nextline);
- len -= nextline - buf;
-
- /* Continue the scan on the remaining lines in the buffer. */
- buf = stream->__bufp;
-
- /* Restore bufp to include all the remaining text. */
- stream->__bufp += len;
- }
- }
-
- /* Remember that we've scanned as far as the end of the buffer. */
- d->point_offs = stream->__bufp - stream->__buffer;
-
- return c;
-}
-
-/* This function is called when STREAM must be flushed.
- C is EOF or a character to be appended to the buffer contents. */
-void
-__line_wrap_output (FILE *stream, int c)
-{
- struct line_wrap_data *d = 0;
-
- c = lwupdate (stream, c, &d);
-
- if (!stream->__error)
- {
- ensure_unwrapped (stream, &d);
- (*d->output) (stream, c);
- d->point_offs = 0; /* The buffer now holds nothing. */
- if (c == '\n')
- d->point_col = 0;
- else if (c != EOF)
- ++d->point_col;
- }
-
- ensure_wrapped (stream, &d);
-}
-
-/* Modify STREAM so that it prefixes lines written on it with LMARGIN spaces
- and limits them to RMARGIN columns total. If WMARGIN >= 0, words that
- extend past RMARGIN are wrapped by replacing the whitespace before them
- with a newline and WMARGIN spaces. Otherwise, chars beyond RMARGIN are
- simply dropped until a newline. Returns STREAM after modifying it, or
- NULL if there was an error. */
-FILE *
-line_wrap_stream (FILE *stream, size_t lmargin, size_t rmargin, ssize_t wmargin)
-{
- struct line_wrap_data *d = malloc (sizeof *d);
-
- if (!d)
- return NULL;
-
- /* Ensure full setup before we start tweaking. */
- fflush (stream);
-
- /* Initialize our wrapping state. */
- d->point_col = 0;
- d->point_offs = 0;
-
- /* Save the original cookie and output and close hooks. */
- d->cookie = stream->__cookie;
- d->output = stream->__room_funcs.__output;
- d->close = stream->__io_funcs.__close;
- d->fileno = stream->__io_funcs.__fileno;
- d->seek = stream->__io_funcs.__seek;
-
- /* Take over the stream. */
- wrap_stream (stream, d);
-
- /* Line-wrapping streams are normally line-buffered. This is not
- required, just assumed desired. The wrapping feature should continue
- to work if the stream is switched to full or no buffering. */
- stream->__linebuf = 1;
-
- d->lmargin = lmargin;
- d->rmargin = rmargin;
- d->wmargin = wmargin;
-
- return stream;
-}
-
-/* Remove the hooks placed in STREAM by `line_wrap_stream'. */
-void
-line_unwrap_stream (FILE *stream)
-{
- struct line_wrap_data *d = stream->__cookie;
- unwrap_stream (stream, d);
- free (d);
-}
-
-/* Functions on wrapped streams. */
-
-/* Returns true if STREAM is line wrapped. */
-inline int
-line_wrapped (FILE *stream)
-{
- return (stream->__room_funcs.__output == &__line_wrap_output);
-}
-
-/* If STREAM is not line-wrapped, return 0. Otherwise all pending text
- buffered text in STREAM so that the POINT_OFFS field refers to the last
- position in the stdio buffer, and return the line wrap state object for
- STREAM. Since all text has been processed, this means that (1) the
- POINT_COL field refers to the column at which any new text would be added,
- and (2) any changes to the margin parameters will only affect new text. */
-struct line_wrap_data *
-__line_wrap_update (FILE *stream)
-{
- if (line_wrapped (stream))
- {
- struct line_wrap_data *d = stream->__cookie, *wc = 0;
-
- if (stream->__linebuf_active)
- /* This is an active line-buffered stream, so its put-limit is set to
- the beginning of the buffer in order to force a __flshfp call on
- each putc (see below). We undo this hack here (by setting the
- limit to the end of the buffer) to simplify the interface with the
- output-room function. */
- stream->__put_limit = stream->__buffer + stream->__bufsize;
-
- lwupdate (stream, EOF, &wc);
-
- if (stream->__linebuf)
- {
- /* This is a line-buffered stream, and it is now ready to do some
- output. We call this an "active line-buffered stream". We set
- the put_limit to the beginning of the buffer, so the next `putc'
- call will force a call to flshfp. Setting the linebuf_active
- flag tells the code above (on the next call) to undo this
- hackery. */
- stream->__put_limit = stream->__buffer;
- stream->__linebuf_active = 1;
- }
-
- ensure_wrapped (stream, &wc);
-
- return d;
- }
- else
- return 0;
-}
-
-/* If STREAM is not line-wrapped return -1, else return its left margin. */
-inline size_t
-line_wrap_lmargin (FILE *stream)
-{
- if (! line_wrapped (stream))
- return -1;
- return ((struct line_wrap_data *)stream->__cookie)->lmargin;
-}
-
-/* If STREAM is not line-wrapped return -1, else set its left margin to
- LMARGIN and return the old value. */
-inline size_t
-line_wrap_set_lmargin (FILE *stream, size_t lmargin)
-{
- struct line_wrap_data *d = __line_wrap_update (stream);
- if (d)
- {
- size_t old = d->lmargin;
- d->lmargin = lmargin;
- return old;
- }
- else
- return -1;
-}
-
-/* If STREAM is not line-wrapped return -1, else return its left margin. */
-inline size_t
-line_wrap_rmargin (FILE *stream)
-{
- if (! line_wrapped (stream))
- return -1;
- return ((struct line_wrap_data *)stream->__cookie)->rmargin;
-}
-
-/* If STREAM is not line-wrapped return -1, else set its right margin to
- RMARGIN and return the old value. */
-inline size_t
-line_wrap_set_rmargin (FILE *stream, size_t rmargin)
-{
- struct line_wrap_data *d = __line_wrap_update (stream);
- if (d)
- {
- size_t old = d->rmargin;
- d->rmargin = rmargin;
- return old;
- }
- else
- return -1;
-}
-
-/* If STREAM is not line-wrapped return -1, else return its wrap margin. */
-inline size_t
-line_wrap_wmargin (FILE *stream)
-{
- if (! line_wrapped (stream))
- return -1;
- return ((struct line_wrap_data *)stream->__cookie)->wmargin;
-}
-
-/* If STREAM is not line-wrapped return -1, else set its left margin to
- WMARGIN and return the old value. */
-inline size_t
-line_wrap_set_wmargin (FILE *stream, size_t wmargin)
-{
- struct line_wrap_data *d = __line_wrap_update (stream);
- if (d)
- {
- size_t old = d->wmargin;
- d->wmargin = wmargin;
- return old;
- }
- else
- return -1;
-}
-
-/* If STREAM is not line-wrapped return -1, else return the column number of
- the current output point. */
-inline size_t
-line_wrap_point (FILE *stream)
-{
- struct line_wrap_data *d = __line_wrap_update (stream);
- return d ? (d->point_col >= 0 ? d->point_col : 0) : -1;
-}
-
-#ifdef TEST
-int
-main (int argc, char **argv)
-{
- int c;
- puts ("stopme");
- line_wrap_stream (stdout, atoi (argv[1]), atoi (argv[2] ?: "-1"));
- while ((c = getchar()) != EOF) putchar (c);
- return 0;
-}
-#endif
diff --git a/stdio/linewrap.h b/stdio/linewrap.h
deleted file mode 100644
index 5aad9f62e2..0000000000
--- a/stdio/linewrap.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/* Word-wrapping and line-truncating streams.
- Copyright (C) 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef __LINEWRAP_H__
-#define __LINEWRAP_H__
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-
-#include <features.h>
-
-#include <string.h> /* Need size_t. */
-
-__BEGIN_DECLS
-
-/* We keep this data for each line-wrapping stream. */
-struct line_wrap_data
- {
- size_t lmargin, rmargin; /* Left and right margins. */
- ssize_t wmargin; /* Margin to wrap to, or -1 to truncate. */
-
- /* Point in stdio buffer to which we've processed for wrapping, but
- not output. */
- size_t point_offs;
- /* Output column at POINT_OFFS, or -1 meaning 0 but don't add lmargin. */
- ssize_t point_col;
-
- /* Original cookie and hooks from the stream. */
- void *cookie;
- void (*output) (FILE *, int);
- __io_close_fn *close;
- __io_fileno_fn *fileno;
- __io_seek_fn *seek;
- };
-
-/* Modify STREAM so that it prefixes lines written on it with LMARGIN spaces
- and limits them to RMARGIN columns total. If WMARGIN >= 0, words that
- extend past RMARGIN are wrapped by replacing the whitespace before them
- with a newline and WMARGIN spaces. Otherwise, chars beyond RMARGIN are
- simply dropped until a newline. Returns STREAM after modifying it, or
- NULL if there was an error. */
-FILE *line_wrap_stream (FILE *stream,
- size_t lmargin, size_t rmargin, ssize_t wmargin);
-
-/* Remove the hooks placed in STREAM by `line_wrap_stream'. */
-void line_unwrap_stream (FILE *stream);
-
-/* Returns true if STREAM is line wrapped. */
-extern inline int line_wrapped (FILE *stream);
-
-/* If STREAM is not line-wrapped return -1, else return its left margin. */
-extern size_t line_wrap_lmargin (FILE *stream);
-
-/* If STREAM is not line-wrapped return -1, else set its left margin to
- LMARGIN and return the old value. */
-extern size_t line_wrap_set_lmargin (FILE *stream, size_t lmargin);
-
-/* If STREAM is not line-wrapped return -1, else return its left margin. */
-extern size_t line_wrap_rmargin (FILE *stream);
-
-/* If STREAM is not line-wrapped return -1, else set its right margin to
- RMARGIN and return the old value. */
-extern size_t line_wrap_set_rmargin (FILE *stream, size_t rmargin);
-
-/* If STREAM is not line-wrapped return -1, else return its wrap margin. */
-extern size_t line_wrap_wmargin (FILE *stream);
-
-/* If STREAM is not line-wrapped return -1, else set its left margin to
- WMARGIN and return the old value. */
-extern size_t line_wrap_set_wmargin (FILE *stream, size_t wmargin);
-
-/* If STREAM is not line-wrapped return -1, else return the column number of
- the current output point. */
-extern size_t line_wrap_point (FILE *stream);
-
-#ifdef __OPTIMIZE__
-
-extern void __line_wrap_output (FILE *, int); /* private */
-
-/* If STREAM is not line-wrapped, return 0. Otherwise all pending text
- buffered text in STREAM so that the POINT_OFFS field refers to the last
- position in the stdio buffer, and return the line wrap state object for
- STREAM. Since all text has been processed, this means that (1) the
- POINT_COL field refers to the column at which any new text would be added,
- and (2) any changes to the margin parameters will only affect new text. */
-extern struct line_wrap_data *__line_wrap_update (FILE *stream); /* private */
-
-/* Returns true if STREAM is line wrapped. */
-extern inline int
-line_wrapped (FILE *stream)
-{
- return (stream->__room_funcs.__output == &__line_wrap_output);
-}
-
-/* If STREAM is not line-wrapped return -1, else return its left margin. */
-extern inline size_t
-line_wrap_lmargin (FILE *stream)
-{
- if (! line_wrapped (stream))
- return -1;
- return ((struct line_wrap_data *)stream->__cookie)->lmargin;
-}
-
-/* If STREAM is not line-wrapped return -1, else set its left margin to
- LMARGIN and return the old value. */
-extern inline size_t
-line_wrap_set_lmargin (FILE *stream, size_t lmargin)
-{
- struct line_wrap_data *d = __line_wrap_update (stream);
- if (d)
- {
- size_t old = d->lmargin;
- d->lmargin = lmargin;
- return old;
- }
- else
- return -1;
-}
-
-/* If STREAM is not line-wrapped return -1, else return its left margin. */
-extern inline size_t
-line_wrap_rmargin (FILE *stream)
-{
- if (! line_wrapped (stream))
- return -1;
- return ((struct line_wrap_data *)stream->__cookie)->rmargin;
-}
-
-/* If STREAM is not line-wrapped return -1, else set its right margin to
- RMARGIN and return the old value. */
-extern inline size_t
-line_wrap_set_rmargin (FILE *stream, size_t rmargin)
-{
- struct line_wrap_data *d = __line_wrap_update (stream);
- if (d)
- {
- size_t old = d->rmargin;
- d->rmargin = rmargin;
- return old;
- }
- else
- return -1;
-}
-
-/* If STREAM is not line-wrapped return -1, else return its wrap margin. */
-extern inline size_t
-line_wrap_wmargin (FILE *stream)
-{
- if (! line_wrapped (stream))
- return -1;
- return ((struct line_wrap_data *)stream->__cookie)->wmargin;
-}
-
-/* If STREAM is not line-wrapped return -1, else set its left margin to
- WMARGIN and return the old value. */
-extern inline size_t
-line_wrap_set_wmargin (FILE *stream, size_t wmargin)
-{
- struct line_wrap_data *d = __line_wrap_update (stream);
- if (d)
- {
- size_t old = d->wmargin;
- d->wmargin = wmargin;
- return old;
- }
- else
- return -1;
-}
-
-/* If STREAM is not line-wrapped return -1, else return the column number of
- the current output point. */
-extern inline size_t
-line_wrap_point (FILE *stream)
-{
- struct line_wrap_data *d = __line_wrap_update (stream);
- return d ? (d->point_col >= 0 ? d->point_col : 0) : -1;
-}
-
-#endif /* Optimizing. */
-
-__END_DECLS
-
-#endif /* __LINEWRAP_H__ */
diff --git a/stdio/memstream.c b/stdio/memstream.c
deleted file mode 100644
index b400bb7d27..0000000000
--- a/stdio/memstream.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-struct memstream_info
- {
- char **buffer;
- size_t *bufsize;
- };
-
-/* Enlarge STREAM's buffer. */
-static void
-enlarge_buffer (register FILE *stream, int c)
-{
- struct memstream_info *info = (struct memstream_info *) stream->__cookie;
- size_t need;
-
- if (stream->__put_limit != stream->__buffer)
- /* Record how much has actually been written into the buffer. */
- *info->bufsize = stream->__bufp - stream->__buffer;
-
- if (stream->__target != -1
- && (size_t) stream->__target > *info->bufsize)
- /* Our target (where the buffer maps to) is always zero except when
- the user just did a SEEK_END fseek. If he sought within the
- buffer, we need do nothing and will zero the target below. If he
- sought past the end of the object, grow and zero-fill the buffer
- up to the target address. */
- need = stream->__target;
- else
- need = *info->bufsize;
-
- /* We always need an extra character in the buffer. Either we are
- writing C, or we are flushing and need to write a NUL terminator. */
- ++need;
-
- if (stream->__bufsize < need)
- {
- /* Enlarge the buffer. */
- char *newbuf;
- size_t newsize;
- if (stream->__bufsize * 2 < need)
- newsize = need;
- else
- newsize = stream->__bufsize * 2;
- newbuf = (char *) realloc ((void *) stream->__buffer, newsize);
- if (newbuf == NULL)
- {
- stream->__error = 1;
- return;
- }
- *info->buffer = stream->__buffer = newbuf;
- stream->__bufsize = newsize;
- }
-
- stream->__target = stream->__offset = 0;
- stream->__get_limit = stream->__bufp = stream->__buffer + *info->bufsize;
- stream->__put_limit = stream->__buffer + stream->__bufsize;
-
- need -= stream->__bufp - stream->__buffer + 1;
- if (need > 0)
- {
- /* We are extending the buffer after an fseek; zero-fill new space. */
- memset (stream->__bufp, '\0', need);
- stream->__bufp += need;
- }
-
- if (c != EOF)
- *stream->__bufp++ = (unsigned char) c;
- else
- *stream->__bufp = '\0';
-}
-
-/* Seek function for memstreams.
- There is no external state to munge. */
-
-static int
-seek (void *cookie, fpos_t *pos, int whence)
-{
- switch (whence)
- {
- case SEEK_SET:
- case SEEK_CUR:
- return 0;
-
- case SEEK_END:
- /* Return the position relative to the end of the object.
- fseek has just flushed us, so the info is consistent. */
- *pos += *((struct memstream_info *) cookie)->bufsize;
- return 0;
-
- default:
- __libc_fatal ("memstream::seek called with bogus WHENCE\n");
- return -1;
- }
-}
-
-static int
-free_info (void *cookie)
-{
-#if 0
- struct memstream_info *info = (struct memstream_info *) cookie;
- char *buf;
-
- buf = (char *) realloc ((PTR) *info->buffer, *info->bufsize);
- if (buf != NULL)
- *info->buffer = buf;
-#endif
-
- free (cookie);
-
- return 0;
-}
-
-/* Open a stream that writes into a malloc'd buffer that is expanded as
- necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
- and the number of characters written on fflush or fclose. */
-FILE *
-open_memstream (bufloc, sizeloc)
- char **bufloc;
- size_t *sizeloc;
-{
- FILE *stream;
- struct memstream_info *info;
-
- if (bufloc == NULL || sizeloc == NULL)
- {
- __set_errno (EINVAL);
- return NULL;
- }
-
- stream = fmemopen ((char *) NULL, BUFSIZ, "w+");
- if (stream == NULL)
- return NULL;
-
- info = (struct memstream_info *) malloc (sizeof (struct memstream_info));
- if (info == NULL)
- {
- int save = errno;
- (void) fclose (stream);
- __set_errno (save);
- return NULL;
- }
-
- stream->__room_funcs.__output = enlarge_buffer;
- stream->__io_funcs.__seek = seek;
- stream->__io_funcs.__close = free_info;
- stream->__cookie = (void *) info;
- stream->__userbuf = 1;
-
- info->buffer = bufloc;
- info->bufsize = sizeloc;
-
- *bufloc = stream->__buffer;
-
- return stream;
-}
diff --git a/stdio/newstream.c b/stdio/newstream.c
deleted file mode 100644
index 850baf7b35..0000000000
--- a/stdio/newstream.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/* Return a new, zeroed, stream.
- You must set its cookie and io_mode.
- The first operation will give it a buffer unless you do.
- It will also give it the default functions unless you set the `seen' flag.
- Returns NULL if a stream can't be created. */
-FILE *
-__newstream (void)
-{
- register FILE *stream;
-
- stream = __stdio_head;
- while (__validfp (stream))
- stream = stream->__next;
- if (stream == NULL)
- {
- /* None to reuse. */
- stream = (FILE *) malloc (sizeof (FILE));
- if (stream == NULL)
- return NULL;
- stream->__next = __stdio_head;
- __stdio_head = stream;
- }
-
- __invalidate (stream);
- stream->__magic = _IOMAGIC;
- stream->__offset = (fpos_t) -1;
- stream->__target = (fpos_t) -1;
-
- return stream;
-}
diff --git a/stdio/obstream.c b/stdio/obstream.c
deleted file mode 100644
index 06118f5416..0000000000
--- a/stdio/obstream.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* Copyright (C) 1992, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-#include <obstack.h>
-#include <stdarg.h>
-#include <string.h>
-
-/* Output-room function for obstack streams. */
-
-static void
-grow (FILE *stream, int c)
-{
- struct obstack *const obstack = (struct obstack *) stream->__cookie;
-
- /* Move the end of the object back to include only the portion
- of the buffer which the user has already written into. */
- obstack_blank_fast (obstack, - (stream->__put_limit - stream->__bufp));
-
- if ((size_t) stream->__target > obstack_object_size (obstack))
- {
- /* Our target (where the buffer maps to) is always zero except when
- the user just did a SEEK_END fseek. If he sought within the
- buffer, we need do nothing and will zero the target below. If he
- sought past the end of the object, grow and zero-fill the object
- up to the target address. */
-
- obstack_blank (obstack,
- stream->__target - obstack_object_size (obstack));
- /* fseek has just flushed us, so the put limit points
- to the end of the written data. */
- bzero (stream->__put_limit,
- stream->__target - stream->__bufsize);
- }
-
- if (c != EOF)
- obstack_1grow (obstack, (unsigned char) c);
-
- /* The stream buffer always maps exactly to the object on the top
- of the obstack. The start of the buffer is the start of the object.
- The put limit points just past the end of the object. On fflush, the
- obstack is sync'd so the end of the object points just past the last
- character written to the stream. */
-
- stream->__target = stream->__offset = 0;
- stream->__buffer = obstack_base (obstack);
- stream->__bufsize = obstack_room (obstack);
- stream->__bufp = obstack_next_free (obstack);
- stream->__get_limit = stream->__bufp;
-
- if (c == EOF)
- /* This is fflush. Make the stream buffer, the object,
- and the characters actually written all match. */
- stream->__put_limit = stream->__get_limit;
- else
- {
- /* Extend the buffer (and the object) to include
- the rest of the obstack chunk (which is uninitialized).
- Data past bufp is undefined. */
- stream->__put_limit = stream->__buffer + stream->__bufsize;
- obstack_blank_fast (obstack, stream->__put_limit - stream->__bufp);
- }
-}
-
-/* Seek function for obstack streams.
- There is no external state to munge. */
-
-static int
-seek (void *cookie, fpos_t *pos, int whence)
-{
- switch (whence)
- {
- case SEEK_SET:
- case SEEK_CUR:
- return 0;
-
- case SEEK_END:
- /* Return the position relative to the end of the object.
- fseek has just flushed us, so the obstack is consistent. */
- *pos += obstack_object_size ((struct obstack *) cookie);
- return 0;
-
- default:
- __libc_fatal ("obstream::seek called with bogus WHENCE\n");
- return -1;
- }
-}
-
-/* Input room function for obstack streams.
- Only what has been written to the stream can be read back. */
-
-static int
-input (FILE *stream)
-{
- /* Re-sync with the obstack, growing the object if necessary. */
- grow (stream, EOF);
-
- if (stream->__bufp < stream->__get_limit)
- return (unsigned char) *stream->__bufp++;
-
- stream->__eof = 1;
- return EOF;
-}
-
-/* Initialize STREAM to talk to OBSTACK. */
-
-static void
-init_obstream (FILE *stream, struct obstack *obstack)
-{
- stream->__mode.__write = 1;
- stream->__mode.__read = 1;
-
- /* Input can read only what has been written. */
- stream->__room_funcs.__input = input;
-
- /* Do nothing for close. */
- stream->__io_funcs.__close = NULL;
-
- /* When the buffer is full, grow the obstack. */
- stream->__room_funcs.__output = grow;
-
- /* Seek within the object, and extend it. */
- stream->__io_funcs.__seek = seek;
- stream->__target = stream->__offset = 0;
-
- stream->__seen = 1;
-
- /* Don't deallocate that buffer! */
- stream->__userbuf = 1;
-
- /* We don't have to initialize the buffer.
- The first read attempt will call grow, which will do all the work. */
-}
-
-FILE *
-open_obstack_stream (obstack)
- struct obstack *obstack;
-{
- register FILE *stream;
-
- stream = __newstream ();
- if (stream == NULL)
- return NULL;
-
- init_obstream (stream, obstack);
- return stream;
-}
-
-int
-obstack_vprintf (obstack, format, args)
- struct obstack *obstack;
- const char *format;
- va_list args;
-{
- FILE f;
- bzero (&f, sizeof (f));
- init_obstream (&f, obstack);
- return vfprintf (&f, format, args);
-}
-
-int
-obstack_printf (struct obstack *obstack, const char *format, ...)
-{
- int result;
- va_list ap;
- va_start (ap, format);
- result = obstack_vprintf (obstack, format, ap);
- va_end (ap);
- return result;
-}
diff --git a/stdio/putc.c b/stdio/putc.c
deleted file mode 100644
index f35f9775bf..0000000000
--- a/stdio/putc.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdio.h>
-#undef putc
-#define fputc putc
-#define fputc_unlocked putc_unlocked
-#include <fputc.c>
-weak_alias (putc, putc_unlocked)
diff --git a/stdio/putchar.c b/stdio/putchar.c
deleted file mode 100644
index d946d74c4c..0000000000
--- a/stdio/putchar.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1991, 1997, 1998 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-
-#undef putchar
-
-
-/* Write the character C on stdout. */
-int
-putchar (int c)
-{
- return __putc (c, stdout);
-}
-
-weak_alias (putchar, putchar_unlocked)
diff --git a/stdio/puts.c b/stdio/puts.c
deleted file mode 100644
index 5dc2840475..0000000000
--- a/stdio/puts.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1991, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-
-#undef puts
-
-
-/* Write the string in S and a newline to stdout. */
-int
-puts (const char *s)
-{
- return fputs (s, stdout) || putchar ('\n') == EOF ? EOF : 0;
-}
diff --git a/stdio/rewind.c b/stdio/rewind.c
deleted file mode 100644
index 54f8609597..0000000000
--- a/stdio/rewind.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1991, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-
-#undef rewind
-
-
-/* Rewind STREAM to the beginning of the
- file and clear its error and EOF flags. */
-void
-rewind (FILE *stream)
-{
- clearerr (stream);
- (void) fseek (stream, 0L, SEEK_SET);
- clearerr (stream);
-}
diff --git a/stdio/setbuf.c b/stdio/setbuf.c
deleted file mode 100644
index 50ff7df4d6..0000000000
--- a/stdio/setbuf.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1991, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stddef.h>
-#include <stdio.h>
-
-
-/* If BUF is NULL, make STREAM unbuffered.
- If not, make BUF, which is BUFSIZ bytes long, be its buffer. */
-void
-setbuf (FILE *stream, char *buf)
-{
- (void) setvbuf (stream, buf, buf != NULL ? _IOFBF : _IONBF, BUFSIZ);
-}
diff --git a/stdio/setbuffer.c b/stdio/setbuffer.c
deleted file mode 100644
index 73fa38085e..0000000000
--- a/stdio/setbuffer.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1991, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stddef.h>
-#include <stdio.h>
-
-
-/* If BUF is NULL, make stream unbuffered.
- If not, make BUF, which is N bytes long, be its buffer. */
-void
-setbuffer (FILE *stream, char *buf, size_t n)
-{
- (void) setvbuf (stream, buf, buf != NULL ? _IOFBF : _IONBF, n);
-}
diff --git a/stdio/setlinebuf.c b/stdio/setlinebuf.c
deleted file mode 100644
index 03a80b6afa..0000000000
--- a/stdio/setlinebuf.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1991, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-
-
-/* Make STREAM line buffered. */
-void
-setlinebuf (FILE *stream)
-{
- if (stream->__buffer != NULL || !stream->__userbuf)
- stream->__linebuf = 1;
-}
diff --git a/stdio/setvbuf.c b/stdio/setvbuf.c
deleted file mode 100644
index bfa32b53cf..0000000000
--- a/stdio/setvbuf.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-
-
-/* Make STREAM use the buffering method given in MODE.
- If MODE indicates full or line buffering, use BUF,
- a buffer of SIZE bytes; if BUF is NULL, malloc a buffer. */
-int
-setvbuf (stream, buf, mode, size)
- FILE *stream;
- char *buf;
- int mode;
- size_t size;
-{
- if (!__validfp (stream))
- {
- __set_errno (EINVAL);
- return EOF;
- }
-
- /* The ANSI standard says setvbuf can only be called before any I/O is done,
- but we allow it to replace an old buffer, flushing it first. */
- if (stream->__buffer != NULL)
- {
- (void) fflush (stream);
- /* Free the old buffer if it was malloc'd. */
- if (!stream->__userbuf)
- free(stream->__buffer);
- }
-
- stream->__get_limit = stream->__put_limit = NULL;
- stream->__bufp = stream->__buffer = NULL;
- stream->__userbuf = stream->__linebuf = stream->__linebuf_active = 0;
-
- switch (mode)
- {
- default:
- __set_errno (EINVAL);
- return EOF;
- case _IONBF: /* Unbuffered. */
- stream->__buffer = NULL;
- stream->__bufsize = 0;
- stream->__userbuf = 1;
- break;
- case _IOLBF: /* Line buffered. */
- stream->__linebuf = 1;
- case _IOFBF: /* Fully buffered. */
- if (size == 0)
- {
- __set_errno (EINVAL);
- return EOF;
- }
- stream->__bufsize = size;
- if (buf != NULL)
- stream->__userbuf = 1;
- else if ((buf = (char *) malloc (size)) == NULL)
- return EOF;
- stream->__buffer = buf;
- break;
- }
-
- stream->__bufp = stream->__buffer;
- stream->__get_limit = stream->__buffer;
- /* The next output operation will prime the stream for writing. */
- stream->__put_limit = stream->__buffer;
-
- return 0;
-}
diff --git a/stdio/stdio.h b/stdio/stdio.h
deleted file mode 100644
index 3e0a79e093..0000000000
--- a/stdio/stdio.h
+++ /dev/null
@@ -1,832 +0,0 @@
-/* Copyright (C) 1991-1999, 2000 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-/*
- * ISO C99 Standard: 7.19 Input/output <stdio.h>
- */
-
-#ifndef _STDIO_H
-
-#if !defined(__need_FILE) && !defined(__need___FILE)
-#define _STDIO_H 1
-#include <features.h>
-
-__BEGIN_DECLS
-
-#define __need_size_t
-#define __need_NULL
-#include <stddef.h>
-
-#define __need___va_list
-#include <stdarg.h>
-#ifndef __GNUC_VA_LIST
-#define __gnuc_va_list __ptr_t
-#endif
-
-#include <bits/types.h>
-#define __need_FILE
-#define __need___FILE
-#endif /* Don't need FILE. */
-
-
-#if !defined __FILE_defined && defined __need_FILE
-
-/* The opaque type of streams. */
-typedef struct __stdio_file FILE;
-
-#define __FILE_defined 1
-#endif /* FILE not defined. */
-#undef __need_FILE
-
-
-#if !defined ____FILE_defined && defined __need___FILE
-
-/* The opaque type of streams. */
-typedef struct __stdio_file __FILE;
-
-#define ____FILE_defined 1
-#endif /* __FILE not defined. */
-#undef __need___FILE
-
-
-#ifdef _STDIO_H
-
-/* The type of the second argument to `fgetpos' and `fsetpos'. */
-typedef __off_t fpos_t;
-
-/* The mode of I/O, as given in the MODE argument to fopen, etc. */
-typedef struct
-{
- unsigned int __read:1; /* Open for reading. */
- unsigned int __write:1; /* Open for writing. */
- unsigned int __append:1; /* Open for appending. */
- unsigned int __binary:1; /* Opened binary. */
- unsigned int __create:1; /* Create the file. */
- unsigned int __exclusive:1; /* Error if it already exists. */
- unsigned int __truncate:1; /* Truncate the file on opening. */
-} __io_mode;
-
-
-/* Functions to do I/O and file management for a stream. */
-
-/* Read NBYTES bytes from COOKIE into a buffer pointed to by BUF.
- Return number of bytes read. */
-typedef __ssize_t __io_read_fn (__ptr_t __cookie, char *__buf,
- size_t __nbytes);
-
-/* Write N bytes pointed to by BUF to COOKIE. Write all N bytes
- unless there is an error. Return number of bytes written, or -1 if
- there is an error without writing anything. If the file has been
- opened for append (__mode.__append set), then set the file pointer
- to the end of the file and then do the write; if not, just write at
- the current file pointer. */
-typedef __ssize_t __io_write_fn (__ptr_t __cookie, __const char *__buf,
- size_t __n);
-
-/* Move COOKIE's file position to *POS bytes from the
- beginning of the file (if W is SEEK_SET),
- the current position (if W is SEEK_CUR),
- or the end of the file (if W is SEEK_END).
- Set *POS to the new file position.
- Returns zero if successful, nonzero if not. */
-typedef int __io_seek_fn (__ptr_t __cookie, fpos_t *__pos, int __w);
-
-/* Close COOKIE. */
-typedef int __io_close_fn (__ptr_t __cookie);
-
-/* Return the file descriptor associated with COOKIE,
- or -1 on error. There need not be any associated file descriptor. */
-typedef int __io_fileno_fn (__ptr_t __cookie);
-
-#ifdef __USE_GNU
-/* User-visible names for the above. */
-typedef __io_read_fn cookie_read_function_t;
-typedef __io_write_fn cookie_write_function_t;
-typedef __io_seek_fn cookie_seek_function_t;
-typedef __io_close_fn cookie_close_function_t;
-typedef __io_fileno_fn cookie_fileno_function_t;
-#endif
-
-/* Low level interface, independent of FILE representation. */
-#if defined __USE_GNU && !defined _LIBC
-/* Define the user-visible type, with user-friendly member names. */
-typedef struct
-{
- __io_read_fn *read; /* Read bytes. */
- __io_write_fn *write; /* Write bytes. */
- __io_seek_fn *seek; /* Seek/tell file position. */
- __io_close_fn *close; /* Close file. */
- __io_fileno_fn *fileno; /* Return file descriptor. */
-} cookie_io_functions_t;
-/* This name is still used in the prototypes in this file. */
-typedef cookie_io_functions_t __io_functions;
-#else
-/* Stick to ANSI-safe names. */
-typedef struct
-{
- __io_read_fn *__read; /* Read bytes. */
- __io_write_fn *__write; /* Write bytes. */
- __io_seek_fn *__seek; /* Seek/tell file position. */
- __io_close_fn *__close; /* Close file. */
- __io_fileno_fn *__fileno; /* Return file descriptor. */
-} __io_functions;
-#endif
-
-/* Higher level interface, dependent on FILE representation. */
-typedef struct
-{
- /* Make room in the input buffer. */
- int (*__input) (FILE *__stream);
- /* Make room in the output buffer. */
- void (*__output) (FILE *__stream, int __c);
-} __room_functions;
-
-extern __const __io_functions __default_io_functions;
-extern __const __room_functions __default_room_functions;
-
-
-/* Default close function. */
-extern __io_close_fn __stdio_close;
-/* Open FILE with mode M, store cookie in *COOKIEPTR. */
-extern int __stdio_open (__const char *__file, __io_mode __m,
- void **__cookieptr) __THROW;
-/* Put out an error message for when stdio needs to die. */
-extern void __stdio_errmsg (__const char *__msg, size_t __len) __THROW;
-
-
-
-/* For thread safe I/O functions we need a lock in each stream. We
- keep the type opaque here. */
-struct __stdio_lock;
-
-/* The FILE structure. */
-struct __stdio_file
-{
- /* Magic number for validation. Must be negative in open streams
- for the glue to Unix stdio getc/putc to work.
- NOTE: stdio/glue.c has special knowledge of these first four members. */
- int __magic;
-#define _IOMAGIC ((int) 0xfedabeeb) /* Magic number to fill `__magic'. */
-#define _GLUEMAGIC ((int) 0xfeedbabe) /* Magic for glued Unix streams. */
-
- char *__bufp; /* Pointer into the buffer. */
- char *__get_limit; /* Reading limit. */
- char *__put_limit; /* Writing limit. */
-
- char *__buffer; /* Base of buffer. */
- size_t __bufsize; /* Size of the buffer. */
- __ptr_t __cookie; /* Magic cookie. */
- __io_mode __mode; /* File access mode. */
- __io_functions __io_funcs; /* I/O functions. */
- __room_functions __room_funcs;/* I/O buffer room functions. */
- fpos_t __offset; /* Current file position. */
- fpos_t __target; /* Target file position. */
- FILE *__next; /* Next FILE in the linked list. */
- char *__pushback_bufp; /* Old bufp if char pushed back. */
- unsigned char __pushback; /* Pushed-back character. */
- unsigned int __pushed_back:1; /* A char has been pushed back. */
- unsigned int __eof:1; /* End of file encountered. */
- unsigned int __error:1; /* Error encountered. */
- unsigned int __userbuf:1; /* Buffer from user (should not be freed). */
- unsigned int __linebuf:1; /* Flush on newline. */
- unsigned int __linebuf_active:1; /* put_limit is not really in use. */
- unsigned int __seen:1; /* This stream has been seen. */
- unsigned int __ispipe:1; /* Nonzero if opened by popen. */
- struct __stdio_lock *__lock; /* Pointer to associated lock. */
-};
-
-
-/* All macros used internally by other macros here and by stdio functions begin
- with `__'. All of these may evaluate their arguments more than once. */
-
-
-/* Nonzero if STREAM is a valid stream.
- STREAM must be a modifiable lvalue (wow, I got to use that term).
- See stdio/glue.c for what the confusing bit is about. */
-#define __validfp(stream) \
- (stream != NULL && \
- ({ if (stream->__magic == _GLUEMAGIC) \
- stream = *((struct { int __magic; FILE **__p; } *) stream)->__p; \
- stream->__magic == _IOMAGIC; }))
-
-/* Clear the error and EOF indicators of STREAM. */
-#define __clearerr(stream) ((stream)->__error = (stream)->__eof = 0)
-
-/* Nuke STREAM, making it unusable but available for reuse. */
-extern void __invalidate (FILE *__stream) __THROW;
-
-/* Make sure STREAM->__offset and STREAM->__target are initialized.
- Returns 0 if successful, or EOF on
- error (but doesn't set STREAM->__error). */
-extern int __stdio_check_offset (FILE *__stream) __THROW;
-
-
-/* The possibilities for the third argument to `setvbuf'. */
-#define _IOFBF 0x1 /* Full buffering. */
-#define _IOLBF 0x2 /* Line buffering. */
-#define _IONBF 0x4 /* No buffering. */
-
-
-/* Default buffer size. */
-#define BUFSIZ 1024
-
-
-/* End of file character.
- Some things throughout the library rely on this being -1. */
-#define EOF (-1)
-
-
-/* The possibilities for the third argument to `fseek'.
- These values should not be changed. */
-#define SEEK_SET 0 /* Seek from beginning of file. */
-#define SEEK_CUR 1 /* Seek from current position. */
-#define SEEK_END 2 /* Seek from end of file. */
-
-
-#ifdef __USE_SVID
-/* Default path prefix for `tempnam' and `tmpnam'. */
-#define P_tmpdir "/usr/tmp"
-#endif
-
-
-/* Get the values:
- L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
- TMP_MAX The minimum number of unique filenames generated by tmpnam
- (and tempnam when it uses tmpnam's name space),
- or tempnam (the two are separate).
- L_ctermid How long an array to pass to `ctermid'.
- L_cuserid How long an array to pass to `cuserid'.
- FOPEN_MAX Minimum number of files that can be open at once.
- FILENAME_MAX Maximum length of a filename. */
-#include <bits/stdio_lim.h>
-
-
-/* All the known streams are in a linked list
- linked by the `next' field of the FILE structure. */
-extern FILE *__stdio_head; /* Head of the list. */
-
-/* Standard streams. */
-extern FILE *stdin, *stdout, *stderr;
-#ifdef __STRICT_ANSI__
-/* ANSI says these are macros; satisfy pedants. */
-#define stdin stdin
-#define stdout stdout
-#define stderr stderr
-#endif
-
-
-/* Remove file FILENAME. */
-extern int remove (__const char *__filename) __THROW;
-/* Rename file OLD to NEW. */
-extern int rename (__const char *__old, __const char *__new) __THROW;
-
-
-/* Create a temporary file and open it read/write. */
-extern FILE *tmpfile (void) __THROW;
-#ifdef __USE_LARGEFILE64
-extern FILE *tmpfile64 (void) __THROW;
-#endif
-/* Generate a temporary filename. */
-extern char *tmpnam (char *__s) __THROW;
-
-#ifdef __USE_REENTRANT
-/* This is the reentrant variant of `tmpnam'. The only difference is
- that it does not allow S to be NULL. */
-extern char *tmpnam_r (char *__s) __THROW;
-#endif
-
-
-#if defined __USE_SVID || defined __USE_XOPEN
-/* Generate a unique temporary filename using up to five characters of PFX
- if it is not NULL. The directory to put this file in is searched for
- as follows: First the environment variable "TMPDIR" is checked.
- If it contains the name of a writable directory, that directory is used.
- If not and if DIR is not NULL, that value is checked. If that fails,
- P_tmpdir is tried and finally "/tmp". The storage for the filename
- is allocated by `malloc'. */
-extern char *tempnam (__const char *__dir, __const char *__pfx) __THROW;
-#endif
-
-
-/* This performs actual output when necessary, flushing
- STREAM's buffer and optionally writing another character. */
-extern int __flshfp (FILE *__stream, int __c) __THROW;
-
-
-/* Close STREAM. */
-extern int fclose (FILE *__stream) __THROW;
-/* Flush STREAM, or all streams if STREAM is NULL. */
-extern int fflush (FILE *__stream) __THROW;
-
-#ifdef __USE_MISC
-/* Faster versions when locking is not required. */
-extern int fflush_unlocked (FILE *__stream) __THROW;
-#endif
-
-#ifdef __USE_GNU
-/* Close all streams. */
-extern int __fcloseall (void) __THROW;
-extern int fcloseall (void) __THROW;
-#endif
-
-
-/* Open a file and create a new stream for it. */
-extern FILE *fopen (__const char *__filename, __const char *__modes) __THROW;
-/* Open a file, replacing an existing stream with it. */
-extern FILE *freopen (__const char *__restrict __filename,
- __const char *__restrict __modes,
- FILE *__restrict __stream) __THROW;
-
-/* Return a new, zeroed, stream.
- You must set its cookie and io_mode.
- The first operation will give it a buffer unless you do.
- It will also give it the default functions unless you set the `seen' flag.
- The offset is set to -1, meaning it will be determined by doing a
- stationary seek. You can set it to avoid the initial tell call.
- The target is set to -1, meaning it will be set to the offset
- before the target is needed.
- Returns NULL if a stream can't be created. */
-extern FILE *__newstream (void) __THROW;
-
-#ifdef __USE_POSIX
-/* Create a new stream that refers to an existing system file descriptor. */
-extern FILE *__fdopen (int __fd, __const char *__modes) __THROW;
-extern FILE *fdopen (int __fd, __const char *__modes) __THROW;
-#endif
-
-#ifdef __USE_GNU
-/* Create a new stream that refers to the given magic cookie,
- and uses the given functions for input and output. */
-extern FILE *fopencookie (void *__magic_cookie, __const char *__modes,
- __io_functions __io_funcs) __THROW;
-
-/* Create a new stream that refers to a memory buffer. */
-extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW;
-
-/* Open a stream that writes into a malloc'd buffer that is expanded as
- necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
- and the number of characters written on fflush or fclose. */
-extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW;
-#endif
-
-
-/* If BUF is NULL, make STREAM unbuffered.
- Else make it use buffer BUF, of size BUFSIZ. */
-extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
-/* Make STREAM use buffering mode MODE.
- If BUF is not NULL, use N bytes of it for buffering;
- else allocate an internal buffer N bytes long. */
-extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
- int __modes, size_t __n) __THROW;
-
-#ifdef __USE_BSD
-/* If BUF is NULL, make STREAM unbuffered.
- Else make it use SIZE bytes of BUF for buffering. */
-extern void setbuffer (FILE *__stream, char *__buf, size_t __size) __THROW;
-
-/* Make STREAM line-buffered. */
-extern void setlinebuf (FILE *__stream) __THROW;
-#endif
-
-
-/* Write formatted output to STREAM. */
-extern int fprintf (FILE *__restrict __stream,
- __const char *__restrict __format, ...) __THROW;
-/* Write formatted output to stdout. */
-extern int printf (__const char *__restrict __format, ...) __THROW;
-/* Write formatted output to S. */
-extern int sprintf (char *__restrict __s, __const char *__restrict __format,
- ...) __THROW;
-
-/* Write formatted output to S from argument list ARG. */
-extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-/* Write formatted output to stdout from argument list ARG. */
-extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg)
- __THROW;
-/* Write formatted output to S from argument list ARG. */
-extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
- __gnuc_va_list __arg) __THROW;
-
-#ifdef __OPTIMIZE__
-extern __inline int
-vprintf (const char *__restrict __fmt, __gnuc_va_list __arg) __THROW
-{
- return vfprintf (stdout, __fmt, __arg);
-}
-#endif /* Optimizing. */
-
-#if defined __USE_BSD || defined __USE_ISOC99
-/* Maximum chars of output to write in MAXLEN. */
-extern int __snprintf (char *__s, size_t __maxlen,
- __const char *__format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int snprintf (char *__s, size_t __maxlen, __const char *__format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int __vsnprintf (char *__s, size_t __maxlen,
- __const char *__format, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
-extern int vsnprintf (char *__s, size_t __maxlen,
- __const char *__format, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
-#endif
-
-#ifdef __USE_GNU
-/* Write formatted output to a string dynamically allocated with `malloc'.
- Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr,
- __const char *__restrict __f, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
-extern int __asprintf (char **__restrict __ptr,
- __const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int asprintf (char **__restrict __ptr,
- __const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
-
-/* Write formatted output to a file descriptor. */
-extern int vdprintf (int __fd, __const char *__restrict __fmt,
- __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
-#endif
-
-
-/* Read formatted input from STREAM. */
-extern int fscanf (FILE *__restrict __stream,
- __const char *__restrict __format, ...) __THROW;
-/* Read formatted input from stdin. */
-extern int scanf (__const char *__restrict __format, ...) __THROW;
-/* Read formatted input from S. */
-extern int sscanf (__const char *__restrict __s,
- __const char *__restrict __format, ...) __THROW;
-
-#ifdef __USE_ISOC99
-/* Read formatted input from S into argument list ARG. */
-extern int __vfscanf (FILE *__s, __const char *__format,
- __gnuc_va_list __arg) __THROW;
-extern int vfscanf (FILE *__s, __const char *__format,
- __gnuc_va_list __arg) __THROW;
-
-/* Read formatted input from stdin into argument list ARG. */
-extern int __vscanf (__const char *__format, __gnuc_va_list __arg) __THROW;
-extern int vscanf (__const char *__format, __gnuc_va_list __arg) __THROW;
-
-/* Read formatted input from S into argument list ARG. */
-extern int __vsscanf (__const char *__s, __const char *__format,
- __gnuc_va_list __arg) __THROW;
-extern int vsscanf (__const char *__s, __const char *__format,
- __gnuc_va_list __arg) __THROW;
-
-
-#ifdef __OPTIMIZE__
-extern __inline int
-vfscanf (FILE *__s, const char *__fmt, __gnuc_va_list __arg) __THROW
-{
- return __vfscanf (__s, __fmt, __arg);
-}
-extern __inline int
-vscanf (const char *__fmt, __gnuc_va_list __arg) __THROW
-{
- return __vfscanf (stdin, __fmt, __arg);
-}
-extern __inline int
-vsscanf (const char *__s, const char *__fmt, __gnuc_va_list __arg) __THROW
-{
- return __vsscanf (__s, __fmt, __arg);
-}
-#endif /* Optimizing. */
-#endif /* Use ISO C9x. */
-
-
-/* This does actual reading when necessary, filling STREAM's
- buffer and returning the first character in it. */
-extern int __fillbf (FILE *__stream) __THROW;
-
-
-/* Read a character from STREAM. */
-extern int fgetc (FILE *__stream) __THROW;
-extern int getc (FILE *__stream) __THROW;
-
-/* Read a character from stdin. */
-extern int getchar (void) __THROW;
-
-/* The C standard explicitly says this can
- re-evaluate its argument, so it does. */
-#define __getc(stream) \
- ((stream)->__bufp < (stream)->__get_limit ? \
- (int) ((unsigned char) *(stream)->__bufp++) : __fillbf(stream))
-
-/* The C standard explicitly says this is a macro,
- so we always do the optimization for it. */
-#define getc(stream) __getc(stream)
-
-#ifdef __OPTIMIZE__
-extern __inline int
-getchar (void) __THROW
-{
- return __getc (stdin);
-}
-#endif /* Optimizing. */
-
-#if defined __USE_POSIX || defined __USE_MISC
-/* These are defined in POSIX.1:1996. */
-extern int getc_unlocked (FILE *__stream) __THROW;
-extern int getchar_unlocked (void) __THROW;
-
-# ifdef __OPTIMIZE__
-extern __inline int
-getc_unlocked (FILE *__stream) __THROW
-{
- return __getc (__stream);
-}
-
-extern __inline int
-getchar_unlocked (void) __THROW
-{
- return __getc (stdin);
-}
-# endif /* Optimizing. */
-#endif /* Use POSIX or MISC. */
-
-
-/* Write a character to STREAM. */
-extern int fputc (int __c, FILE *__stream) __THROW;
-extern int putc (int __c, FILE *__stream) __THROW;
-
-/* Write a character to stdout. */
-extern int putchar (int __c) __THROW;
-
-
-/* The C standard explicitly says this can
- re-evaluate its arguments, so it does. */
-#define __putc(c, stream) \
- ((stream)->__bufp < (stream)->__put_limit ? \
- (int) (unsigned char) (*(stream)->__bufp++ = (unsigned char) (c)) : \
- __flshfp ((stream), (unsigned char) (c)))
-
-/* The C standard explicitly says this can be a macro,
- so we always do the optimization for it. */
-#define putc(c, stream) __putc ((c), (stream))
-
-#ifdef __OPTIMIZE__
-extern __inline int
-putchar (int __c) __THROW
-{
- return __putc (__c, stdout);
-}
-#endif
-
-#ifdef __USE_MISC
-/* Faster version when locking is not necessary. */
-extern int fputc_unlocked (int __c, FILE *__stream) __THROW;
-
-# ifdef __OPTIMIZE__
-extern __inline int
-fputc_unlocked (int __c, FILE *__stream) __THROW
-{
- return __putc (__c, __stream);
-}
-# endif /* Optimizing. */
-#endif /* Use MISC. */
-
-#if defined __USE_POSIX || defined __USE_MISC
-/* These are defined in POSIX.1:1996. */
-extern int putc_unlocked (int __c, FILE *__stream) __THROW;
-extern int putchar_unlocked (int __c) __THROW;
-
-# ifdef __OPTIMIZE__
-extern __inline int
-putc_unlocked (int __c, FILE *__stream) __THROW
-{
- return __putc (__c, __stream);
-}
-
-extern __inline int
-putchar_unlocked (int __c) __THROW
-{
- return __putc (__c, stdout);
-}
-# endif /* Optimizing. */
-#endif /* Use POSIX or MISC. */
-
-
-#if defined __USE_SVID || defined __USE_MISC
-/* Get a word (int) from STREAM. */
-extern int getw (FILE *__stream) __THROW;
-
-/* Write a word (int) to STREAM. */
-extern int putw (int __w, FILE *__stream) __THROW;
-#endif
-
-
-/* Get a newline-terminated string of finite length from STREAM. */
-extern char *fgets (char *__restrict __s, int __n,
- FILE *__restrict __stream) __THROW;
-
-#ifdef __USE_GNU
-/* This function does the same as `fgets' but does not lock the stream. */
-extern char *fgets_unlocked (char *__restrict __s, int __n,
- FILE *__restrict __stream) __THROW;
-#endif
-
-/* Get a newline-terminated string from stdin, removing the newline.
- DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. */
-extern char *gets (char *__s) __THROW;
-
-
-#ifdef __USE_GNU
-#include <sys/types.h>
-
-/* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
- (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
- NULL), pointing to *N characters of space. It is realloc'd as
- necessary. Returns the number of characters read (not including the
- null terminator), or -1 on error or EOF. */
-ssize_t __getdelim (char **__lineptr, size_t *__n,
- int __delimiter, FILE *__stream) __THROW;
-ssize_t getdelim (char **__lineptr, size_t *__n,
- int __delimiter, FILE *__stream) __THROW;
-
-/* Like `getdelim', but reads up to a newline. */
-ssize_t __getline (char **__lineptr, size_t *__n, FILE *__stream) __THROW;
-ssize_t getline (char **__lineptr, size_t *__n, FILE *__stream) __THROW;
-
-#ifdef __OPTIMIZE__
-extern __inline ssize_t
-getline (char **__lineptr, size_t *__n, FILE *__stream) __THROW
-{
- return __getdelim (__lineptr, __n, '\n', __stream);
-}
-#endif /* Optimizing. */
-#endif
-
-
-/* Write a string to STREAM. */
-extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
- __THROW;
-
-#ifdef __USE_GNU
-/* This function does the same as `fputs' but does not lock the stream. */
-extern int fputs_unlocked (__const char *__restrict __s,
- FILE *__restrict __stream) __THROW;
-#endif
-
-/* Write a string, followed by a newline, to stdout. */
-extern int puts (__const char *__s) __THROW;
-
-
-/* Push a character back onto the input buffer of STREAM. */
-extern int ungetc (int __c, FILE *__stream) __THROW;
-
-
-/* Read chunks of generic data from STREAM. */
-extern size_t fread (void *__restrict __ptr, size_t __size,
- size_t __n, FILE *__restrict __stream) __THROW;
-/* Write chunks of generic data to STREAM. */
-extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
- size_t __n, FILE *__restrict __s) __THROW;
-
-#ifdef __USE_MISC
-/* Faster versions when locking is not necessary. */
-extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
- size_t __n, FILE *__restrict __stream) __THROW;
-extern size_t fwrite_unlocked (__const void *__restrict __ptr,
- size_t __size, size_t __n,
- FILE *__restrict __stream) __THROW;
-#endif
-
-
-/* Seek to a certain position on STREAM. */
-extern int fseek (FILE *__stream, long int __off, int __whence) __THROW;
-/* Return the current position of STREAM. */
-extern long int ftell (FILE *__stream) __THROW;
-/* Rewind to the beginning of STREAM. */
-extern void rewind (FILE *__stream) __THROW;
-
-/* Get STREAM's position. */
-extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos)
- __THROW;
-/* Set STREAM's position. */
-extern int fsetpos (FILE *__stream, __const fpos_t *__pos) __THROW;
-
-
-/* Clear the error and EOF indicators for STREAM. */
-extern void clearerr (FILE *__stream) __THROW;
-/* Return the EOF indicator for STREAM. */
-extern int feof (FILE *__stream) __THROW;
-/* Return the error indicator for STREAM. */
-extern int ferror (FILE *__stream) __THROW;
-
-#ifdef __OPTIMIZE__
-#define feof(stream) ((stream)->__eof != 0)
-#define ferror(stream) ((stream)->__error != 0)
-#endif /* Optimizing. */
-
-#ifdef __USE_MISC
-/* Faster versions when locking is not required. */
-extern void clearerr_unlocked (FILE *__stream) __THROW;
-extern int feof_unlocked (FILE *__stream) __THROW;
-extern int ferror_unlocked (FILE *__stream) __THROW;
-
-# ifdef __OPTIMIZE__
-# define feof_unlocked(stream) ((stream)->__eof != 0)
-# define ferror_unlocked(stream) ((stream)->__error != 0)
-# endif /* Optimizing. */
-#endif
-
-/* Print a message describing the meaning of the value of errno. */
-extern void perror (__const char *__s) __THROW;
-
-
-#ifdef __USE_POSIX
-/* Return the system file descriptor for STREAM. */
-extern int fileno (FILE *__stream) __THROW;
-#endif /* Use POSIX. */
-
-#ifdef __USE_MISC
-/* Faster version when locking is not required. */
-extern int fileno_unlocked (FILE *__stream) __THROW;
-#endif
-
-
-#if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
- defined __USE_MISC)
-/* Create a new stream connected to a pipe running the given command. */
-extern FILE *popen (__const char *__command, __const char *__modes) __THROW;
-
-/* Close a stream opened by popen and return the status of its child. */
-extern int pclose (FILE *__stream) __THROW;
-#endif
-
-
-#ifdef __USE_POSIX
-/* Return the name of the controlling terminal. */
-extern char *ctermid (char *__s) __THROW;
-#endif
-
-
-#ifdef __USE_XOPEN
-/* Return the name of the current user. */
-extern char *cuserid (char *__s) __THROW;
-#endif
-
-
-#ifdef __USE_GNU
-struct obstack; /* See <obstack.h>. */
-
-/* Open a stream that writes to OBSTACK. */
-extern FILE *open_obstack_stream (struct obstack *__obstack) __THROW;
-
-/* Write formatted output to an obstack. */
-extern int obstack_printf (struct obstack *__obstack,
- __const char *__format, ...) __THROW;
-extern int obstack_vprintf (struct obstack *__obstack, __const char *__format,
- __gnuc_va_list __args) __THROW;
-#endif
-
-
-#if defined __USE_POSIX || defined __USE_MISC
-/* These are defined in POSIX.1:1996. */
-
-/* Acquire ownership of STREAM. */
-extern void flockfile (FILE *__stream) __THROW;
-
-/* Try to acquire ownership of STREAM but do not block if it is not
- possible. */
-extern int ftrylockfile (FILE *__stream) __THROW;
-
-/* Relinquish the ownership granted for STREAM. */
-extern void funlockfile (FILE *__stream) __THROW;
-#endif /* POSIX || misc */
-
-#if defined __USE_XOPEN && !defined __USE_GNU
-/* The X/Open standard requires some functions and variables to be
- declared here which do not belong into this header. But we have to
- follow. In GNU mode we don't do this nonsense. */
-# define __need_getopt
-# include <getopt.h>
-#endif
-
-__END_DECLS
-
-#endif /* <stdio.h> included. */
-
-#endif /* stdio.h */
diff --git a/stdio/ungetc.c b/stdio/ungetc.c
deleted file mode 100644
index 34304aa3fd..0000000000
--- a/stdio/ungetc.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 1991, 1993, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-
-/* Push the character C back onto the input stream of STREAM. */
-int
-ungetc (c, stream)
- int c;
- FILE *stream;
-{
- if (!__validfp (stream) || !stream->__mode.__read)
- {
- __set_errno (EINVAL);
- return EOF;
- }
-
- if (c == EOF)
- return EOF;
-
- if (stream->__pushed_back)
- /* There is already a char pushed back. */
- return EOF;
-
- if ((stream->__linebuf_active || stream->__put_limit > stream->__buffer) &&
- /* This is a read-write stream with something in its buffer.
- Flush the stream. */
- __flshfp (stream, EOF) == EOF)
- return EOF;
-
- stream->__pushback = (unsigned char) c;
- /* Tell __fillbf we've pushed back a char. */
- stream->__pushed_back = 1;
- stream->__pushback_bufp = stream->__bufp;
- /* Make the next getc call __fillbf. It will return C. */
- stream->__bufp = stream->__get_limit;
-
- /* We just gave it another character to read, so it's not at EOF. */
- stream->__eof = 0;
-
- return stream->__pushback;
-}
diff --git a/stdio/vasprintf.c b/stdio/vasprintf.c
deleted file mode 100644
index 8da6f02cf2..0000000000
--- a/stdio/vasprintf.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stddef.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-
-/* Enlarge STREAM's buffer. */
-static void
-enlarge_buffer (FILE *stream, int c)
-{
- ptrdiff_t bufp_offset = stream->__bufp - stream->__buffer;
- char *newbuf;
-
- stream->__bufsize += 100;
- newbuf = (char *) realloc ((void *) stream->__buffer, stream->__bufsize);
- if (newbuf == NULL)
- {
- free ((void *) stream->__buffer);
- stream->__buffer = stream->__bufp
- = stream->__put_limit = stream->__get_limit = NULL;
- stream->__error = 1;
- }
- else
- {
- stream->__buffer = newbuf;
- stream->__bufp = stream->__buffer + bufp_offset;
- stream->__get_limit = stream->__put_limit;
- stream->__put_limit = stream->__buffer + stream->__bufsize;
- if (c != EOF)
- *stream->__bufp++ = (unsigned char) c;
- }
-}
-
-/* Write formatted output from FORMAT to a string which is
- allocated with malloc and stored in *STRING_PTR. */
-int
-vasprintf (char **string_ptr,
- const char *format,
- va_list args)
-{
- FILE f;
- int done;
-
- memset ((void *) &f, 0, sizeof (f));
- f.__magic = _IOMAGIC;
- f.__bufsize = 100;
- f.__buffer = (char *) malloc (f.__bufsize);
- if (f.__buffer == NULL)
- return -1;
- f.__bufp = f.__buffer;
- f.__put_limit = f.__buffer + f.__bufsize;
- f.__mode.__write = 1;
- f.__room_funcs.__output = enlarge_buffer;
- f.__seen = 1;
-
- done = vfprintf (&f, format, args);
- if (done < 0)
- return done;
-
- *string_ptr = realloc (f.__buffer, (f.__bufp - f.__buffer) + 1);
- if (*string_ptr == NULL)
- *string_ptr = f.__buffer;
- (*string_ptr)[f.__bufp - f.__buffer] = '\0';
- return done;
-}
diff --git a/stdio/vscanf.c b/stdio/vscanf.c
deleted file mode 100644
index 655f282d7c..0000000000
--- a/stdio/vscanf.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdarg.h>
-#include <stdio.h>
-
-#undef vscanf
-
-
-/* Read formatted input from stdin according to the format
- string in FORMAT, using the argument list in ARG. */
-int
-__vscanf (const char *format, va_list arg)
-{
- return vfscanf (stdin, format, arg);
-}
-weak_alias (__vscanf, vscanf)
diff --git a/stdio/vsnprintf.c b/stdio/vsnprintf.c
deleted file mode 100644
index 83271834e2..0000000000
--- a/stdio/vsnprintf.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-
-
-/*
- * Write formatted output to S according to the format string
- * FORMAT, using the argument list in ARG, writing no more
- * than MAXLEN characters.
- */
-int
-__vsnprintf (char *s, size_t maxlen, const char *format, va_list arg)
-{
- int done;
- FILE f;
-
- /* We have to handle the case of MAXLEN == 0 special. */
- if (maxlen == 0)
- return 0;
-
- memset ((void *) &f, 0, sizeof (f));
- f.__magic = _IOMAGIC;
- f.__mode.__write = 1;
- /* The buffer size is one less than MAXLEN
- so we have space for the null terminator. */
- f.__bufp = f.__buffer = (char *) s;
- f.__bufsize = maxlen - 1;
- f.__put_limit = f.__buffer + f.__bufsize;
- f.__get_limit = f.__buffer;
- /* After the buffer is full (MAXLEN characters have been written),
- any more characters written will go to the bit bucket. */
- f.__room_funcs = __default_room_functions;
- f.__io_funcs.__write = NULL;
- f.__seen = 1;
-
- done = vfprintf (&f, format, arg);
- *f.__bufp = '\0';
-
- return done;
-}
-weak_alias (__vsnprintf, vsnprintf)
diff --git a/stdio/vsprintf.c b/stdio/vsprintf.c
deleted file mode 100644
index bd34ec2a4a..0000000000
--- a/stdio/vsprintf.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-
-
-/* Write formatted output to S according to the format string
- FORMAT, using the argument list in ARG. */
-int
-vsprintf (s, format, arg)
- char *s;
- const char *format;
- va_list arg;
-{
- int done;
- FILE f;
-
- memset ((void *) &f, 0, sizeof (f));
- f.__magic = _IOMAGIC;
- f.__mode.__write = 1;
- f.__bufp = f.__buffer = (char *) s;
- f.__put_limit = (char *) ULONG_MAX;
- f.__bufsize = (size_t) (f.__put_limit - f.__bufp);
- f.__get_limit = f.__buffer;
- f.__room_funcs.__output = NULL;
- f.__seen = 1;
-
- done = vfprintf (&f, format, arg);
- *f.__bufp = '\0';
-
- return done;
-}
diff --git a/stdio/vsscanf.c b/stdio/vsscanf.c
deleted file mode 100644
index e037f8c92d..0000000000
--- a/stdio/vsscanf.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-
-#undef vsscanf
-
-
-/* Read formatted input from S according to the format
- string FORMAT, using the argument list in ARG. */
-int
-__vsscanf (s, format, arg)
- const char *s;
- const char *format;
- va_list arg;
-{
- FILE f;
-
- if (s == NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- memset ((void *) &f, 0, sizeof (f));
- f.__magic = _IOMAGIC;
- f.__mode.__read = 1;
- f.__bufp = f.__buffer = (char *) s;
- f.__bufsize = strlen(s);
- f.__get_limit = f.__buffer + f.__bufsize;
- f.__put_limit = f.__buffer;
- /* After the buffer is empty (strlen(S) characters have been read),
- any more read attempts will get EOF. */
- f.__room_funcs.__input = NULL;
- f.__seen = 1;
-
- return __vfscanf (&f, format, arg);
-}
-
-
-weak_alias (__vsscanf, vsscanf)
diff --git a/sysdeps/generic/defs.c b/sysdeps/generic/defs.c
deleted file mode 100644
index c71235dd08..0000000000
--- a/sysdeps/generic/defs.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Definitions of global stdio data structures.
- Copyright (C) 1991, 1995, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-
-/* This file should define the following
- variables as appropriate for the system. */
-
-FILE *stdin, *stdout, *stderr;
-
-/* Pointer to the first stream in the list. */
-FILE *__stdio_head;
-
-/* This function MUST be in this file!
- This is because we want _cleanup to go into the __libc_atexit set
- when any stdio code is used (and to use any stdio code, one must reference
- something defined in this file), and since only local symbols can be made
- set elements, having the set element stab entry here and _cleanup elsewhere
- loses; and having them both elsewhere loses because there is no reference
- to cause _cleanup to be linked in. */
-
-void
-_cleanup ()
-{
- __fcloseall ();
-}
-
-
-#ifdef HAVE_GNU_LD
-text_set_element (__libc_atexit, _cleanup);
-#endif
diff --git a/sysdeps/generic/fdopen.c b/sysdeps/generic/fdopen.c
deleted file mode 100644
index d856d0403a..0000000000
--- a/sysdeps/generic/fdopen.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-
-/* Open a new stream on a given system file descriptor. */
-FILE *
-__fdopen (fd, mode)
- int fd;
- const char *mode;
-{
- __set_errno (ENOSYS);
- return NULL;
-}
-weak_alias (__fdopen, fdopen)
-
-stub_warning (fdopen)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/pipestream.c b/sysdeps/generic/pipestream.c
deleted file mode 100644
index f30dbdd36e..0000000000
--- a/sysdeps/generic/pipestream.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stddef.h>
-#include <signal.h>
-#include <stdio.h>
-#include <errno.h>
-
-
-/* Open a new stream that is a one-way pipe to a
- child process running the given shell command. */
-FILE *
-popen (command, mode)
- const char *command;
- const char *mode;
-{
- if (command == NULL || mode == NULL || (*mode != 'r' && *mode != 'w'))
- {
- __set_errno (EINVAL);
- return NULL;
- }
-
- __set_errno (ENOSYS);
- return NULL;
-}
-
-/* Close a stream opened by popen and return its status.
- Returns -1 if the stream was not opened by popen. */
-int
-pclose (stream)
- register FILE *stream;
-{
- if (!__validfp (stream) || !stream->__ispipe)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- __set_errno (ENOSYS);
- return -1;
-}
-
-stub_warning (popen)
-stub_warning (pclose)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/stdio_init.c b/sysdeps/generic/stdio_init.c
deleted file mode 100644
index 426934372d..0000000000
--- a/sysdeps/generic/stdio_init.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1991, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-
-/* Initialize STREAM as necessary.
- This may change I/O functions, give a buffer, etc.
- If no buffer is allocated, but the bufsize is set,
- the bufsize will be used to allocate the buffer. */
-void
-__stdio_init_stream (stream)
- FILE *stream;
-{
- stream->__bufsize = BUFSIZ;
-}
diff --git a/sysdeps/generic/sysd-stdio.c b/sysdeps/generic/sysd-stdio.c
deleted file mode 100644
index 032ea60819..0000000000
--- a/sysdeps/generic/sysd-stdio.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-extern __io_read_fn __stdio_read;
-extern __io_write_fn __stdio_write;
-extern __io_seek_fn __stdio_seek;
-extern __io_close_fn __stdio_close;
-extern __io_fileno_fn __stdio_fileno;
-
-/* Read N bytes into BUF from COOKIE. */
-int
-__stdio_read (void *cookie, char *buf, size_t n)
-{
- const int fd = (int) cookie;
-#if defined EINTR && defined EINTR_REPEAT
- int save = errno;
- int nread;
-
- try:;
- __set_errno (0);
- nread = __read (fd, buf, (int) n);
- if (nread < 0)
- {
- if (errno == EINTR)
- goto try;
- return -1;
- }
- __set_errno (save);
- return nread;
-
-#else /* No EINTR. */
- return __read (fd, buf, n);
-#endif
-}
-
-
-/* Write N bytes from BUF to COOKIE. */
-int
-__stdio_write (void *cookie, const char *buf, size_t n)
-{
- const int fd = (int) cookie;
- register size_t written = 0;
-
- while (n > 0)
- {
- int count = __write (fd, buf, (int) n);
- if (count > 0)
- {
- buf += count;
- written += count;
- n -= count;
- }
- else if (count < 0
-#if defined EINTR && defined EINTR_REPEAT
- && errno != EINTR
-#endif
- )
- /* Write error. */
- return -1;
- }
-
- return (int) written;
-}
-
-
-/* Move COOKIE's file position *POS bytes, according to WHENCE.
- The new file position is stored in *POS.
- Returns zero if successful, nonzero if not. */
-int
-__stdio_seek (void *cookie, fpos_t *pos, int whence)
-{
- off_t new;
- new = __lseek ((int) cookie, (off_t) *pos, whence);
- if (new < 0)
- return 1;
- *pos = (fpos_t) new;
- return 0;
-}
-
-
-/* Close COOKIE. */
-int
-__stdio_close (void *cookie)
-{
- return __close ((int) cookie);
-}
-
-/* Return the POSIX.1 file descriptor associated with COOKIE,
- or -1 for errors. If COOKIE does not relate to any POSIX.1 file
- descriptor, this should return -1 with errno set to EOPNOTSUPP. */
-int
-__stdio_fileno (void *cookie)
-{
- return (int) cookie;
-}
-
-
-/* Open the given file with the mode given in the __io_mode argument. */
-int
-__stdio_open (const char *filename, __io_mode m, void **cookieptr)
-{
- int fd;
- int mode;
-
- if (m.__read && m.__write)
- mode = O_RDWR;
- else
- mode = m.__read ? O_RDONLY : O_WRONLY;
-
- if (m.__append)
- mode |= O_APPEND;
- if (m.__exclusive)
- mode |= O_EXCL;
- if (m.__truncate)
- mode |= O_TRUNC;
-
- if (m.__create)
- fd = __open (filename, mode | O_CREAT,
- S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
- else
- fd = __open (filename, mode);
-
- if (fd < 0)
- return -1;
-
- *cookieptr = (void *) fd;
- return 0;
-}
-
-
-/* Open FILENAME with the mode in M. Use the same magic cookie
- already in *COOKIEPTR if possible, closing the old cookie with CLOSEFN. */
-int
-__stdio_reopen (const char *filename, __io_mode m, void **cookieptr,
- __io_close_fn closefn)
-{
- void *newcookie;
-
- /* We leave the old descriptor open while we open the file.
- That way ``freopen ("/dev/stdin", "r", stdin)'' works. */
-
- if (__stdio_open (filename, m, &newcookie))
- {
- if (errno == ENFILE || errno == EMFILE)
- {
- /* We are out of file descriptors. Try closing the old one and
- retrying the open. */
- (void) (*closefn) (*cookieptr);
- if (__stdio_open (filename, m, &newcookie))
- return -1;
- }
- else
- return -1;
- }
-
- if (newcookie != *cookieptr)
- {
- if (closefn != __stdio_close ||
- /* Try to move the descriptor to the desired one. */
- __dup2 ((int) newcookie, (int) *cookieptr) < 0)
- /* Didn't work. Give the caller the new cookie. */
- *cookieptr = newcookie;
- }
-
- return 0;
-}
diff --git a/sysdeps/generic/vdprintf.c b/sysdeps/generic/vdprintf.c
deleted file mode 100644
index d8bd3bca81..0000000000
--- a/sysdeps/generic/vdprintf.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdarg.h>
-
-/* Write formatted output to file descriptor D according to the format string
- FORMAT, using the argument list in ARG. */
-int
-vdprintf (int d, const char *format, va_list arg)
-{
- __set_errno (ENOSYS);
- return 0;
-}
-
-stub_warning (vdprintf)
-#include <stub-tag.h>
diff --git a/sysdeps/mach/hurd/configure b/sysdeps/mach/hurd/configure
index 93434c0e91..7017ea4adc 100755
--- a/sysdeps/mach/hurd/configure
+++ b/sysdeps/mach/hurd/configure
@@ -12,14 +12,9 @@ fi
case "$machine" in
i386*)
- # With --enable-libio, the default oldest ABI is 2.2.6;
- # without --enable-libio, the default oldest ABI is 2.0.
+ # The default oldest ABI is 2.2.6.
# We only need a "yes" here if the oldest ABI supported will be < 2.2.6.
- if if test "$stdio" = libio; then
- test "$oldest_abi" != default && test "$oldest_abi" \< "2.2.6"
- else
- test "$oldest_abi" = default || test "$oldest_abi" \< "2.2.6"
- fi; then
+ if test "$oldest_abi" != default && test "$oldest_abi" \< "2.2.6"; then
libc_cv_gcc_unwind_find_fde=yes
fi
;;
@@ -29,7 +24,7 @@ esac
# See if mig groks `retcode'.
echo $ac_n "checking whether $MIG supports the retcode keyword""... $ac_c" 1>&6
-echo "configure:33: checking whether $MIG supports the retcode keyword" >&5
+echo "configure:28: checking whether $MIG supports the retcode keyword" >&5
if eval "test \"`echo '$''{'hurd_cv_mig_retcode'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -43,7 +38,7 @@ simpleroutine foobar_reply (
reply_port: reply_port_t;
err: kern_return_t, RetCode);
EOF
-if { ac_try='CC="${CC}" ${MIG-false} -n conftest.defs 1>&5'; { (eval echo configure:47: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+if { ac_try='CC="${CC}" ${MIG-false} -n conftest.defs 1>&5'; { (eval echo configure:42: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
hurd_cv_mig_retcode=yes
else
hurd_cv_mig_retcode=no
diff --git a/sysdeps/mach/hurd/configure.in b/sysdeps/mach/hurd/configure.in
index 26bdaf661d..f5afe2f1d3 100644
--- a/sysdeps/mach/hurd/configure.in
+++ b/sysdeps/mach/hurd/configure.in
@@ -14,14 +14,9 @@ fi
case "$machine" in
i386*)
- # With --enable-libio, the default oldest ABI is 2.2.6;
- # without --enable-libio, the default oldest ABI is 2.0.
+ # The default oldest ABI is 2.2.6.
# We only need a "yes" here if the oldest ABI supported will be < 2.2.6.
- if if test "$stdio" = libio; then
- test "$oldest_abi" != default && test "$oldest_abi" \< "2.2.6"
- else
- test "$oldest_abi" = default || test "$oldest_abi" \< "2.2.6"
- fi; then
+ if test "$oldest_abi" != default && test "$oldest_abi" \< "2.2.6"; then
libc_cv_gcc_unwind_find_fde=yes
fi
;;
diff --git a/sysdeps/mach/hurd/defs.c b/sysdeps/mach/hurd/defs.c
deleted file mode 100644
index 3999957d41..0000000000
--- a/sysdeps/mach/hurd/defs.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Definitions of global stdio data structures.
- Copyright (C) 1991,92,93,94,95,97,2000 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-#include <hurd/fd.h>
-#include <unistd.h>
-
-FILE *stdin, *stdout, *stderr;
-
-/* Pointer to the first stream in the list. */
-FILE *__stdio_head = NULL;
-
-/* XXX should be __init_stdio? */
-static void
-init_stdio (void)
-{
- inline void init (FILE **streamptr, int fd)
- {
- /* We want to use the existing FILE object if one has been allocated.
- (This will only be the case if our image came from something like
- Emacs's unexec, where we were called in the first run.) */
- FILE *s = *streamptr ?: __newstream ();
- struct hurd_fd *d = _hurd_fd_get (fd);
- if (d == NULL)
- {
- /* There is no file descriptor allocated. We want the standard
- streams to always refer to their standard file descriptors, even
- if those descriptors are not set up until later. So allocate
- the descriptor structure with no ports and store it in the
- stream. Operations will fail until ports are installed in the
- file descriptor. */
- if (d = _hurd_alloc_fd (NULL, fd))
- __spin_unlock (&d->port.lock);
- }
- if (s)
- s->__cookie = d;
- *streamptr = s;
- }
-#define S(NAME, FD, MODE) \
- init (&NAME, FD); if (NAME) NAME->__mode.__##MODE = 1;
-
- S (stdin, STDIN_FILENO, read);
- S (stdout, STDOUT_FILENO, write);
- S (stderr, STDERR_FILENO, write);
-
-#undef S
-
- if (stderr)
- stderr->__userbuf = 1; /* stderr is always unbuffered. */
-
- (void) &init_stdio; /* Avoid "defined but not used" warning. */
-}
-/* This initializer will be run along with other vanilla libc initializers
- in a normal Posixoid environment. The earlier Hurd-speciifc initializer
- phases cannot use normal facilities like malloc (which stdio uses). */
-text_set_element (__libc_subinit, init_stdio);
-
-/* This function MUST be in this file!
- This is because we want _cleanup to go into the __libc_atexit set
- when any stdio code is used (and to use any stdio code, one must reference
- something defined in this file), and since only local symbols can be made
- set elements, having the set element stab entry here and _cleanup elsewhere
- loses; and having them both elsewhere loses because there is no reference
- to cause _cleanup to be linked in. */
-
-void
-_cleanup (void)
-{
- __fcloseall ();
-}
-text_set_element (__libc_atexit, _cleanup);
diff --git a/sysdeps/mach/hurd/fdopen.c b/sysdeps/mach/hurd/fdopen.c
deleted file mode 100644
index 49cf0e6938..0000000000
--- a/sysdeps/mach/hurd/fdopen.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (C) 1991, 1994, 1995, 1997, 2000 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-#include <hurd/fd.h>
-#include <fcntl.h>
-#include <hurd/io.h>
-
-/* Defined in fopen.c. */
-extern int __getmode (const char *mode, __io_mode *mptr);
-
-/* Open a new stream on a given system file descriptor. */
-FILE *
-__fdopen (fd, mode)
- int fd;
- const char *mode;
-{
- FILE *stream;
- __io_mode m;
- struct hurd_fd *d;
- error_t err;
- int openmodes;
-
- if (!__getmode (mode, &m))
- return NULL;
-
- HURD_CRITICAL_BEGIN;
- d = _hurd_fd_get (fd);
- if (d == NULL)
- err = EBADF;
- else
- err = HURD_FD_PORT_USE (d, __io_get_openmodes (port, &openmodes));
- HURD_CRITICAL_END;
-
- if (err)
- return __hurd_dfail (fd, err), NULL;
-
- /* Check the access mode. */
- if ((m.__read && !(openmodes & O_READ)) ||
- (m.__write && !(openmodes & O_WRITE)))
- {
- errno = EBADF;
- return NULL;
- }
-
- stream = __newstream ();
- if (stream == NULL)
- return NULL;
-
- stream->__cookie = d;
- stream->__mode = m;
-
- return stream;
-}
-
-weak_alias (__fdopen, fdopen)
diff --git a/sysdeps/mach/hurd/pipestream.c b/sysdeps/mach/hurd/pipestream.c
deleted file mode 100644
index 548e1e77eb..0000000000
--- a/sysdeps/mach/hurd/pipestream.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Make sure NO_WAITPID is not set; sysdeps/unix/pipestream.c defines it. */
-#include <sysdeps/posix/pipestream.c>
diff --git a/sysdeps/mach/hurd/stdio_init.c b/sysdeps/mach/hurd/stdio_init.c
deleted file mode 100644
index 2da15ce1b5..0000000000
--- a/sysdeps/mach/hurd/stdio_init.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (C) 1995, 1997, 1998 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <hurd/fd.h>
-#include <hurd/io.h>
-#include <hurd/term.h>
-
-/* Initialize STREAM as necessary.
- This may change I/O functions, give a buffer, etc.
- If no buffer is allocated, but the bufsize is set,
- the bufsize will be used to allocate the buffer. */
-void
-__stdio_init_stream (FILE *stream)
-{
- struct hurd_fd *const d = stream->__cookie;
- struct stat statb;
- error_t err;
-
- if (stream->__buffer != NULL || stream->__userbuf)
- /* If's unbuffered by request, we can't do anything useful. */
- return;
-
- /* Find out what sort of file this is. */
- if (err = HURD_FD_PORT_USE (d, __io_stat (port, &statb)))
- return;
-
- if (S_ISCHR (statb.st_mode))
- {
- /* It's a character device.
- Make it line-buffered if it's a terminal. */
- mach_port_t cttyid;
- err = HURD_FD_PORT_USE (d, __term_getctty (port, &cttyid));
- if (! err)
- {
- __mach_port_deallocate (__mach_task_self (), cttyid);
- stream->__linebuf = 1;
- }
- }
-
- /* Use the block-size field to determine
- the system's optimal buffering size. */
- stream->__bufsize = statb.st_blksize;
-}
diff --git a/sysdeps/mach/hurd/sysd-stdio.c b/sysdeps/mach/hurd/sysd-stdio.c
deleted file mode 100644
index 14a2aee232..0000000000
--- a/sysdeps/mach/hurd/sysd-stdio.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* Copyright (C) 1994,95,96,97,98,2001 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <hurd.h>
-#include <fcntl.h>
-#include <hurd/fd.h>
-
-extern __io_read_fn __stdio_read;
-extern __io_write_fn __stdio_write;
-extern __io_seek_fn __stdio_seek;
-extern __io_close_fn __stdio_close;
-extern __io_fileno_fn __stdio_fileno;
-
-
-/* Check ERR for wanting to generate a signal. */
-
-static inline int
-fd_fail (struct hurd_fd *fd, error_t err)
-{
- int signo = _hurd_fd_error_signal (err);
- if (signo)
- {
- const struct hurd_signal_detail detail
- = { code: __stdio_fileno (fd), error: err, exc: 0 };
- _hurd_raise_signal (NULL, signo, &detail);
- }
- errno = err;
- return -1;
-}
-
-
-/* Read up to N chars into BUF from COOKIE.
- Return how many chars were read, 0 for EOF or -1 for error. */
-ssize_t
-__stdio_read (cookie, buf, n)
- void *cookie;
- char *buf;
- size_t n;
-{
- error_t err;
- struct hurd_fd *fd = cookie;
-
- if (! fd)
- return __hurd_fail (EBADF);
-
- if (err = _hurd_fd_read (fd, buf, &n, -1))
- return fd_fail (fd, err);
-
- return n;
-}
-
-/* Write up to N chars from BUF to COOKIE.
- Return how many chars were written or -1 for error. */
-ssize_t
-__stdio_write (cookie, buf, n)
- void *cookie;
- const char *buf;
- size_t n;
-{
- error_t err;
- size_t wrote, nleft;
- struct hurd_fd *fd = cookie;
-
- if (! fd)
- return __hurd_fail (EBADF);
-
- nleft = n;
- do
- {
- wrote = nleft;
- if (err = _hurd_fd_write (fd, buf, &wrote, -1))
- return fd_fail (fd, err);
- buf += wrote;
- nleft -= wrote;
- } while (nleft > 0);
-
- return wrote;
-}
-
-/* Move COOKIE's file position *POS bytes, according to WHENCE.
- The current file position is stored in *POS.
- Returns zero if successful, nonzero if not. */
-int
-__stdio_seek (cookie, pos, whence)
- void *cookie;
- fpos_t *pos;
- int whence;
-{
- error_t err;
- struct hurd_fd *fd = cookie;
- if (! fd)
- return __hurd_fail (EBADF);
- err = HURD_FD_PORT_USE (fd, __io_seek (port, *pos, whence, pos));
- return err ? fd_fail (fd, err) : 0;
-}
-
-/* Close the file associated with COOKIE.
- Return 0 for success or -1 for failure. */
-int
-__stdio_close (cookie)
- void *cookie;
-{
- error_t error = cookie ? _hurd_fd_close (cookie) : EBADF;
- return error ? fd_fail (cookie, error) : 0;
-}
-
-
-static inline int
-modeflags (__io_mode m)
-{
- int flags = 0;
- if (m.__read)
- flags |= O_READ;
- if (m.__write)
- flags |= O_WRITE;
- if (m.__append)
- flags |= O_APPEND;
- if (m.__create)
- flags |= O_CREAT;
- if (m.__truncate)
- flags |= O_TRUNC;
- if (m.__exclusive)
- flags |= O_EXCL;
- return flags;
-}
-
-/* Open FILENAME with the mode in M. */
-int
-__stdio_open (filename, m, cookieptr)
- const char *filename;
- __io_mode m;
- void **cookieptr;
-{
- int flags;
- file_t port;
- struct hurd_fd *d;
-
- flags = modeflags (m);
- port = __file_name_lookup (filename, flags, 0666 & ~_hurd_umask);
- if (port == MACH_PORT_NULL)
- return -1;
-
- HURD_CRITICAL_BEGIN;
- d = _hurd_alloc_fd (NULL, 0);
- if (d != NULL)
- {
- _hurd_port2fd (d, port, flags);
- __spin_unlock (&d->port.lock);
- }
- HURD_CRITICAL_END;
-
- *cookieptr = d;
- return 0;
-}
-
-
-/* Open FILENAME with the mode in M. Use the same magic cookie
- already in *COOKIEPTR if possible, closing the old cookie with CLOSEFN. */
-int
-__stdio_reopen (const char *filename,
- __io_mode m,
- void **cookieptr,
- __io_close_fn closefn)
-{
- int flags;
- file_t port;
- struct hurd_fd *d;
-
- if (closefn != __stdio_close)
- {
- /* The old cookie is Not Of The Body.
- Just close it and do a normal open. */
- (*closefn) (*cookieptr);
- return __stdio_open (filename, m, cookieptr);
- }
-
- /* Open a new port on the file. */
- flags = modeflags (m);
- port = __file_name_lookup (filename, flags, 0666 & ~_hurd_umask);
-
- /* Install the new port in the same file descriptor slot the old cookie
- points to. If opening the file failed, PORT will be MACH_PORT_NULL
- and installing it in the descriptor will have the effect of closing
- the old descriptor. */
-
- d = *cookieptr;
- HURD_CRITICAL_BEGIN;
- __spin_lock (&d->port.lock);
- _hurd_port2fd (d, port, flags);
- __spin_unlock (&d->port.lock);
- HURD_CRITICAL_END;
-
- return port == MACH_PORT_NULL ? -1 : 0;
-}
-
-
-/* Write a message to the error output.
- Try hard to make it really get out. */
-void
-__stdio_errmsg (msg, len)
- const char *msg;
- size_t len;
-{
- io_t server;
- mach_msg_type_number_t wrote;
-
- server = __getdport (2);
- __io_write (server, msg, len, -1, &wrote);
- __mach_port_deallocate (__mach_task_self (), server);
-}
-
-
-/* Return the POSIX.1 file descriptor associated with COOKIE,
- or -1 for errors. If COOKIE does not relate to any POSIX.1 file
- descriptor, this should return -1 with errno set to EOPNOTSUPP. */
-int
-__stdio_fileno (cookie)
- void *cookie;
-{
- int fd;
-
- if (! cookie)
- return __hurd_fail (EBADF);
-
- __mutex_lock (&_hurd_dtable_lock);
- for (fd = 0; fd < _hurd_dtablesize; ++fd)
- if (_hurd_dtable[fd] == cookie)
- {
- __mutex_unlock (&_hurd_dtable_lock);
- return fd;
- }
- __mutex_unlock (&_hurd_dtable_lock);
-
- /* This should never happen, because this function should not be
- installed as a stream's __fileno function unless that stream's cookie
- points to a file descriptor. */
- errno = EGRATUITOUS;
- return -1;
-}
diff --git a/sysdeps/mach/hurd/vdprintf.c b/sysdeps/mach/hurd/vdprintf.c
deleted file mode 100644
index 568fb6b733..0000000000
--- a/sysdeps/mach/hurd/vdprintf.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <hurd/fd.h>
-
-/* Write formatted output to file descriptor D according to the format string
- FORMAT, using the argument list in ARG. */
-int
-vdprintf (int d, const char *format, va_list arg)
-{
- int done;
- FILE f;
- struct hurd_fd *fd;
-
- HURD_CRITICAL_BEGIN;
- fd = _hurd_fd_get (d);
- HURD_CRITICAL_END;
-
- if (!fd)
- return 0;
-
- /* Create an unbuffered stream talking to D on the stack. */
- memset ((void *) &f, 0, sizeof (f));
- f.__magic = _IOMAGIC;
- f.__mode.__write = 1;
- f.__cookie = fd;
- f.__room_funcs = __default_room_functions;
- f.__io_funcs = __default_io_functions;
- f.__seen = 1;
- f.__userbuf = 1;
-
- /* vfprintf will use a buffer on the stack for the life of the call,
- and flush it when finished. */
- done = vfprintf (&f, format, arg);
-
- return done;
-}
diff --git a/sysdeps/posix/defs.c b/sysdeps/posix/defs.c
deleted file mode 100644
index 7fe1908531..0000000000
--- a/sysdeps/posix/defs.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Definitions of global stdio data structures.
- Copyright (C) 1991, 1993, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stddef.h>
-#include <stdio.h>
-#include <unistd.h>
-
-/* This file defines all the global internal variables for stdio. */
-
-/* Standard streams. */
-#define READ 1, 0
-#define WRITE 0, 1
-#define BUFFERED 0
-#define UNBUFFERED 1
-#define stdstream(name, next, fd, readwrite, unbuffered) \
- { \
- _IOMAGIC, \
- NULL, NULL, NULL, NULL, 0, \
- (void *) fd, \
- { readwrite, /* ... */ }, \
- { NULL, NULL, NULL, NULL, NULL }, \
- { NULL, NULL }, \
- -1, -1, \
- (next), \
- NULL, '\0', 0, \
- 0, 0, unbuffered, 0, 0, 0, 0 \
- }
-static FILE stdstreams[3] =
- {
- stdstream (&stdstreams[0], &stdstreams[1], STDIN_FILENO, READ, BUFFERED),
- stdstream (&stdstreams[1], &stdstreams[2], STDOUT_FILENO, WRITE, BUFFERED),
- stdstream (&stdstreams[2], NULL, STDERR_FILENO, WRITE, UNBUFFERED),
- };
-FILE *stdin = &stdstreams[0];
-FILE *stdout = &stdstreams[1];
-FILE *stderr = &stdstreams[2];
-
-/* Pointer to the first stream in the list. */
-FILE *__stdio_head = &stdstreams[0];
-
-/* This function MUST be in this file!
- This is because we want _cleanup to go into the __libc_atexit set
- when any stdio code is used (and to use any stdio code, one must reference
- something defined in this file), and since only local symbols can be made
- set elements, having the set element stab entry here and _cleanup elsewhere
- loses; and having them both elsewhere loses because there is no reference
- to cause _cleanup to be linked in. */
-
-void
-_cleanup (void)
-{
- __fcloseall ();
-}
-
-
-#ifdef HAVE_GNU_LD
-text_set_element(__libc_atexit, _cleanup);
-#endif
diff --git a/sysdeps/posix/fdopen.c b/sysdeps/posix/fdopen.c
deleted file mode 100644
index af951db5a2..0000000000
--- a/sysdeps/posix/fdopen.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993, 1996 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdio.h>
-#include <fcntl.h>
-
-/* Defined in fopen.c. */
-extern int __getmode (const char *mode, __io_mode *mptr);
-
-/* Open a new stream on a given system file descriptor. */
-FILE *
-__fdopen (fd, mode)
- int fd;
- const char *mode;
-{
- register FILE *stream;
- __io_mode m;
- int dflags;
-
- if (!__getmode (mode, &m))
- return NULL;
-
- /* Verify the FD is valid and allows the access MODE specifies. */
-
- dflags = __fcntl (fd, F_GETFL);
- if (dflags == -1)
- /* FD was invalid; fcntl has already set errno. */
- return NULL;
-
- /* Check the access mode. */
- switch (dflags & O_ACCMODE)
- {
- case O_RDONLY:
- if (!m.__read)
- {
- __set_errno (EBADF);
- return NULL;
- }
- break;
- case O_WRONLY:
- if (!m.__write)
- {
- __set_errno (EBADF);
- return NULL;
- }
- break;
- }
-
- stream = __newstream ();
- if (stream == NULL)
- return NULL;
-
- stream->__cookie = (void *) fd;
- stream->__mode = m;
-
- return stream;
-}
-
-weak_alias (__fdopen, fdopen)
diff --git a/sysdeps/posix/pipestream.c b/sysdeps/posix/pipestream.c
deleted file mode 100644
index 94e09f1b9d..0000000000
--- a/sysdeps/posix/pipestream.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993, 1996, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stddef.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#define SH_PATH "/bin/sh" /* Shell to run. */
-#define SH_NAME "sh" /* Name to give it. */
-
-/* Structure describing a popen child. */
-struct child
- {
- pid_t pid; /* PID of the child. */
- __ptr_t cookie; /* Original cookie from fdopen. */
- __io_functions funcs; /* Original functions from fdopen. */
- };
-
-/* io_functions for pipe streams.
- These all simply call the corresponding
- original function with the original cookie. */
-
-#define FUNC(type, name, proto, args) \
- static type __CONCAT(child_,name) proto \
- { \
- struct child *c = (struct child *) cookie; \
- { \
- __ptr_t cookie = c->cookie; \
- return (*c->funcs.__CONCAT(__,name)) args; \
- } \
- }
-
-FUNC (int, read, (void *cookie, char *buf, size_t n), (cookie, buf, n))
-FUNC (int, write, (void *cookie, const char *buf, size_t n), (cookie, buf, n))
-FUNC (int, seek, (void *cookie, fpos_t *pos, int whence),
- (cookie, pos, whence))
-FUNC (int, close, (void *cookie), (cookie))
-FUNC (int, fileno, (void *cookie), (cookie))
-
-static const __io_functions child_funcs
- = { child_read, child_write, child_seek, child_close, child_fileno };
-
-/* Open a new stream that is a one-way pipe to a
- child process running the given shell command. */
-FILE *
-popen (command, mode)
- const char *command;
- const char *mode;
-{
- pid_t pid;
- int pipedes[2];
- FILE *stream;
- struct child *child;
-
- if (command == NULL || mode == NULL || (*mode != 'r' && *mode != 'w'))
- {
- __set_errno (EINVAL);
- return NULL;
- }
-
- /* Create the pipe. */
- if (pipe (pipedes) < 0)
- return NULL;
-
- /* Fork off the child. */
- pid = __vfork ();
- if (pid == (pid_t) -1)
- {
- /* The fork failed. */
- (void) close (pipedes[0]);
- (void) close (pipedes[1]);
- return NULL;
- }
- else if (pid == (pid_t) 0)
- {
- /* We are the child side. Make the write side of
- the pipe be stdin or the read side be stdout. */
-
- const char *new_argv[4];
-
- if ((*mode == 'w' ? dup2(pipedes[STDIN_FILENO], STDIN_FILENO) :
- dup2 (pipedes[STDOUT_FILENO], STDOUT_FILENO)) < 0)
- _exit (127);
-
- /* Close the pipe descriptors. */
- (void) close (pipedes[STDIN_FILENO]);
- (void) close (pipedes[STDOUT_FILENO]);
-
- /* Exec the shell. */
- new_argv[0] = SH_NAME;
- new_argv[1] = "-c";
- new_argv[2] = command;
- new_argv[3] = NULL;
- (void) execve (SH_PATH, (char *const *) new_argv, environ);
- /* Die if it failed. */
- _exit (127);
- }
-
- /* We are the parent side. */
-
- /* Close the irrelevant side of the pipe and open the relevant side as a
- new stream. Mark our side of the pipe to close on exec, so new children
- won't see it. */
- if (*mode == 'r')
- {
- (void) close (pipedes[STDOUT_FILENO]);
- (void) fcntl (pipedes[STDIN_FILENO], F_SETFD, FD_CLOEXEC);
- stream = fdopen (pipedes[STDIN_FILENO], mode);
- }
- else
- {
- (void) close (pipedes[STDIN_FILENO]);
- (void) fcntl (pipedes[STDOUT_FILENO], F_SETFD, FD_CLOEXEC);
- stream = fdopen (pipedes[STDOUT_FILENO], mode);
- }
-
- if (stream == NULL)
- goto error;
-
- child = (struct child *) malloc (sizeof (struct child));
- if (child == NULL)
- goto error;
-
- {
- /* Make sure STREAM has its functions set before
- we try to squirrel them away in CHILD. */
- extern void __stdio_check_funcs __P ((FILE *));
- __stdio_check_funcs (stream);
- }
-
- child->pid = pid;
- child->cookie = stream->__cookie;
- child->funcs = stream->__io_funcs;
- stream->__cookie = (void *) child;
- stream->__io_funcs = child_funcs;
- stream->__ispipe = 1;
- return stream;
-
- error:
- {
- /* The stream couldn't be opened or the child structure couldn't be
- allocated. Kill the child and close the other side of the pipe. */
- int save = errno;
- (void) kill (pid, SIGKILL);
- if (stream == NULL)
- (void) close (pipedes[*mode == 'r' ? STDOUT_FILENO : STDIN_FILENO]);
- else
- (void) fclose (stream);
-#ifndef NO_WAITPID
- (void) waitpid (pid, (int *) NULL, 0);
-#else
- {
- pid_t dead;
- do
- dead = wait ((int *) NULL);
- while (dead > 0 && dead != pid);
- }
-#endif
- __set_errno (save);
- return NULL;
- }
-}
-
-/* Close a stream opened by popen and return its status.
- Returns -1 if the stream was not opened by popen. */
-int
-pclose (stream)
- register FILE *stream;
-{
- struct child *c;
- pid_t pid, dead;
- int status;
-
- if (!__validfp (stream) || !stream->__ispipe)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- c = (struct child *) stream->__cookie;
- pid = c->pid;
- stream->__cookie = c->cookie;
- stream->__io_funcs = c->funcs;
- free ((void *) c);
- stream->__ispipe = 0;
- if (fclose (stream))
- return -1;
-
-#ifndef NO_WAITPID
- dead = waitpid (pid, &status, 0);
-#else
- do
- dead = wait (&status);
- while (dead > 0 && dead != pid);
-#endif
- if (dead != pid)
- status = -1;
-
- return status;
-}
diff --git a/sysdeps/posix/stdio_init.c b/sysdeps/posix/stdio_init.c
deleted file mode 100644
index 99b4e807a4..0000000000
--- a/sysdeps/posix/stdio_init.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993, 1995, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-/* Initialize STREAM as necessary.
- This may change I/O functions, give a buffer, etc.
- If no buffer is allocated, but the bufsize is set,
- the bufsize will be used to allocate the buffer. */
-void
-__stdio_init_stream (FILE *stream)
-{
- const int fd = (int) stream->__cookie;
- struct stat statb;
-
- if (stream->__buffer != NULL || stream->__userbuf)
- /* If's unbuffered by request, we can't do anything useful. */
- return;
-
- /* Find out what sort of file this is. */
- if (__fstat (fd, &statb) < 0)
- return;
-
- if (S_ISCHR (statb.st_mode))
- {
- /* It's a character device.
- Make it line-buffered if it's a terminal. */
- if (__isatty (fd))
- {
- stream->__linebuf = 1;
-
- /* Unix terminal devices have the bad habit of claiming to be
- seekable. On systems I have tried, seeking on a terminal
- device seems to set its file position as specified, such that
- a later tell says the same thing. This is in no way related
- to actual seekability--the ability to seek back and read old
- data. Unix terminal devices will let you "seek back", and
- then read more new data from the terminal. I can think of
- nothing to do about this lossage except to preemptively disable
- seeking on terminal devices. */
-
- stream->__io_funcs.__seek = NULL; /* Seeks get ESPIPE. */
- }
- }
-
-#ifdef _STATBUF_ST_BLKSIZE
- /* Use the block-size field to determine
- the system's optimal buffering size. */
- stream->__bufsize = statb.st_blksize;
-#endif
-}
diff --git a/sysdeps/posix/vdprintf.c b/sysdeps/posix/vdprintf.c
deleted file mode 100644
index f28bfdfd55..0000000000
--- a/sysdeps/posix/vdprintf.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993, 1997 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 Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-
-
-/* Write formatted output to file descriptor D according to the format string
- FORMAT, using the argument list in ARG. */
-int
-vdprintf (int d, const char *format, va_list arg)
-{
- int done;
- FILE f;
-
- /* Create an unbuffered stream talking to D on the stack. */
- memset ((void *) &f, 0, sizeof(f));
- f.__magic = _IOMAGIC;
- f.__mode.__write = 1;
- f.__cookie = (void *) (long int) d; /* Casting to long quiets GCC on Alpha.*/
- f.__room_funcs = __default_room_functions;
- f.__io_funcs = __default_io_functions;
- f.__seen = 1;
- f.__userbuf = 1;
-
- /* vfprintf will use a buffer on the stack for the life of the call,
- and flush it when finished. */
- done = vfprintf (&f, format, arg);
-
- return done;
-}
diff --git a/sysdeps/unix/pipestream.c b/sysdeps/unix/pipestream.c
deleted file mode 100644
index 1d3308fe7c..0000000000
--- a/sysdeps/unix/pipestream.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define NO_WAITPID
-#include <sysdeps/posix/pipestream.c>
diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in
index d1d0d32747..486b10d7cb 100644
--- a/sysdeps/unix/sysv/linux/configure.in
+++ b/sysdeps/unix/sysv/linux/configure.in
@@ -2,9 +2,6 @@ sinclude(./aclocal.m4)dnl Autoconf lossage
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
# Local configure fragment for sysdeps/unix/sysv/linux.
-# On Linux, the default is to use libio instead of stdio.
-test $stdio = default && stdio=libio
-
# Don't bother trying to generate any glue code to be compatible with the
# existing system library, because we are the only system library.
inhibit_glue=yes
diff --git a/sysdeps/unix/sysv/sco3.2.4/pipestream.c b/sysdeps/unix/sysv/sco3.2.4/pipestream.c
deleted file mode 100644
index b768e62043..0000000000
--- a/sysdeps/unix/sysv/sco3.2.4/pipestream.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* SCO 3.2v4 does have `waitpid'.
- Avoid unix/pipestream.c, which says we don't. */
-#include <sysdeps/posix/pipestream.c>
diff --git a/sysdeps/unix/sysv/sysd-stdio.c b/sysdeps/unix/sysv/sysd-stdio.c
deleted file mode 100644
index 7f82340201..0000000000
--- a/sysdeps/unix/sysv/sysd-stdio.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define EINTR_REPEAT
-#include <sysdeps/generic/sysd-stdio.c>
diff --git a/sysdeps/unix/sysv/sysv4/pipestream.c b/sysdeps/unix/sysv/sysv4/pipestream.c
deleted file mode 100644
index 6a32f9507c..0000000000
--- a/sysdeps/unix/sysv/sysv4/pipestream.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* We deliberately avoid having NO_WAITPID set. */
-#include <sysdeps/posix/pipestream.c>