Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Makefile (subdirs): Replace stdio with stdio-common and $(stdio).
	* configure.in: Grok arg --enable-libio.
	($stdio = libio): Define USE_IN_LIBIO.
	* config.h.in (USE_IN_LIBIO): Add #undef.
	* config.make.in (stdio): New variable, set by configure.
	* Makeconfig (stdio): New variable.
	* stdio.h [USE_IN_LIBIO]: Include libio/stdio.h instead of
	stdio/stdio.h.
	* stdio-common/Makefile: New file.
	* stdio/Makefile: Half the contents moved to stdio-common/Makefile.
	* stdio/_itoa.c: Moved to stdio-common.
	* stdio/_itoa.h: Moved to stdio-common.
	* stdio/asprintf.c: Moved to stdio-common.
	* stdio/bug1.c: Moved to stdio-common.
	* stdio/bug1.input: Moved to stdio-common.
	* stdio/bug2.c: Moved to stdio-common.
	* stdio/bug3.c: Moved to stdio-common.
	* stdio/bug4.c: Moved to stdio-common.
	* stdio/bug5.c: Moved to stdio-common.
	* stdio/bug6.c: Moved to stdio-common.
	* stdio/bug6.input: Moved to stdio-common.
	* stdio/bug7.c: Moved to stdio-common.
	* stdio/dprintf.c: Moved to stdio-common.
	* stdio/errnobug.c: Moved to stdio-common.
	* stdio/getline.c: Moved to stdio-common.
	* stdio/getw.c: Moved to stdio-common.
	* stdio/perror.c: Moved to stdio-common.
	* stdio/printf-parse.h: Moved to stdio-common.
	* stdio/printf-prs.c: Moved to stdio-common.
	* stdio/printf.c: Moved to stdio-common.
	* stdio/printf.h: Moved to stdio-common.
	* stdio/printf_fp.c: Moved to stdio-common.
	* stdio/psignal.c: Moved to stdio-common.
	* stdio/putw.c: Moved to stdio-common.
	* stdio/reg-printf.c: Moved to stdio-common.
	* stdio/scanf.c: Moved to stdio-common.
	* stdio/snprintf.c: Moved to stdio-common.
	* stdio/sprintf.c: Moved to stdio-common.
	* stdio/sscanf.c: Moved to stdio-common.
	* stdio/tempnam.c: Moved to stdio-common.
	* stdio/temptest.c: Moved to stdio-common.
	* stdio/test-fseek.c: Moved to stdio-common.
	* stdio/test-fwrite.c: Moved to stdio-common.
	* stdio/test-popen.c: Moved to stdio-common.
	* stdio/test_rdwr.c: Moved to stdio-common.
	* stdio/tmpfile.c: Moved to stdio-common.
	* stdio/tmpnam.c: Moved to stdio-common.
	* stdio/tst-fileno.c: Moved to stdio-common.
	* stdio/tst-printf.c: Moved to stdio-common.
	* stdio/tstgetln.c: Moved to stdio-common.
	* stdio/tstgetln.input: Moved to stdio-common.
	* stdio/tstscanf.c: Moved to stdio-common.
	* stdio/tstscanf.input: Moved to stdio-common.
	* stdio/vfprintf.c: Moved to stdio-common.
	* stdio/vfscanf.c: Moved to stdio-common.
	* stdio/vprintf.c: Moved to stdio-common.
	* stdio/xbug.c: Moved to stdio-common.
	* sysdeps/generic/Makefile (siglist.c rules): Do this in subdir
	stdio-common instead of stdio.
	* sysdeps/unix/Makefile (errlist.c rules): Likewise.
	* stdio-common/asprintf.c [USE_IN_LIBIO]: Call libio primitive
	function.
	* stdio-common/dprintf.c: Likewise.
	* stdio-common/printf.c: Likewise.
	* stdio-common/scanf.c: Likewise.
	* stdio-common/snprintf.c: Likewise.
	* stdio-common/sprintf.c: Likewise.
	* stdio-common/sscanf.c: Likewise.
	* stdio-common/vprintf.c: Likewise.

	* Makerules: Include $(+depfiles) directly instead of generating
	depend-$(subdir).
	(depend-$(subdir)): Target removed.
	(common-clean): Don't remove depend-$(subdir).
  • Loading branch information
Roland McGrath committed Oct 17, 1995
1 parent 10fd03c commit deab9de
Show file tree
Hide file tree
Showing 66 changed files with 235 additions and 87 deletions.
75 changes: 75 additions & 0 deletions ChangeLog
@@ -1,5 +1,80 @@
Mon Oct 16 03:22:37 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>

* Makefile (subdirs): Replace stdio with stdio-common and $(stdio).
* configure.in: Grok arg --enable-libio.
($stdio = libio): Define USE_IN_LIBIO.
* config.h.in (USE_IN_LIBIO): Add #undef.
* config.make.in (stdio): New variable, set by configure.
* Makeconfig (stdio): New variable.
* stdio.h [USE_IN_LIBIO]: Include libio/stdio.h instead of
stdio/stdio.h.
* stdio-common/Makefile: New file.
* stdio/Makefile: Half the contents moved to stdio-common/Makefile.
* stdio/_itoa.c: Moved to stdio-common.
* stdio/_itoa.h: Moved to stdio-common.
* stdio/asprintf.c: Moved to stdio-common.
* stdio/bug1.c: Moved to stdio-common.
* stdio/bug1.input: Moved to stdio-common.
* stdio/bug2.c: Moved to stdio-common.
* stdio/bug3.c: Moved to stdio-common.
* stdio/bug4.c: Moved to stdio-common.
* stdio/bug5.c: Moved to stdio-common.
* stdio/bug6.c: Moved to stdio-common.
* stdio/bug6.input: Moved to stdio-common.
* stdio/bug7.c: Moved to stdio-common.
* stdio/dprintf.c: Moved to stdio-common.
* stdio/errnobug.c: Moved to stdio-common.
* stdio/getline.c: Moved to stdio-common.
* stdio/getw.c: Moved to stdio-common.
* stdio/perror.c: Moved to stdio-common.
* stdio/printf-parse.h: Moved to stdio-common.
* stdio/printf-prs.c: Moved to stdio-common.
* stdio/printf.c: Moved to stdio-common.
* stdio/printf.h: Moved to stdio-common.
* stdio/printf_fp.c: Moved to stdio-common.
* stdio/psignal.c: Moved to stdio-common.
* stdio/putw.c: Moved to stdio-common.
* stdio/reg-printf.c: Moved to stdio-common.
* stdio/scanf.c: Moved to stdio-common.
* stdio/snprintf.c: Moved to stdio-common.
* stdio/sprintf.c: Moved to stdio-common.
* stdio/sscanf.c: Moved to stdio-common.
* stdio/tempnam.c: Moved to stdio-common.
* stdio/temptest.c: Moved to stdio-common.
* stdio/test-fseek.c: Moved to stdio-common.
* stdio/test-fwrite.c: Moved to stdio-common.
* stdio/test-popen.c: Moved to stdio-common.
* stdio/test_rdwr.c: Moved to stdio-common.
* stdio/tmpfile.c: Moved to stdio-common.
* stdio/tmpnam.c: Moved to stdio-common.
* stdio/tst-fileno.c: Moved to stdio-common.
* stdio/tst-printf.c: Moved to stdio-common.
* stdio/tstgetln.c: Moved to stdio-common.
* stdio/tstgetln.input: Moved to stdio-common.
* stdio/tstscanf.c: Moved to stdio-common.
* stdio/tstscanf.input: Moved to stdio-common.
* stdio/vfprintf.c: Moved to stdio-common.
* stdio/vfscanf.c: Moved to stdio-common.
* stdio/vprintf.c: Moved to stdio-common.
* stdio/xbug.c: Moved to stdio-common.
* sysdeps/generic/Makefile (siglist.c rules): Do this in subdir
stdio-common instead of stdio.
* sysdeps/unix/Makefile (errlist.c rules): Likewise.
* stdio-common/asprintf.c [USE_IN_LIBIO]: Call libio primitive
function.
* stdio-common/dprintf.c: Likewise.
* stdio-common/printf.c: Likewise.
* stdio-common/scanf.c: Likewise.
* stdio-common/snprintf.c: Likewise.
* stdio-common/sprintf.c: Likewise.
* stdio-common/sscanf.c: Likewise.
* stdio-common/vprintf.c: Likewise.

* Makerules: Include $(+depfiles) directly instead of generating
depend-$(subdir).
(depend-$(subdir)): Target removed.
(common-clean): Don't remove depend-$(subdir).

* sysdeps/unix/sysv/linux/Makefile (rtld-installed-name): New variable.
(config-LDFLAGS): Variable removed.

Expand Down
6 changes: 6 additions & 0 deletions Makeconfig
Expand Up @@ -114,6 +114,12 @@ export sysdep_dir := $(sysdep_dir)
####


# Set this to either `stdio' or `libio', to compile in either GNU stdio
# or GNU libio.
ifndef stdio
stdio = stdio
endif

# Common prefix for machine-independent installation directories.
ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
prefix = /usr/local
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Expand Up @@ -51,10 +51,10 @@ sysdep-subdirs := $(subst $(\n), ,$(sysdep-subdirs))
endif

# These are the subdirectories containing the library source.
subdirs := csu assert ctype locale intl math setjmp signal stdio stdlib \
malloc string time dirent grp pwd posix io termios resource \
misc socket sysvipc gmon gnulib $(wildcard crypt) manual \
$(sysdep-subdirs) elf
subdirs = csu assert ctype locale intl math setjmp signal stdlib \
stdio-common $(stdio) malloc string time dirent grp pwd \
posix io termios resource misc socket sysvipc gmon gnulib \
$(wildcard crypt) manual $(sysdep-subdirs) elf
export subdirs := $(subdirs) # Benign, useless in GNU make before 3.63.

# The mach and hurd subdirectories have many generated header files which
Expand Down
16 changes: 3 additions & 13 deletions Makerules
Expand Up @@ -301,19 +301,10 @@ endif
$(filter-out $(addsuffix .d,$(omit-deps)),\
$(+depfiles)))

$(objpfx)depend-$(subdir): Makefile
ifdef +depfiles
for file in $(+depfiles:$(objpfx)%=%); do \
echo "include \$$(objpfx)$$file"; \
done > $@-tmp
mv -f $@-tmp $@
else
cp /dev/null $@
endif

ifneq ($(no_deps),t)
# Include the generated dependencies of the sources in this directory.
include $(objpfx)depend-$(subdir)
include $(+depfiles)
endif
endif

# Maximize efficiency by minimizing the number of rules.
Expand Down Expand Up @@ -623,8 +614,7 @@ endef

# Also remove the dependencies and generated source files.
common-clean: common-mostlyclean
-rm -f $(objpfx)depend-$(subdir) $(+depfiles)
-rm -f $(addprefix $(objpfx),$(generated))
-rm -f $(addprefix $(objpfx),$(generated)) $(+depfiles)

# Produce a file `stub-$(subdir)' which contains `#define __stub_FUNCTION'
# for each function which is a stub. We grovel over all the .d files
Expand Down
4 changes: 4 additions & 0 deletions config.h.in
Expand Up @@ -30,6 +30,10 @@
#define HAVE_WEAK_SYMBOLS
#endif
#endif

/* Define to use GNU libio instead of GNU stdio.
This is defined by configure under --enable-libio. */
#undef USE_IN_LIBIO
/* */
/* These symbols might be defined by some sysdeps configures. */

Expand Down
1 change: 1 addition & 0 deletions config.make.in
Expand Up @@ -24,6 +24,7 @@ gnu-ld = @gnu_ld@
build-shared = @shared@
build-profile = @profile@
build-omitfp = @omitfp@
stdio = @stdio@

# Build tools.
CC = @CC@
Expand Down
8 changes: 8 additions & 0 deletions configure.in
Expand Up @@ -40,6 +40,11 @@ AC_ARG_WITH(weak-symbols, dnl
--with-weak-symbols if weak symbols are available in as and ld,
weak=$withval, weak=no)

AC_ARG_ENABLE(libio, dnl
[ --enable-libio build in GNU libio instead of GNU stdio],
stdio=libio, stdio=stdio)
AC_SUBST(stdio)

dnl Arguments to enable or disable building the shared, profiled, and
dnl -fomit-frame-pointer libraries.
AC_ARG_ENABLE(shared, dnl
Expand Down Expand Up @@ -485,6 +490,9 @@ fi
AC_SUBST(profile)
AC_SUBST(omitfp)

if test $stdio = libio; then
AC_DEFINE(USE_IN_LIBIO)
fi

if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
config_makefile=
Expand Down
47 changes: 47 additions & 0 deletions stdio-common/Makefile
@@ -0,0 +1,47 @@
# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
# This file is part of the GNU C Library.

# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.

# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.

# You should have received a copy of the GNU Library General Public
# License along with the GNU C Library; see the file COPYING.LIB. If
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
# Cambridge, MA 02139, USA.

#
# Specific makefile for stdio-common.
#
subdir := stdio-common

headers := stdio_lim.h printf.h

routines := \
ctermid cuserid \
vfprintf vprintf printf_fp reg-printf printf-prs _itoa \
vsnprintf vsprintf vasprintf \
fprintf printf snprintf sprintf asprintf \
dprintf vdprintf \
vfscanf vscanf vsscanf \
fscanf scanf sscanf \
perror psignal \
tmpfile tmpnam tempnam tempname \
getline getw putw \
remove rename
aux := errlist siglist
distribute := _itoa.h printf-parse.h

tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \
temptest tst-fileno test-fwrite \
xbug errnobug \
bug1 bug2 bug3 bug4 bug5 bug6 bug7


include ../Rules
File renamed without changes.
File renamed without changes.
17 changes: 10 additions & 7 deletions stdio/asprintf.c → stdio-common/asprintf.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Expand All @@ -16,24 +16,27 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */

#include <ansidecl.h>
#include <stdarg.h>
#include <stdio.h>

#ifdef USE_IN_LIBIO
# define vasprintf _IO_vasprintf
#endif

/* Write formatted output from FORMAT to a string which is
allocated with malloc and stored in *STRING_PTR. */
/* VARARGS2 */
int
DEFUN(asprintf, (string_ptr, format),
char **string_ptr AND CONST char *format DOTS)
asprintf (string_ptr, format)
char **string_ptr;
const char *format;
{
va_list arg;
int done;

va_start(arg, format);
done = vasprintf(string_ptr, format, arg);
va_end(arg);
va_start (arg, format);
done = vasprintf (string_ptr, format, arg);
va_end (arg);

return done;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 10 additions & 6 deletions stdio/dprintf.c → stdio-common/dprintf.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Expand All @@ -16,22 +16,26 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */

#include <ansidecl.h>
#include <stdarg.h>
#include <stdio.h>

#ifdef USE_IN_LIBIO
# define vdprintf _IO_vdprintf
#endif

/* Write formatted output to D, according to the format string FORMAT. */
/* VARARGS2 */
int
DEFUN(dprintf, (d, format), int d AND CONST char *format DOTS)
dprintf (d, format)
int d;
const char *format;
{
va_list arg;
int done;

va_start(arg, format);
done = vdprintf(d, format, arg);
va_end(arg);
va_start (arg, format);
done = vdprintf (d, format, arg);
va_end (arg);

return done;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 9 additions & 6 deletions stdio/printf.c → stdio-common/printf.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Expand All @@ -16,22 +16,25 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */

#include <ansidecl.h>
#include <stdarg.h>
#include <stdio.h>

#ifdef USE_IN_LIBIO
# define vprintf _IO_vprintf
#endif

/* Write formatted output to stdout from the format string FORMAT. */
/* VARARGS1 */
int
DEFUN(printf, (format), CONST char *format DOTS)
printf (format)
const char *format;
{
va_list arg;
int done;

va_start(arg, format);
done = vprintf(format, arg);
va_end(arg);
va_start (arg, format);
done = vprintf (format, arg);
va_end (arg);

return done;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 9 additions & 6 deletions stdio/scanf.c → stdio-common/scanf.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Expand All @@ -16,22 +16,25 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */

#include <ansidecl.h>
#include <stdarg.h>
#include <stdio.h>

#ifdef USE_IN_LIBIO
# define vscanf _IO_vscanf
#endif

/* Read formatted input from stdin according to the format string FORMAT. */
/* VARARGS1 */
int
DEFUN(scanf, (format), CONST char *format DOTS)
scanf (format)
const char *format;
{
va_list arg;
int done;

va_start(arg, format);
done = vscanf(format, arg);
va_end(arg);
va_start (arg, format);
done = vscanf (format, arg);
va_end (arg);

return done;
}

0 comments on commit deab9de

Please sign in to comment.