1997-08-20 05:30  Ulrich Drepper  <drepper@cygnus.com>

	* catgets/catgets.c (catclose): Use __munmap instead of munmap.
	* catgets/gencat.c (read_input_file): Fix typo.

	* dirent/dirent.h: Make seekdir and telldir available for __USE_XOPEN.

	* elf/dl-load.c: Fix case of missing DT_RPATH in object which gets
	executed (e.g., when it is a static binary).

	* intl/bindtextdomain.c: Use strdup in glibc.  Correct comment.
	* intl/dcgettext.c: Likewise.
	* intl/dgettext.c: Likewise.
	* intl/explodename.c: Likewise.
	* intl/finddomain.c: Likewise.
	* intl/gettext.c: Likewise.
	* intl/gettext.h: Likewise.
	* intl/hash-string.h: Likewise.
	* intl/l10nflist.c: Likewise.
	* intl/libintl.h: Likewise.
	* intl/loadinfo.h: Likewise.
	* intl/loadmsgcat.c: Likewise.
	* intl/localealias.c: Likewise.
	* intl/textdomain.c: Likewise.

	Unify libio sources with code in libg++.
	* libio/fcloseall.c: Update and reformat copyright.  Protect use
	of weak_alias.  Use _IO_* thread macros instead of __libc_*.
	* libio/feof.c: Likewise.
	* libio/feof_u.c: Likewise.
	* libio/ferror.c: Likewise.
	* libio/ferror_u.c: Likewise.
	* libio/fgetc.c: Likewise.
	* libio/filedoalloc.c: Likewise.
	* libio/fileno.c: Likewise.
	* libio/fileops.c: Likewise.
	* libio/fputc.c: Likewise.
	* libio/fputc_u.c: Likewise.
	* libio/freopen.c: Likewise.
	* libio/fseek.c: Likewise.
	* libio/genops.c: Likewise.
	* libio/getc.c: Likewise.
	* libio/getc_u.c: Likewise.
	* libio/getchar.c: Likewise.
	* libio/getchar_u.c: Likewise.
	* libio/iofclose.c: Likewise.
	* libio/iofdopen.c: Likewise.
	* libio/iofflush.c: Likewise.
	* libio/iofflush_u.c: Likewise.
	* libio/iofgetpos.c: Likewise.
	* libio/iofgets.c: Likewise.
	* libio/iofopen.c: Likewise.
	* libio/iofopncook.c: Likewise.
	* libio/iofprintf.c: Likewise.
	* libio/iofputs.c: Likewise.
	* libio/iofread.c: Likewise.
	* libio/iofsetpos.c: Likewise.
	* libio/ioftell.c: Likewise.
	* libio/iofwrite.c: Likewise.
	* libio/iogetdelim.c: Likewise.
	* libio/iogetline.c: Likewise.
	* libio/iogets.c: Likewise.
	* libio/iopadn.c: Likewise.
	* libio/iopopen.c: Likewise.
	* libio/ioputs.c: Likewise.
	* libio/ioseekoff.c: Likewise.
	* libio/ioseekpos.c: Likewise.
	* libio/iosetbuffer.c: Likewise.
	* libio/iosetvbuf.c: Likewise.
	* libio/iosprintf.c: Likewise.
	* libio/ioungetc.c: Likewise.
	* libio/iovdprintf.c: Likewise.
	* libio/iovsprintf.c: Likewise.
	* libio/iovsscanf.c: Likewise.
	* libio/libio.h: Likewise.
	* libio/libioP.h: Likewise.
	* libio/obprintf.c: Likewise.
	* libio/pclose.c: Likewise.
	* libio/peekc.c: Likewise.
	* libio/putc.c: Likewise.
	* libio/putchar.c: Likewise.
	* libio/rewind.c: Likewise.
	* libio/setbuf.c: Likewise.
	* libio/setlinebuf.c: Likewise.
	* libio/stdfiles.c: Likewise.
	* libio/stdio.c: Likewise.
	* libio/strfile.h: Likewise.
	* libio/strops.c: Likewise.
	* libio/vasprintf.c: Likewise.
	* libio/vscanf.c: Likewise.
	* libio/vsnprintf.c: Likewise.

	* manual/libc.texinfo: Add menu entries for chapter on message
	translation.
	* manual/locale.texi: Correct next entry in @node for new chapter.
	* manual/search.texi: Likewise for previous link.
	* manual/message.texi: New file.
	* manual/startup.texi: Document LC_ALL, LC_MESSAGES, NLSPATH,
	setenv, unsetenv, and clearenv.
	* manual/string.texi: Fix typos.  Patch by Jim Meyering.

	* math/Makefile (test-longdouble-yes): Enable.  We want long double
	tests now.

	Crusade against strcat.
	* nis/nss_nisplus/nisplus-publickey.c: Remove uses of strcat.
	* stdlib/canonicalize.c: Likewise.

	* posix/glob.h: Define __const if necessary.  Use __const in all
	prototypes.

	* sysdeps/generic/stpcpy.c: Use K&R form to allow use in other
	GNU packages.

	* posix/wordexp.c: Completely reworked buffer handling for much
	better performance.  Patch by Tim Waugh.

	* socket/sys/sochet.h (getpeername): Fix type of LEN parameter,
	it must be socklen_t.

	* sysdeps/libm-i387/e_remainder.S: Pretty print.
	* sysdeps/libm-i387/e_remainderf.S: Likewise.
	* sysdeps/libm-i387/e_remainderl.S: Pop extra value for FPU stack.
	* sysdeps/libm-i387/s_cexp.S: Little optimization.
	* sysdeps/libm-i387/s_cexpl.S: Likewise.
	* sysdep/libm-ieee754/s_csinhl.c: Include <fenv.h>.

1997-08-18 15:21  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/if_index.c (if_nameindex): Fix memory leak
	in cleanup code.

1997-08-17  Paul Eggert  <eggert@twinsun.com>

	* tzset.c (__tzset_internal): Fix memory leak when the user
	specifies a TZ value that uses a default rule file.
	Do not assume US DST rules when the user specifies
	that there is no DST.

1997-08-10 19:17  Philip Blundell  <Philip.Blundell@pobox.com>

	* inet/getnameinfo.c: Tidy up.
	* sysdeps/posix/getaddrinfo.c: Likewise.

	* sysdeps/unix/sysv/linux/if_index.c (if_nametoindex): Return 0 if
	using stub code.
	(if_indextoname): Use SIOGIFNAME ioctl if the kernel supports it.
	(if_nameindex): Use alloca() rather than malloc(); use
	SIOCGIFCOUNT ioctl if the kernel supports it.

1997-08-16  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/sys/mount.h: Remove the IS_* macros,
	they operate on internal kernel structures and have no place in a
	user header.

1997-08-16  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makerules (lib%.so): Depend on $(+preinit) and $(+postinit).
	(build-shlib): Filter them out of $^.

1997-08-15  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* elf/dl-error.c (_dl_signal_error): Fix error message.

1997-08-16 04:06  Ulrich Drepper  <drepper@cygnus.com>

	* assert/assert.h [__USE_GNU]: Undefine assert_perror.
	Reported by Theodore C. Belding <Ted.Belding@umich.edu>.

1997-08-13  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makeconfig: Change object suffixes from *.[spgb]o to *.o[spgb]
	to avoid conflict with PO files.
	* Makerules: Likewise.
	* Rules: Likewise.
	* elf/Makefile: Likewise.
	* extra-lib.mk: Likewise.
	* gmon/Makefile: Likewise.
	* nis/Makefile: Likewise.
	* nss/Makefile: Likewise.
	* resolv/Makefile: Likewise.
	* rpm/Makefile: Likewise.
	* sunrpc/Makefile: Likewise.
	* sysdeps/sparc/elf/Makefile: Likewise.
	* sysdeps/sparc64/elf/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/sparc/Makefile: Likewise.
	(ASFLAGS-.os): Renamed from as-FLAGS.os.
This commit is contained in:
Ulrich Drepper 1997-08-20 03:53:21 +00:00
parent ca34d7a7c7
commit 40a55d2054
124 changed files with 4847 additions and 2995 deletions

189
ChangeLog
View File

@ -1,3 +1,192 @@
1997-08-20 05:30 Ulrich Drepper <drepper@cygnus.com>
* catgets/catgets.c (catclose): Use __munmap instead of munmap.
* catgets/gencat.c (read_input_file): Fix typo.
* dirent/dirent.h: Make seekdir and telldir available for __USE_XOPEN.
* elf/dl-load.c: Fix case of missing DT_RPATH in object which gets
executed (e.g., when it is a static binary).
* intl/bindtextdomain.c: Use strdup in glibc. Correct comment.
* intl/dcgettext.c: Likewise.
* intl/dgettext.c: Likewise.
* intl/explodename.c: Likewise.
* intl/finddomain.c: Likewise.
* intl/gettext.c: Likewise.
* intl/gettext.h: Likewise.
* intl/hash-string.h: Likewise.
* intl/l10nflist.c: Likewise.
* intl/libintl.h: Likewise.
* intl/loadinfo.h: Likewise.
* intl/loadmsgcat.c: Likewise.
* intl/localealias.c: Likewise.
* intl/textdomain.c: Likewise.
Unify libio sources with code in libg++.
* libio/fcloseall.c: Update and reformat copyright. Protect use
of weak_alias. Use _IO_* thread macros instead of __libc_*.
* libio/feof.c: Likewise.
* libio/feof_u.c: Likewise.
* libio/ferror.c: Likewise.
* libio/ferror_u.c: Likewise.
* libio/fgetc.c: Likewise.
* libio/filedoalloc.c: Likewise.
* libio/fileno.c: Likewise.
* libio/fileops.c: Likewise.
* libio/fputc.c: Likewise.
* libio/fputc_u.c: Likewise.
* libio/freopen.c: Likewise.
* libio/fseek.c: Likewise.
* libio/genops.c: Likewise.
* libio/getc.c: Likewise.
* libio/getc_u.c: Likewise.
* libio/getchar.c: Likewise.
* libio/getchar_u.c: Likewise.
* libio/iofclose.c: Likewise.
* libio/iofdopen.c: Likewise.
* libio/iofflush.c: Likewise.
* libio/iofflush_u.c: Likewise.
* libio/iofgetpos.c: Likewise.
* libio/iofgets.c: Likewise.
* libio/iofopen.c: Likewise.
* libio/iofopncook.c: Likewise.
* libio/iofprintf.c: Likewise.
* libio/iofputs.c: Likewise.
* libio/iofread.c: Likewise.
* libio/iofsetpos.c: Likewise.
* libio/ioftell.c: Likewise.
* libio/iofwrite.c: Likewise.
* libio/iogetdelim.c: Likewise.
* libio/iogetline.c: Likewise.
* libio/iogets.c: Likewise.
* libio/iopadn.c: Likewise.
* libio/iopopen.c: Likewise.
* libio/ioputs.c: Likewise.
* libio/ioseekoff.c: Likewise.
* libio/ioseekpos.c: Likewise.
* libio/iosetbuffer.c: Likewise.
* libio/iosetvbuf.c: Likewise.
* libio/iosprintf.c: Likewise.
* libio/ioungetc.c: Likewise.
* libio/iovdprintf.c: Likewise.
* libio/iovsprintf.c: Likewise.
* libio/iovsscanf.c: Likewise.
* libio/libio.h: Likewise.
* libio/libioP.h: Likewise.
* libio/obprintf.c: Likewise.
* libio/pclose.c: Likewise.
* libio/peekc.c: Likewise.
* libio/putc.c: Likewise.
* libio/putchar.c: Likewise.
* libio/rewind.c: Likewise.
* libio/setbuf.c: Likewise.
* libio/setlinebuf.c: Likewise.
* libio/stdfiles.c: Likewise.
* libio/stdio.c: Likewise.
* libio/strfile.h: Likewise.
* libio/strops.c: Likewise.
* libio/vasprintf.c: Likewise.
* libio/vscanf.c: Likewise.
* libio/vsnprintf.c: Likewise.
* manual/libc.texinfo: Add menu entries for chapter on message
translation.
* manual/locale.texi: Correct next entry in @node for new chapter.
* manual/search.texi: Likewise for previous link.
* manual/message.texi: New file.
* manual/startup.texi: Document LC_ALL, LC_MESSAGES, NLSPATH,
setenv, unsetenv, and clearenv.
* manual/string.texi: Fix typos. Patch by Jim Meyering.
* math/Makefile (test-longdouble-yes): Enable. We want long double
tests now.
Crusade against strcat.
* nis/nss_nisplus/nisplus-publickey.c: Remove uses of strcat.
* stdlib/canonicalize.c: Likewise.
* posix/glob.h: Define __const if necessary. Use __const in all
prototypes.
* sysdeps/generic/stpcpy.c: Use K&R form to allow use in other
GNU packages.
* posix/wordexp.c: Completely reworked buffer handling for much
better performance. Patch by Tim Waugh.
* socket/sys/sochet.h (getpeername): Fix type of LEN parameter,
it must be socklen_t.
* sysdeps/libm-i387/e_remainder.S: Pretty print.
* sysdeps/libm-i387/e_remainderf.S: Likewise.
* sysdeps/libm-i387/e_remainderl.S: Pop extra value for FPU stack.
* sysdeps/libm-i387/s_cexp.S: Little optimization.
* sysdeps/libm-i387/s_cexpl.S: Likewise.
* sysdep/libm-ieee754/s_csinhl.c: Include <fenv.h>.
1997-08-18 15:21 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/if_index.c (if_nameindex): Fix memory leak
in cleanup code.
1997-08-17 Paul Eggert <eggert@twinsun.com>
* tzset.c (__tzset_internal): Fix memory leak when the user
specifies a TZ value that uses a default rule file.
Do not assume US DST rules when the user specifies
that there is no DST.
1997-08-10 19:17 Philip Blundell <Philip.Blundell@pobox.com>
* inet/getnameinfo.c: Tidy up.
* sysdeps/posix/getaddrinfo.c: Likewise.
* sysdeps/unix/sysv/linux/if_index.c (if_nametoindex): Return 0 if
using stub code.
(if_indextoname): Use SIOGIFNAME ioctl if the kernel supports it.
(if_nameindex): Use alloca() rather than malloc(); use
SIOCGIFCOUNT ioctl if the kernel supports it.
1997-08-16 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/sys/mount.h: Remove the IS_* macros,
they operate on internal kernel structures and have no place in a
user header.
1997-08-16 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makerules (lib%.so): Depend on $(+preinit) and $(+postinit).
(build-shlib): Filter them out of $^.
1997-08-15 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-error.c (_dl_signal_error): Fix error message.
1997-08-16 04:06 Ulrich Drepper <drepper@cygnus.com>
* assert/assert.h [__USE_GNU]: Undefine assert_perror.
Reported by Theodore C. Belding <Ted.Belding@umich.edu>.
1997-08-13 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makeconfig: Change object suffixes from *.[spgb]o to *.o[spgb]
to avoid conflict with PO files.
* Makerules: Likewise.
* Rules: Likewise.
* elf/Makefile: Likewise.
* extra-lib.mk: Likewise.
* gmon/Makefile: Likewise.
* nis/Makefile: Likewise.
* nss/Makefile: Likewise.
* resolv/Makefile: Likewise.
* rpm/Makefile: Likewise.
* sunrpc/Makefile: Likewise.
* sysdeps/sparc/elf/Makefile: Likewise.
* sysdeps/sparc64/elf/Makefile: Likewise.
* sysdeps/unix/sysv/linux/sparc/Makefile: Likewise.
(ASFLAGS-.os): Renamed from as-FLAGS.os.
1997-08-14 03:14 Ulrich Drepper <drepper@cygnus.com>
* elf/dl-minimal.c: Don't use relative #include paths.

View File

@ -771,6 +771,10 @@ parts of the library were contributed or worked on by other people.
* The port to Linux/m68k (`m68k-ANYTHING-linux') was contributed by
Andreas Schwab.
* The ports to Linux/ARM (`arm-ANYTHING-linuxaout') and ARM standalone
(`arm-ANYTHING-none'), as well as parts of the IPv6 support code, were
contributed by Philip Blundell.
* Richard Henderson contributed the ELF dynamic linking code and
other support for the Alpha processor.

View File

@ -530,41 +530,41 @@ endif
# to pass different flags for each flavor.
libtypes = $(foreach o,$(object-suffixes),$(libtype$o))
object-suffixes := .o
all-object-suffixes := .o .so .po .go .bo
all-object-suffixes := .o .os .op .og .ob
libtype.o := lib%.a
ifeq (yes,$(build-shared))
# Under --enable-shared, we will build a shared library of PIC objects.
# The PIC object files are named foo.so.
object-suffixes += .so
CPPFLAGS-.so = -DPIC
CFLAGS-.so = -fPIC -fno-common
libtype.so := lib%_pic.a
# The PIC object files are named foo.os.
object-suffixes += .os
CPPFLAGS-.os = -DPIC
CFLAGS-.os = -fPIC -fno-common
libtype.os := lib%_pic.a
endif
ifeq (yes,$(build-profile))
# Under --enable-profile, we will build a static library of profiled objects.
# The profiled object files are named foo.po.
object-suffixes += .po
CPPFLAGS-.po = -DPROF
CFLAGS-.po = -pg
libtype.po = lib%_p.a
# The profiled object files are named foo.op.
object-suffixes += .op
CPPFLAGS-.op = -DPROF
CFLAGS-.op = -pg
libtype.op = lib%_p.a
endif
ifeq (yes,$(build-omitfp))
# Under --enable-omitfp, we build an the library optimized without
# debugging information using -fomit-frame-pointer, and build an extra
# library with debugging information. The debuggable objects are named foo.go.
object-suffixes += .go
CFLAGS-.go = -g
# library with debugging information. The debuggable objects are named foo.og.
object-suffixes += .og
CFLAGS-.og = -g
CFLAGS-.o = -g0 -O99 -fomit-frame-pointer
CFLAGS-.so += $(CFLAGS-.o)
libtype.go = lib%_g.a
CFLAGS-.os += $(CFLAGS-.o)
libtype.og = lib%_g.a
endif
ifeq (yes,$(build-bounded))
# Under --enable-bounded, we build the library with `-fbounded-pointers -g'
# to runtime bounds checking. The bounded-pointer objects are named foo.bo.
object-suffixes += .bo
CPPFLAGS-.bo = -DBOUNDED_POINTERS
CFLAGS-.bo = -g -fbounded-pointers
libtype.bo = lib%_b.a
# to runtime bounds checking. The bounded-pointer objects are named foo.ob.
object-suffixes += .ob
CPPFLAGS-.ob = -DBOUNDED_POINTERS
CFLAGS-.ob = -g -fbounded-pointers
libtype.ob = lib%_b.a
endif

View File

@ -344,7 +344,8 @@ endif
# build shared libraries in place from the installed *_pic.a files.
# $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
# on other shared objects.
lib%.so: lib%_pic.a; $(build-shlib)
lib%.so: lib%_pic.a $(+preinit) $(+postinit)
$(build-shlib)
ifeq ($(have-no-whole-archive),yes)
no-whole-archive = -Wl,--no-whole-archive
@ -352,10 +353,10 @@ else
no-whole-archive =
endif
interp-obj = $(common-objpfx)interp.so
$(interp-obj): $(common-objpfx)%.so: $(..)%.c
interp-obj = $(common-objpfx)interp.os
$(interp-obj): $(common-objpfx)%.os: $(..)%.c
$(compile-command.c)
common-generated += interp.so
common-generated += interp.os
CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"'
$(common-objpfx)libc.so: $(interp-obj)
@ -367,7 +368,8 @@ $(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
$(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
-Wl,--whole-archive $(filter-out $($(@F:.so=)-map),$^) \
-Wl,--whole-archive \
$(filter-out $($(@F:.so=)-map) $(+preinit) $(+postinit),$^) \
$(no-whole-archive) $(LDLIBS-$(@F:lib%.so=%).so)
endef
@ -382,9 +384,9 @@ LDFLAGS-c.so += -e __libc_main
# We have a versioning file for libc.so.
libc-map = $(..)libc.map
# Use our own special initializer and finalizer files for libc.so.
$(common-objpfx)libc.so: $(elfobjdir)/soinit.so \
$(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
$(common-objpfx)libc_pic.a \
$(elfobjdir)/sofini.so $(elfobjdir)/ld.so \
$(elfobjdir)/sofini.os $(elfobjdir)/ld.so \
$(libc-map)
$(build-shlib)
ifdef libc.so-version
@ -428,11 +430,11 @@ endif
ifeq ($(build-programs),yes)
+depfiles := $(strip $(sources:.c=.d) \
$(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.so=.o))) \
$(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
$(addsuffix .d,$(others) $(tests) $(test-srcs)))
else
+depfiles := $(strip $(sources:.c=.d) \
$(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.so=.o))) \
$(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
$(addsuffix .d,$(tests) $(test-srcs)))
endif
+depfiles := $(addprefix $(objpfx),\

2
Rules
View File

@ -166,7 +166,7 @@ endif
ifdef static-only-routines
# These routines are to be omitted from the shared library object,
# so we replace the PIC objects for them with the empty object file.
$(static-only-routines:%=$(objpfx)%.so): %.so: $(common-objpfx)empty.o
$(static-only-routines:%=$(objpfx)%.os): %.os: $(common-objpfx)empty.o
rm -f $@
ln $< $@
endif

View File

@ -22,8 +22,12 @@
#ifdef _ASSERT_H
#undef _ASSERT_H
#undef assert
# undef _ASSERT_H
# undef assert
# ifdef __USE_GNU
# undef assert_perror
# endif
#endif /* assert.h */

View File

@ -164,7 +164,7 @@ catclose (nl_catd catalog_desc)
catalog = (__nl_catd) catalog_desc;
if (catalog->status == mmapped)
munmap ((void *) catalog->file_ptr, catalog->file_size);
__munmap ((void *) catalog->file_ptr, catalog->file_size);
else if (catalog->status == malloced)
free ((void *) catalog->file_ptr);
else if (catalog->status != closed && catalog->status != nonexisting)

View File

@ -332,7 +332,7 @@ read_input_file (struct catalog *current, const char *fname)
/* This is a comment line. Do nothing. */;
else if (strncmp (&this_line[1], "set", 3) == 0)
{
int cnt = sizeof ("cnt");
int cnt = sizeof ("set");
int set_number;
const char *symbol = NULL;
while (isspace (this_line[cnt]))

View File

@ -131,6 +131,16 @@ extern int readdir_r __P ((DIR *__dirp, struct dirent *__entry,
/* Rewind DIRP to the beginning of the directory. */
extern void rewinddir __P ((DIR *__dirp));
#if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN
# include <bits/types.h>
/* Seek to position POS on DIRP. */
extern void seekdir __P ((DIR *__dirp, __off_t __pos));
/* Return the current position of DIRP. */
extern __off_t telldir __P ((DIR *__dirp));
#endif
#if defined __USE_BSD || defined __USE_MISC
/* Return the file descriptor used by DIRP. */
@ -152,16 +162,9 @@ extern int dirfd __P ((DIR *__dirp));
# endif
# endif
# include <bits/types.h>
# define __need_size_t
# include <stddef.h>
/* Seek to position POS on DIRP. */
extern void seekdir __P ((DIR *__dirp, __off_t __pos));
/* Return the current position of DIRP. */
extern __off_t telldir __P ((DIR *__dirp));
/* Scan the directory DIR, calling SELECTOR on each directory entry.
Entries for which SELECT returns nonzero are individually malloc'd,
sorted using qsort with CMP, and collected in a malloc'd array in
@ -178,7 +181,7 @@ extern int alphasort __P ((__const __ptr_t, __const __ptr_t));
# ifdef __USE_GNU
/* Function to compare two `struct dirent's by name & version. */
extern int versionsort __P ((__const __ptr_t, __const __ptr_t));
#endif
# endif
/* Read directory entries from FD into BUF, reading at most NBYTES.
Reading starts at offset *BASEP, and *BASEP is updated with the new

View File

@ -30,7 +30,7 @@ dl-routines = $(addprefix dl-,load cache lookup object reloc deps \
runtime error init fini debug misc \
version profile)
# But they are absent from the shared libc, because that code is in ld.so.
elide-routines.so = $(dl-routines) dl-support enbl-secure
elide-routines.os = $(dl-routines) dl-support enbl-secure
# ld.so uses those routines, plus some special stuff for being the program
# interpreter and operating independent of libc.
@ -54,8 +54,8 @@ all: # Make this the default target; it will be defined in Rules.
include ../Makeconfig
ifeq (yes,$(build-shared))
extra-objs = $(rtld-routines:=.so) soinit.so sofini.so eval.so
generated = librtld.so dl-allobjs.so trusted-dirs.h rtldtbl.h
extra-objs = $(rtld-routines:=.os) soinit.os sofini.os eval.os
generated = librtld.os dl-allobjs.os trusted-dirs.h rtldtbl.h
install-others = $(inst_slibdir)/$(rtld-installed-name)
install-bin = ldd
endif
@ -85,11 +85,11 @@ endif
# Command to link into a larger single relocatable object.
reloc-link = $(LINK.o) -nostdlib -nostartfiles -r -o $@
$(objpfx)dl-allobjs.so: $(rtld-routines:%=$(objpfx)%.so)
$(objpfx)dl-allobjs.os: $(rtld-routines:%=$(objpfx)%.os)
$(reloc-link) $^
# Link together the dynamic linker into a single relocatable object.
$(objpfx)librtld.so: $(objpfx)dl-allobjs.so $(common-objpfx)libc_pic.a
$(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
$(reloc-link) '-Wl,-(' $^ -lgcc '-Wl,-)'
# Do we need a linker script?
@ -107,7 +107,7 @@ $(objpfx)rtld-ldscript: $(rtld-ldscript-in) $(rtld-parms)
-e 's#@@rtld-entry@@#$(rtld-entry)#' \
-e 's#@@rtld-base@@#$(rtld-base)#' $< >$@
$(objpfx)ld.so: $(objpfx)librtld.so $(objpfx)rtld-ldscript
$(objpfx)ld.so: $(objpfx)librtld.os $(objpfx)rtld-ldscript
$(rtld-link) -Wl,-soname=$(rtld-installed-name)
define rtld-link
@ -116,7 +116,7 @@ $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
$(filter-out $(objpfx)rtld-ldscript,$^)
endef
else
$(objpfx)ld.so: $(objpfx)librtld.so
$(objpfx)ld.so: $(objpfx)librtld.os
$(rtld-link) -Wl,-soname=$(rtld-installed-name)
define rtld-link
@ -186,4 +186,4 @@ endif
# muwahaha
LDFLAGS-dl.so = -Wl,-dynamic-linker,$(slibdir)/$(rtld-installed-name)
$(objpfx)libdl.so: $(objpfx)eval.so
$(objpfx)libdl.so: $(objpfx)eval.os

View File

@ -75,7 +75,7 @@ _dl_signal_error (int errcode,
/* Lossage while resolving the program's own symbols is always fatal. */
extern char **_dl_argv; /* Set in rtld.c at startup. */
_dl_sysdep_fatal (_dl_argv[0] ?: "<program name unknown>",
": error in loading shared libraries",
": error in loading shared libraries: ",
objname ?: "", objname ? ": " : "",
errstring, errcode ? ": " : "",
errcode ? strerror (errcode) : "", "\n", NULL);

View File

@ -94,6 +94,11 @@ size_t _dl_pagesize;
extern const char *_dl_platform;
extern size_t _dl_platformlen;
/* This is a fake list to store the RPATH information for static
binaries. */
static struct r_search_path_elem **fake_path_list;
/* Local version of `strdup' function. */
static inline char *
local_strdup (const char *s)
@ -308,6 +313,12 @@ decompose_rpath (const char *rpath, size_t additional_room)
void
_dl_init_paths (void)
{
static const char *trusted_dirs[] =
{
#include "trusted-dirs.h"
NULL
};
struct r_search_path_elem **pelem;
/* We have in `search_path' the information about the RPATH of the
@ -333,55 +344,74 @@ _dl_init_paths (void)
nllp = 0;
l = _dl_loaded;
if (l && l->l_type != lt_loaded && l->l_info[DT_RPATH])
if (l != NULL)
{
/* Allocate room for the search path and fill in information from
RPATH. */
l->l_rpath_dirs =
decompose_rpath ((const char *) (l->l_addr
+ l->l_info[DT_STRTAB]->d_un.d_ptr
+ l->l_info[DT_RPATH]->d_un.d_val),
nllp);
if (l->l_type != lt_loaded && l->l_info[DT_RPATH])
{
/* Allocate room for the search path and fill in information
from RPATH. */
l->l_rpath_dirs =
decompose_rpath ((const char *)
(l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr
+ l->l_info[DT_RPATH]->d_un.d_val),
nllp);
}
else
{
/* If we have no LD_LIBRARY_PATH and no RPATH we must tell
this somehow to prevent we look this up again and again. */
if (nllp == 0)
l->l_rpath_dirs = (struct r_search_path_elem **) -1l;
else
{
l->l_rpath_dirs = (struct r_search_path_elem **)
malloc ((nllp + 1) * sizeof (*l->l_rpath_dirs));
if (l->l_rpath_dirs == NULL)
_dl_signal_error (ENOMEM, NULL,
"cannot create cache for search path");
l->l_rpath_dirs[0] = NULL;
}
}
/* We don't need to search the list of fake entries which is searched
when no dynamic objects were loaded at this time. */
fake_path_list = NULL;
if (nllp > 0)
{
char *copy = strdupa (llp);
/* Decompose the LD_LIBRARY_PATH and fill in the result.
First search for the next place to enter elements. */
struct r_search_path_elem **result = l->l_rpath_dirs;
while (*result != NULL)
++result;
/* We need to take care that the LD_LIBRARY_PATH environment
variable can contain a semicolon. */
(void) fillin_rpath (copy, result, ":;",
__libc_enable_secure ? trusted_dirs : NULL);
}
}
else
{
/* If we have no LD_LIBRARY_PATH and no RPATH we must tell this
somehow to prevent we look this up again and again. */
/* This is a statically linked program but we still have to
take care for the LD_LIBRARY_PATH environment variable. We
use a fake link_map entry. This will only contain the
l_rpath_dirs information. */
if (nllp == 0)
l->l_rpath_dirs = (struct r_search_path_elem **) -1l;
fake_path_list = NULL;
else
{
l->l_rpath_dirs =
(struct r_search_path_elem **) malloc ((nllp + 1)
* sizeof (*l->l_rpath_dirs));
if (l->l_rpath_dirs == NULL)
_dl_signal_error (ENOMEM, NULL,
"cannot create cache for search path");
l->l_rpath_dirs[0] = NULL;
fake_path_list = (struct r_search_path_elem **)
malloc ((nllp + 1) * sizeof (struct r_search_path_elem *));
(void) fillin_rpath (local_strdup (llp), fake_path_list, ":;",
__libc_enable_secure ? trusted_dirs : NULL);
}
}
if (nllp > 0)
{
static const char *trusted_dirs[] =
{
#include "trusted-dirs.h"
NULL
};
char *copy = strdupa (llp);
/* Decompose the LD_LIBRARY_PATH and fill in the result.
First search for the next place to enter elements. */
struct r_search_path_elem **result = l->l_rpath_dirs;
while (*result != NULL)
++result;
/* We need to take care that the LD_LIBRARY_PATH environement
variable can contain a semicolon. */
(void) fillin_rpath (copy, result, ":;",
__libc_enable_secure ? trusted_dirs : NULL);
}
/* Now set up the rest of the rtld_search_dirs. */
for (pelem = rtld_search_dirs; *pelem != NULL; ++pelem)
{
@ -871,7 +901,7 @@ _dl_map_object (struct link_map *loader, const char *name, int type,
/* Look for this name among those already loaded. */
for (l = _dl_loaded; l; l = l->l_next)
if (_dl_name_match_p (name, l) ||
if (l->l_opencount > 0 && _dl_name_match_p (name, l) ||
/* If the requested name matches the soname of a loaded object,
use that object. */
(l->l_info[DT_SONAME] &&
@ -923,6 +953,11 @@ _dl_map_object (struct link_map *loader, const char *name, int type,
&& l->l_rpath_dirs != (struct r_search_path_elem **) -1l)
fd = open_path (name, namelen, l->l_rpath_dirs, &realname);
/* This is used if a static binary uses dynamic loading and there
is a LD_LIBRARY_PATH given. */
if (fd == -1 && fake_path_list != NULL)
fd = open_path (name, namelen, fake_path_list, &realname);
if (fd == -1)
{
/* Check the list of libraries in the file /etc/ld.so.cache,

View File

@ -36,7 +36,7 @@ endif
# The linked shared library is never a dependent of lib-noranlib,
# because linking it will depend on libc.so already being built.
ifneq (,$(filter .so,$(object-suffixes-$(lib))))
ifneq (,$(filter .os,$(object-suffixes-$(lib))))
others: $(objpfx)$(lib).so$($(lib).so-version)
endif

View File

@ -40,6 +40,6 @@ ifeq (,$(filter profil,$(unix-syscalls)))
noprof += profil
endif
$(noprof:%=$(objpfx)%.po): %.po: %.o
$(noprof:%=$(objpfx)%.op): %.op: %.o
rm -f $@
ln $< $@

View File

@ -42,19 +42,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */
#define INET6 1
#define LOCAL 1
#define HOSTTABLE 0
#define RESOLVER 1
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#if LOCAL
#include <sys/un.h>
#include <sys/utsname.h>
#endif /* LOCAL */
#include <netdb.h>
#include <errno.h>
#include <string.h>
@ -64,20 +57,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <bits/libc-lock.h>
#include <arpa/inet.h>
#ifndef AF_LOCAL
# define AF_LOCAL AF_UNIX
#endif /* AF_LOCAL */
#if HOSTTABLE
struct hostent *_addr2hostname_hosts (const char *, int, int);
#endif /* HOSTTABLE */
#ifndef min
# define min(x,y) (((x) > (y)) ? (y) : (x))
#endif /* min */
static const char *
static char *
nrl_domainname (void)
{
static char *domain = NULL;
@ -92,7 +77,7 @@ nrl_domainname (void)
{
char *c;
struct hostent *h, th;
int tmpbuflen = 1024;
size_t tmpbuflen = 1024;
char *tmpbuf = alloca (tmpbuflen);
int herror;
@ -194,27 +179,12 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
switch(sa->sa_family)
{
case AF_INET:
#if INET6
case AF_INET6:
#endif /* INET6 */
if (!(flags & NI_NUMERICHOST))
{
struct hostent *h = NULL;
#if HOSTTABLE
# if INET6
if (sa->sa_family == AF_INET6)
h = _addr2hostname_hosts ((void *) &(((struct sockaddr_in6 *) sa)->sin6_addr),
sizeof(struct in6_addr), AF_INET6);
else
# endif /* INET6 */
h = _addr2hostname_hosts ((void *)& (((struct sockaddr_in *) sa)->sin_addr),
sizeof(struct in_addr), AF_INET);
#endif /* HOSTTABLE */
#if RESOLVER
if (h == NULL)
{
#if INET6
if (sa->sa_family == AF_INET6)
{
while (__gethostbyaddr_r ((void *) &(((struct sockaddr_in6 *) sa)->sin6_addr),
@ -232,7 +202,8 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
else
{
__set_h_errno (herrno);
goto fail;
__set_errno (serrno);
return -1;
}
}
else
@ -243,7 +214,6 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
}
else
{
#endif /* INET6 */
while (__gethostbyaddr_r ((void *) &(((struct sockaddr_in *)sa)->sin_addr),
sizeof(struct in_addr), AF_INET,
&th, tmpbuf, tmpbuflen,
@ -261,13 +231,12 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
}
}
}
#endif /* RESOLVER */
if (h)
{
if (flags & NI_NOFQDN)
{
const char *c;
char *c;
if ((c = nrl_domainname ()) && (c = strstr(h->h_name, c))
&& (c != h->h_name) && (*(--c) == '.'))
{
@ -282,7 +251,10 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
}
if (flags & NI_NAMEREQD)
goto fail;
{
__set_errno (serrno);
return -1;
}
else
{
const char *c;
@ -297,12 +269,14 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
(void *) &(((struct sockaddr_in *) sa)->sin_addr),
host, hostlen);
if (!c)
goto fail;
if (c == NULL)
{
__set_errno (serrno);
return -1;
}
}
break;
#if LOCAL
case AF_LOCAL:
if (!(flags & NI_NUMERICHOST))
{
@ -316,11 +290,13 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
};
if (flags & NI_NAMEREQD)
goto fail;
{
__set_errno (serrno);
return -1;
}
strncpy (host, "localhost", hostlen);
break;
#endif /* LOCAL */
default:
return -1;
@ -330,9 +306,7 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
switch(sa->sa_family)
{
case AF_INET:
#if INET6
case AF_INET6:
#endif /* INET6 */
if (!(flags & NI_NUMERICSERV))
{
struct servent *s, ts;
@ -345,10 +319,13 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
if (errno == ERANGE)
{
tmpbuflen *= 2;
tmpbuf = __alloca(tmpbuflen);
tmpbuf = __alloca (tmpbuflen);
}
else
goto fail;
{
__set_errno (serrno);
return -1;
}
}
else
{
@ -357,7 +334,7 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
}
if (s)
{
strncpy(serv, s->s_name, servlen);
strncpy (serv, s->s_name, servlen);
break;
}
}
@ -365,11 +342,9 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
ntohs (((struct sockaddr_in *) sa)->sin_port));
break;
#if LOCAL
case AF_LOCAL:
strncpy (serv, ((struct sockaddr_un *) sa)->sun_path, servlen);
break;
#endif /* LOCAL */
}
if (host && (hostlen > 0))
@ -378,8 +353,4 @@ getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
serv[servlen-1] = 0;
errno = serrno;
return 0;
fail:
errno = serrno;
return -1;
};
}

View File

@ -2,7 +2,7 @@
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
the C library, however.
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
@ -65,6 +65,7 @@ extern struct binding *_nl_domain_bindings;
prefix. So we have to make a difference here. */
#ifdef _LIBC
# define BINDTEXTDOMAIN __bindtextdomain
# define strdup(str) __strdup (str)
#else
# define BINDTEXTDOMAIN bindtextdomain__
#endif
@ -102,25 +103,36 @@ BINDTEXTDOMAIN (domainname, dirname)
if (binding != NULL)
{
/* The domain is already bound. Replace the old binding. */
char *new_dirname;
if (strcmp (dirname, _nl_default_dirname) == 0)
new_dirname = (char *) _nl_default_dirname;
else
/* The domain is already bound. If the new value and the old
one are equal we simply do nothing. Otherwise replace the
old binding. */
if (strcmp (dirname, binding->dirname) != 0)
{
size_t len = strlen (dirname) + 1;
new_dirname = (char *) malloc (len);
if (new_dirname == NULL)
return NULL;
char *new_dirname;
memcpy (new_dirname, dirname, len);
if (strcmp (dirname, _nl_default_dirname) == 0)
new_dirname = (char *) _nl_default_dirname;
else
{
#if defined _LIBC || defined HAVE_STRDUP
new_dirname = strdup (dirname);
if (new_dirname == NULL)
return NULL;
#else
size_t len = strlen (dirname) + 1;
new_dirname = (char *) malloc (len);
if (new_dirname == NULL)
return NULL;
memcpy (new_dirname, dirname, len);
#endif
}
if (binding->dirname != _nl_default_dirname)
free (binding->dirname);
binding->dirname = new_dirname;
}
if (strcmp (binding->dirname, _nl_default_dirname) != 0)
free (binding->dirname);
binding->dirname = new_dirname;
}
else
{
@ -132,21 +144,33 @@ BINDTEXTDOMAIN (domainname, dirname)
if (new_binding == NULL)
return NULL;
#if defined _LIBC || defined HAVE_STRDUP
new_binding->domainname = strdup (domainname);
if (new_binding->domainname == NULL)
return NULL;
#else
len = strlen (domainname) + 1;
new_binding->domainname = (char *) malloc (len);
if (new_binding->domainname == NULL)
return NULL;
return NULL;
memcpy (new_binding->domainname, domainname, len);
#endif
if (strcmp (dirname, _nl_default_dirname) == 0)
new_binding->dirname = (char *) _nl_default_dirname;
else
{
#if defined _LIBC || defined HAVE_STRDUP
new_binding->dirname = strdup (dirname);
if (new_binding->dirname == NULL)
return NULL;
#else
len = strlen (dirname) + 1;
new_binding->dirname = (char *) malloc (len);
if (new_binding->dirname == NULL)
return NULL;
memcpy (new_binding->dirname, dirname, len);
#endif
}
/* Now enqueue it. */

View File

@ -2,7 +2,7 @@
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
the C library, however.
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
@ -298,10 +298,6 @@ DCGETTEXT (domainname, msgid, category)
return (char *) msgid;
}
/* We don't want libintl.a to depend on any other library. So
we avoid the non-standard function stpcpy. In GNU C Library
this function is available, though. Also allow the symbol
HAVE_STPCPY to be defined. */
stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
}
@ -312,10 +308,7 @@ DCGETTEXT (domainname, msgid, category)
xdomainname = (char *) alloca (strlen (categoryname)
+ strlen (domainname) + 5);
ADD_BLOCK (block_list, xdomainname);
/* We don't want libintl.a to depend on any other library. So we
avoid the non-standard function stpcpy. In GNU C Library this
function is available, though. Also allow the symbol HAVE_STPCPY
to be defined. */
stpcpy (stpcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
domainname),
".mo");

View File

@ -2,7 +2,7 @@
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
the C library, however.
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

View File

@ -2,7 +2,7 @@
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
the C library, however.
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

View File

@ -3,7 +3,7 @@
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
the C library, however.
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
@ -146,12 +146,18 @@ _nl_find_domain (dirname, locale, domainname)
alias_value = _nl_expand_alias (locale);
if (alias_value != NULL)
{
#if defined _LIBC || defined HAVE_STRDUP
locale = strdup (alias_value);
if (locale == NULL)
return NULL;
#else
size_t len = strlen (alias_value) + 1;
locale = (char *) malloc (len);
if (locale == NULL)
return NULL;
memcpy (locale, alias_value, len);
#endif
}
/* Now we determine the single parts of the locale name. First

View File

@ -2,7 +2,7 @@
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
the C library, however.
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

View File

@ -2,7 +2,7 @@
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
the C library, however.
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

View File

@ -2,7 +2,7 @@
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
the C library, however.
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

View File

@ -2,7 +2,7 @@
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
the C library, however.
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

View File

@ -1,10 +1,10 @@
/* libintl.h -- Message catalogs for internationalization.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
/* Message catalogs for internationalization.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This file is derived from the file libgettext.h in the GNU gettext package.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
the C library, however.
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
@ -71,8 +71,8 @@ extern char *__bindtextdomain __P ((__const char *__domainname,
#if defined __OPTIMIZE__
/* We need NULL for `gettext'. */
#define __need_NULL
#include <stddef.h>
# define __need_NULL
# include <stddef.h>
/* We need LC_MESSAGES for `dgettext'. */
# include <locale.h>

View File

@ -1,3 +1,22 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef PARAMS
# if __STDC__
# define PARAMS(args) args

View File

@ -2,7 +2,7 @@
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
the C library, however.
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

View File

@ -2,7 +2,7 @@
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
the C library, however.
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
@ -82,6 +82,12 @@ void free ();
because some ANSI C functions will require linking with this object
file and the name space must not be polluted. */
# define strcasecmp __strcasecmp
# define strdup __strdup
/* We need locking here since we can be called from different palces. */
# include <libc-lock.h>
__libc_lock_define_initialized (static, lock);
#endif
@ -146,8 +152,13 @@ _nl_expand_alias (name)
{
static const char *locale_alias_path = LOCALE_ALIAS_PATH;
struct alias_map *retval;
const char *result = NULL;
size_t added;
#ifdef _LIBC
__libc_lock_lock (lock);
#endif
do
{
struct alias_map item;
@ -165,7 +176,10 @@ _nl_expand_alias (name)
/* We really found an alias. Return the value. */
if (retval != NULL)
return retval->value;
{
result = retval->value;
break;
}
/* Perhaps we can find another alias file. */
added = 0;
@ -186,7 +200,11 @@ _nl_expand_alias (name)
}
while (added != 0);
return NULL;
#ifdef _LIBC
__libc_lock_unlock (lock);
#endif
return result;
}
@ -274,7 +292,15 @@ read_alias_file (fname, fname_len)
if (nmap >= maxmap)
extend_alias_table ();
/* We cannot depend on strdup available in the libc. Sigh! */
#if defined _LIBC || defined HAVE_STRDUP
map[nmap].alias = strdup (alias);
map[nmap].value = strdup (value);
if (map[nmap].alias == NULL || map[nmap].value == NULL)
{
FREE_BLOCKS (block_list);
return added;
}
#else
len = strlen (alias) + 1;
tp = (char *) malloc (len);
if (tp == NULL)
@ -294,6 +320,7 @@ read_alias_file (fname, fname_len)
}
memcpy (tp, value, len);
map[nmap].value = tp;
#endif
++nmap;
++added;

View File

@ -57,6 +57,7 @@ extern const char *_nl_current_default_domain;
prefix. So we have to make a difference here. */
#ifdef _LIBC
# define TEXTDOMAIN __textdomain
# define strdup(str) __strdup (str)
#else
# define TEXTDOMAIN textdomain__
#endif
@ -85,11 +86,15 @@ TEXTDOMAIN (domainname)
/* If the following malloc fails `_nl_current_default_domain'
will be NULL. This value will be returned and so signals we
are out of core. */
#if defined _LIBC || defined HAVE_STRDUP
_nl_current_default_domain = strdup (domainname);
#else
size_t len = strlen (domainname) + 1;
char *cp = (char *) malloc (len);
if (cp != NULL)
memcpy (cp, domainname, len);
_nl_current_default_domain = cp;
#endif
}
if (old != _nl_default_default_domain)

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include <stdio.h>
@ -32,4 +33,7 @@ __fcloseall ()
_IO_cleanup ();
return 0;
}
#ifdef weak_alias
weak_alias (__fcloseall, fcloseall)
#endif

View File

@ -1,25 +1,27 @@
/* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"
@ -35,4 +37,7 @@ _IO_feof (fp)
_IO_funlockfile (fp);
return result;
}
#ifdef weak_alias
weak_alias (_IO_feof, feof)
#endif

View File

@ -1,25 +1,27 @@
/* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"

View File

@ -1,25 +1,27 @@
/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"
@ -35,4 +37,7 @@ _IO_ferror (fp)
_IO_funlockfile (fp);
return result;
}
#ifdef weak_alias
weak_alias (_IO_ferror, ferror)
#endif

View File

@ -1,25 +1,27 @@
/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995 Free Software Foundation
/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
/*
* Copyright (c) 1990 The Regents of the University of California.
@ -66,12 +67,12 @@ the executable file might be covered by the GNU General Public License. */
*/
int
DEFUN(_IO_file_doallocate, (fp),
register _IO_FILE *fp)
_IO_file_doallocate (fp)
_IO_FILE *fp;
{
register _IO_size_t size;
_IO_size_t size;
int couldbetty;
register char *p;
char *p;
struct stat st;
#ifndef _LIBC
@ -80,7 +81,7 @@ DEFUN(_IO_file_doallocate, (fp),
on exit. We call it from _IO_file_doallocate, since that is likely
to get called by any program that does buffered I/O. */
if (_IO_cleanup_registration_needed)
(*_IO_cleanup_registration_needed)();
(*_IO_cleanup_registration_needed) ();
#endif
if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
@ -94,16 +95,16 @@ DEFUN(_IO_file_doallocate, (fp),
}
else
{
couldbetty = S_ISCHR(st.st_mode);
couldbetty = S_ISCHR (st.st_mode);
#if _IO_HAVE_ST_BLKSIZE
size = st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize;
#else
size = _IO_BUFSIZ;
#endif
}
ALLOC_BUF(p, size, EOF);
_IO_setb(fp, p, p+size, 1);
if (couldbetty && isatty(fp->_fileno))
ALLOC_BUF (p, size, EOF);
_IO_setb (fp, p, p + size, 1);
if (couldbetty && isatty (fp->_fileno))
fp->_flags |= _IO_LINE_BUF;
return 1;
}

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"
@ -38,9 +39,11 @@ fileno (fp)
}
#ifdef _IO_MTSAFE_IO
#ifdef weak_alias
/* The fileno implementation for libio does not require locking because
it only accesses once a single variable and this is already atomic
(at least at thread level). */
weak_alias (fileno, fileno_unlocked)
#endif
#endif

View File

@ -1,28 +1,29 @@
/*
Copyright (C) 1993, 1995 Free Software Foundation
/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
Written by Per Bothner <bothner@cygnus.com>.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
/* written by Per Bothner (bothner@cygnus.com) */
#ifndef _POSIX_SOURCE
# define _POSIX_SOURCE
@ -97,8 +98,8 @@ extern int errno;
void
DEFUN(_IO_file_init, (fp),
register _IO_FILE *fp)
_IO_file_init (fp)
_IO_FILE *fp;
{
/* POSIX.1 allows another file handle to be used to change the position
of our file descriptor. Hence we actually don't know the actual
@ -111,11 +112,11 @@ DEFUN(_IO_file_init, (fp),
}
int
DEFUN(_IO_file_close_it, (fp),
register _IO_FILE* fp)
_IO_file_close_it (fp)
_IO_FILE *fp;
{
int write_status, close_status;
if (!_IO_file_is_open(fp))
if (!_IO_file_is_open (fp))
return EOF;
write_status = _IO_do_flush (fp);
@ -125,11 +126,11 @@ DEFUN(_IO_file_close_it, (fp),
close_status = _IO_SYSCLOSE (fp);
/* Free buffer. */
_IO_setb(fp, NULL, NULL, 0);
_IO_setg(fp, NULL, NULL, NULL);
_IO_setp(fp, NULL, NULL);
_IO_setb (fp, NULL, NULL, 0);
_IO_setg (fp, NULL, NULL, NULL);
_IO_setp (fp, NULL, NULL);
_IO_un_link(fp);
_IO_un_link (fp);
fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS;
fp->_fileno = EOF;
fp->_offset = _IO_pos_BAD;
@ -138,68 +139,74 @@ DEFUN(_IO_file_close_it, (fp),
}
void
DEFUN(_IO_file_finish, (fp, dummy),
register _IO_FILE* fp AND int dummy)
_IO_file_finish (fp, dummy)
_IO_FILE *fp;
int dummy;
{
if (_IO_file_is_open(fp))
if (_IO_file_is_open (fp))
{
_IO_do_flush (fp);
if (!(fp->_flags & _IO_DELETE_DONT_CLOSE))
_IO_SYSCLOSE (fp);
}
_IO_default_finish(fp, 0);
_IO_default_finish (fp, 0);
}
_IO_FILE *
DEFUN(_IO_file_fopen, (fp, filename, mode),
register _IO_FILE *fp AND const char *filename AND const char *mode)
_IO_file_fopen (fp, filename, mode)
_IO_FILE *fp;
const char *filename;
const char *mode;
{
int oflags = 0, omode;
int read_write, fdesc;
int oprot = 0666;
if (_IO_file_is_open (fp))
return 0;
switch (*mode++) {
case 'r':
omode = O_RDONLY;
read_write = _IO_NO_WRITES;
break;
case 'w':
omode = O_WRONLY;
oflags = O_CREAT|O_TRUNC;
read_write = _IO_NO_READS;
break;
case 'a':
omode = O_WRONLY;
oflags = O_CREAT|O_APPEND;
read_write = _IO_NO_READS|_IO_IS_APPENDING;
break;
default:
__set_errno (EINVAL);
return NULL;
}
if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+')) {
omode = O_RDWR;
read_write &= _IO_IS_APPENDING;
}
fdesc = open(filename, omode|oflags, oprot);
switch (*mode++)
{
case 'r':
omode = O_RDONLY;
read_write = _IO_NO_WRITES;
break;
case 'w':
omode = O_WRONLY;
oflags = O_CREAT|O_TRUNC;
read_write = _IO_NO_READS;
break;
case 'a':
omode = O_WRONLY;
oflags = O_CREAT|O_APPEND;
read_write = _IO_NO_READS|_IO_IS_APPENDING;
break;
default:
__set_errno (EINVAL);
return NULL;
}
if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+'))
{
omode = O_RDWR;
read_write &= _IO_IS_APPENDING;
}
fdesc = open (filename, omode|oflags, oprot);
if (fdesc < 0)
return NULL;
fp->_fileno = fdesc;
_IO_mask_flags(fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
_IO_mask_flags (fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
if (read_write & _IO_IS_APPENDING)
if (_IO_SEEKOFF (fp, (_IO_off_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
== _IO_pos_BAD && errno != ESPIPE)
return NULL;
_IO_link_in(fp);
_IO_link_in (fp);
return fp;
}
_IO_FILE*
DEFUN(_IO_file_attach, (fp, fd),
_IO_FILE *fp AND int fd)
_IO_FILE *
_IO_file_attach (fp, fd)
_IO_FILE *fp;
int fd;
{
if (_IO_file_is_open(fp))
if (_IO_file_is_open (fp))
return NULL;
fp->_fileno = fd;
fp->_flags &= ~(_IO_NO_READS+_IO_NO_WRITES);
@ -213,16 +220,18 @@ DEFUN(_IO_file_attach, (fp, fd),
return fp;
}
_IO_FILE*
DEFUN(_IO_file_setbuf, (fp, p, len),
register _IO_FILE *fp AND char* p AND _IO_ssize_t len)
_IO_FILE *
_IO_file_setbuf (fp, p, len)
_IO_FILE *fp;
char *p;
_IO_ssize_t len;
{
if (_IO_default_setbuf(fp, p, len) == NULL)
return NULL;
if (_IO_default_setbuf (fp, p, len) == NULL)
return NULL;
fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end
= fp->_IO_buf_base;
_IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
return fp;
}
@ -231,8 +240,10 @@ DEFUN(_IO_file_setbuf, (fp, p, len),
Then mark FP as having empty buffers. */
int
DEFUN(_IO_do_write, (fp, data, to_do),
register _IO_FILE *fp AND const char* data AND _IO_size_t to_do)
_IO_do_write (fp, data, to_do)
_IO_FILE *fp;
const char *data;
_IO_size_t to_do;
{
_IO_size_t count;
if (to_do == 0)
@ -247,24 +258,24 @@ DEFUN(_IO_do_write, (fp, data, to_do),
else if (fp->_IO_read_end != fp->_IO_write_base)
{
_IO_pos_t new_pos
= _IO_SYSSEEK(fp, fp->_IO_write_base - fp->_IO_read_end, 1);
= _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
if (new_pos == _IO_pos_BAD)
return EOF;
fp->_offset = new_pos;
}
count = _IO_SYSWRITE (fp, data, to_do);
if (fp->_cur_column)
fp->_cur_column = _IO_adjust_column(fp->_cur_column - 1, data, to_do) + 1;
_IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
fp->_cur_column = _IO_adjust_column (fp->_cur_column - 1, data, to_do) + 1;
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_buf_base;
fp->_IO_write_end = (fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED)) ? fp->_IO_buf_base
: fp->_IO_buf_end;
fp->_IO_write_end = ((fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
? fp->_IO_buf_base : fp->_IO_buf_end);
return count != to_do ? EOF : 0;
}
int
DEFUN(_IO_file_underflow, (fp),
register _IO_FILE *fp)
_IO_file_underflow (fp)
_IO_FILE *fp;
{
_IO_ssize_t count;
#if 0
@ -279,17 +290,17 @@ DEFUN(_IO_file_underflow, (fp),
return EOF;
}
if (fp->_IO_read_ptr < fp->_IO_read_end)
return *(unsigned char*)fp->_IO_read_ptr;
return *(unsigned char *) fp->_IO_read_ptr;
if (fp->_IO_buf_base == NULL)
_IO_doallocbuf(fp);
_IO_doallocbuf (fp);
/* Flush all line buffered files before reading. */
/* FIXME This can/should be moved to genops ?? */
if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
_IO_flush_all_linebuffered();
_IO_flush_all_linebuffered ();
_IO_switch_to_get_mode(fp);
_IO_switch_to_get_mode (fp);
/* This is very tricky. We have to adjust those
pointers before we call _IO_SYSREAD () since
@ -313,13 +324,14 @@ DEFUN(_IO_file_underflow, (fp),
if (count == 0)
return EOF;
if (fp->_offset != _IO_pos_BAD)
_IO_pos_adjust(fp->_offset, count);
return *(unsigned char*)fp->_IO_read_ptr;
_IO_pos_adjust (fp->_offset, count);
return *(unsigned char *) fp->_IO_read_ptr;
}
int
DEFUN(_IO_file_overflow, (f, ch),
register _IO_FILE* f AND int ch)
_IO_file_overflow (f, ch)
_IO_FILE *f;
int ch;
{
if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
{
@ -333,7 +345,7 @@ DEFUN(_IO_file_overflow, (f, ch),
/* Allocate a buffer if needed. */
if (f->_IO_write_base == 0)
{
_IO_doallocbuf(f);
_IO_doallocbuf (f);
_IO_setg (f, f->_IO_buf_base, f->_IO_buf_base, f->_IO_buf_base);
}
/* Otherwise must be currently reading.
@ -355,21 +367,21 @@ DEFUN(_IO_file_overflow, (f, ch),
f->_flags |= _IO_CURRENTLY_PUTTING;
}
if (ch == EOF)
return _IO_do_flush(f);
return _IO_do_flush (f);
if (f->_IO_write_ptr == f->_IO_buf_end ) /* Buffer is really full */
if (_IO_do_flush(f) == EOF)
if (_IO_do_flush (f) == EOF)
return EOF;
*f->_IO_write_ptr++ = ch;
if ((f->_flags & _IO_UNBUFFERED)
|| ((f->_flags & _IO_LINE_BUF) && ch == '\n'))
if (_IO_do_flush(f) == EOF)
if (_IO_do_flush (f) == EOF)
return EOF;
return (unsigned char)ch;
return (unsigned char) ch;
}
int
DEFUN(_IO_file_sync, (fp),
register _IO_FILE* fp)
_IO_file_sync (fp)
_IO_FILE *fp;
{
_IO_size_t delta;
/* char* ptr = cur_ptr(); */
@ -379,11 +391,11 @@ DEFUN(_IO_file_sync, (fp),
if (delta != 0)
{
#ifdef TODO
if (_IO_in_backup(fp))
delta -= eGptr() - Gbase();
if (_IO_in_backup (fp))
delta -= eGptr () - Gbase ();
#endif
_IO_off_t new_pos = _IO_SYSSEEK (fp, delta, 1);
if (new_pos != (_IO_off_t)EOF)
if (new_pos != (_IO_off_t) EOF)
fp->_IO_read_end = fp->_IO_read_ptr;
#ifdef ESPIPE
else if (errno == ESPIPE)
@ -399,8 +411,11 @@ DEFUN(_IO_file_sync, (fp),
}
_IO_pos_t
DEFUN(_IO_file_seekoff, (fp, offset, dir, mode),
register _IO_FILE *fp AND _IO_off_t offset AND int dir AND int mode)
_IO_file_seekoff (fp, offset, dir, mode)
_IO_FILE *fp;
_IO_off_t offset;
int dir;
int mode;
{
_IO_pos_t result;
_IO_off_t delta, new_offset;
@ -421,14 +436,15 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir, mode),
end up flushing when we close(), it doesn't make much difference.)
FIXME: simulate mem-papped files. */
if (fp->_IO_write_ptr > fp->_IO_write_base || _IO_in_put_mode(fp))
if (_IO_switch_to_get_mode(fp)) return EOF;
if (fp->_IO_write_ptr > fp->_IO_write_base || _IO_in_put_mode (fp))
if (_IO_switch_to_get_mode (fp))
return EOF;
if (fp->_IO_buf_base == NULL)
{
_IO_doallocbuf(fp);
_IO_setp(fp, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_doallocbuf (fp);
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
}
switch (dir)
@ -439,7 +455,7 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir, mode),
if (fp->_offset == _IO_pos_BAD)
goto dumb;
/* Make offset absolute, assuming current pointer is file_ptr(). */
offset += _IO_pos_as_off(fp->_offset);
offset += _IO_pos_as_off (fp->_offset);
dir = _IO_seek_set;
break;
@ -448,7 +464,7 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir, mode),
case _IO_seek_end:
{
struct stat st;
if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG(st.st_mode))
if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
{
offset += st.st_size;
dir = _IO_seek_set;
@ -464,46 +480,46 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir, mode),
&& !_IO_in_backup (fp))
{
/* Offset relative to start of main get area. */
_IO_pos_t rel_offset = offset - fp->_offset
+ (fp->_IO_read_end - fp->_IO_read_base);
_IO_pos_t rel_offset = (offset - fp->_offset
+ (fp->_IO_read_end - fp->_IO_read_base));
if (rel_offset >= 0)
{
#if 0
if (_IO_in_backup(fp))
_IO_switch_to_main_get_area(fp);
if (_IO_in_backup (fp))
_IO_switch_to_main_get_area (fp);
#endif
if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
{
_IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset,
fp->_IO_read_end);
_IO_setp(fp, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset,
fp->_IO_read_end);
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
return offset;
}
#ifdef TODO
/* If we have streammarkers, seek forward by reading ahead. */
if (_IO_have_markers(fp))
if (_IO_have_markers (fp))
{
int to_skip = rel_offset
- (fp->_IO_read_ptr - fp->_IO_read_base);
if (ignore(to_skip) != to_skip)
if (ignore (to_skip) != to_skip)
goto dumb;
return offset;
}
#endif
}
#ifdef TODO
if (rel_offset < 0 && rel_offset >= Bbase() - Bptr())
if (rel_offset < 0 && rel_offset >= Bbase () - Bptr ())
{
if (!_IO_in_backup(fp))
_IO_switch_to_backup_area(fp);
gbump(fp->_IO_read_end + rel_offset - fp->_IO_read_ptr);
if (!_IO_in_backup (fp))
_IO_switch_to_backup_area (fp);
gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr);
return offset;
}
#endif
}
#ifdef TODO
_IO_unsave_markers(fp);
_IO_unsave_markers (fp);
#endif
if (fp->_flags & _IO_NO_READS)
@ -535,30 +551,33 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir, mode),
goto dumb;
}
}
_IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base+delta, fp->_IO_buf_base+count);
_IO_setp(fp, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta,
fp->_IO_buf_base + count);
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
fp->_offset = result + count;
_IO_mask_flags(fp, 0, _IO_EOF_SEEN);
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
return offset;
dumb:
_IO_unsave_markers(fp);
_IO_unsave_markers (fp);
result = _IO_SYSSEEK (fp, offset, dir);
if (result != EOF)
_IO_mask_flags(fp, 0, _IO_EOF_SEEN);
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
fp->_offset = result;
_IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_setp(fp, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
return result;
}
_IO_ssize_t
DEFUN(_IO_file_read, (fp, buf, size),
register _IO_FILE* fp AND void* buf AND _IO_ssize_t size)
_IO_file_read (fp, buf, size)
_IO_FILE *fp;
void *buf;
_IO_ssize_t size;
{
for (;;)
{
_IO_ssize_t count = _IO_read(fp->_fileno, buf, size);
_IO_ssize_t count = _IO_read (fp->_fileno, buf, size);
#if 0 && defined EINTR
/* We must not do this optimization since POSIX.1 explicitly
requests that the stream operations must return with the
@ -572,34 +591,39 @@ DEFUN(_IO_file_read, (fp, buf, size),
}
_IO_pos_t
DEFUN(_IO_file_seek, (fp, offset, dir),
_IO_FILE *fp AND _IO_off_t offset AND int dir)
_IO_file_seek (fp, offset, dir)
_IO_FILE *fp;
_IO_off_t offset;
int dir;
{
return _IO_lseek(fp->_fileno, offset, dir);
return _IO_lseek (fp->_fileno, offset, dir);
}
int
DEFUN(_IO_file_stat, (fp, st),
_IO_FILE *fp AND void* st)
_IO_file_stat (fp, st)
_IO_FILE *fp;
void *st;
{
return _IO_fstat(fp->_fileno, (struct stat*)st);
return _IO_fstat (fp->_fileno, (struct stat *) st);
}
int
DEFUN(_IO_file_close, (fp),
_IO_FILE* fp)
_IO_file_close (fp)
_IO_FILE *fp;
{
return _IO_close(fp->_fileno);
return _IO_close (fp->_fileno);
}
_IO_ssize_t
DEFUN(_IO_file_write, (f, data, n),
register _IO_FILE* f AND const void* data AND _IO_ssize_t n)
_IO_file_write (f, data, n)
_IO_FILE *f;
const void *data;
_IO_ssize_t n;
{
_IO_ssize_t to_do = n;
while (to_do > 0)
{
_IO_ssize_t count = _IO_write(f->_fileno, data, to_do);
_IO_ssize_t count = _IO_write (f->_fileno, data, to_do);
if (count == EOF)
{
#if 0 && defined EINTR
@ -617,7 +641,7 @@ DEFUN(_IO_file_write, (f, data, n),
}
}
to_do -= count;
data = (void*)((char*)data + count);
data = (void *) ((char *) data + count);
}
n -= to_do;
if (f->_offset >= 0)
@ -626,10 +650,12 @@ DEFUN(_IO_file_write, (f, data, n),
}
_IO_size_t
DEFUN(_IO_file_xsputn, (f, data, n),
_IO_FILE *f AND const void *data AND _IO_size_t n)
_IO_file_xsputn (f, data, n)
_IO_FILE *f;
const void *data;
_IO_size_t n;
{
register const char *s = (char*) data;
register const char *s = (char *) data;
_IO_size_t to_do = n;
int must_flush = 0;
_IO_size_t count;
@ -646,14 +672,16 @@ DEFUN(_IO_file_xsputn, (f, data, n),
{
count = f->_IO_buf_end - f->_IO_write_ptr;
if (count >= n)
{ register const char *p;
{
register const char *p;
for (p = s + n; p > s; )
{
if (*--p == '\n') {
count = p - s + 1;
must_flush = 1;
break;
}
if (*--p == '\n')
{
count = p - s + 1;
must_flush = 1;
break;
}
}
}
}
@ -662,23 +690,26 @@ DEFUN(_IO_file_xsputn, (f, data, n),
{
if (count > to_do)
count = to_do;
if (count > 20) {
memcpy(f->_IO_write_ptr, s, count);
s += count;
}
if (count > 20)
{
memcpy (f->_IO_write_ptr, s, count);
s += count;
}
else
{
register char *p = f->_IO_write_ptr;
register int i = (int)count;
while (--i >= 0) *p++ = *s++;
register int i = (int) count;
while (--i >= 0)
*p++ = *s++;
}
f->_IO_write_ptr += count;
to_do -= count;
}
if (to_do + must_flush > 0)
{ _IO_size_t block_size, dont_write;
{
_IO_size_t block_size, dont_write;
/* Next flush the (full) buffer. */
if (__overflow(f, EOF) == EOF)
if (__overflow (f, EOF) == EOF)
return n - to_do;
/* Try to maintain alignment: write a whole number of blocks.
@ -687,7 +718,7 @@ DEFUN(_IO_file_xsputn, (f, data, n),
dont_write = block_size >= 128 ? to_do % block_size : 0;
count = to_do - dont_write;
if (_IO_do_write(f, s, count) == EOF)
if (_IO_do_write (f, s, count) == EOF)
return n - to_do;
to_do = dont_write;
@ -695,7 +726,7 @@ DEFUN(_IO_file_xsputn, (f, data, n),
buffer, but it's somewhat messier for line-buffered files,
so we let _IO_default_xsputn handle the general case. */
if (dont_write)
to_do -= _IO_default_xsputn(f, s+count, dont_write);
to_do -= _IO_default_xsputn (f, s+count, dont_write);
}
return n - to_do;
}
@ -703,21 +734,24 @@ DEFUN(_IO_file_xsputn, (f, data, n),
#if 0
/* Work in progress */
_IO_size_t
DEFUN(_IO_file_xsgetn, (fp, data, n),
_IO_FILE *fp AND void *data AND _IO_size_t n)
_IO_file_xsgetn (fp, data, n)
_IO_FILE *fp;
void *data;
_IO_size_t n;
{
register _IO_size_t more = n;
register char *s = data;
for (;;)
{
_IO_ssize_t count = fp->_IO_read_end - fp->_IO_read_ptr; /* Data available. */
/* Data available. */
_IO_ssize_t count = fp->_IO_read_end - fp->_IO_read_ptr;
if (count > 0)
{
if (count > more)
count = more;
if (count > 20)
{
memcpy(s, fp->_IO_read_ptr, count);
memcpy (s, fp->_IO_read_ptr, count);
s += count;
fp->_IO_read_ptr += count;
}
@ -726,8 +760,9 @@ DEFUN(_IO_file_xsgetn, (fp, data, n),
else
{
register char *p = fp->_IO_read_ptr;
register int i = (int)count;
while (--i >= 0) *s++ = *p++;
register int i = (int) count;
while (--i >= 0)
*s++ = *p++;
fp->_IO_read_ptr = p;
}
more -= count;
@ -742,11 +777,11 @@ DEFUN(_IO_file_xsgetn, (fp, data, n),
/* If we're reading a lot of data, don't bother allocating
a buffer. But if we're only reading a bit, perhaps we should ??*/
if (count <= 512 && fp->_IO_buf_base == NULL)
_IO_doallocbuf(fp);
_IO_doallocbuf (fp);
if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
_IO_flush_all_linebuffered();
_IO_flush_all_linebuffered ();
_IO_switch_to_get_mode(fp); ???;
_IO_switch_to_get_mode (fp); ???;
count = _IO_SYSREAD (fp, s, more);
if (count <= 0)
{
@ -760,14 +795,15 @@ DEFUN(_IO_file_xsgetn, (fp, data, n),
more -= count;
}
#endif
if (more == 0 || __underflow(fp) == EOF)
if (more == 0 || __underflow (fp) == EOF)
break;
}
return n - more;
}
#endif
struct _IO_jump_t _IO_file_jumps = {
struct _IO_jump_t _IO_file_jumps =
{
JUMP_INIT_DUMMY,
JUMP_INIT(finish, _IO_file_finish),
JUMP_INIT(overflow, _IO_file_overflow),

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"
@ -39,5 +40,9 @@ _IO_getc (fp)
_IO_cleanup_region_end (1);
return result;
}
#undef getc
#ifdef weak_alias
weak_alias (_IO_getc, getc)
#endif

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995 Free Software Foundation
/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#ifdef __STDC__
@ -29,7 +30,7 @@ the executable file might be covered by the GNU General Public License. */
int
_IO_fclose (fp)
register _IO_FILE *fp;
_IO_FILE *fp;
{
int status;
@ -52,4 +53,6 @@ _IO_fclose (fp)
return status;
}
#ifdef weak_alias
weak_alias (_IO_fclose, fclose)
#endif

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1994 Free Software Foundation
/* Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#ifdef __STDC__
#include <stdlib.h>

View File

@ -1,33 +1,34 @@
/*
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include <stdio.h>
int
_IO_fflush (fp)
register _IO_FILE *fp;
_IO_FILE *fp;
{
if (fp == NULL)
return _IO_flush_all ();

View File

@ -1,33 +1,34 @@
/*
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include <stdio.h>
int
fflush_unlocked (fp)
register _IO_FILE *fp;
_IO_FILE *fp;
{
if (fp == NULL)
return _IO_flush_all ();

View File

@ -1,30 +1,30 @@
/*
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include <errno.h>
/* ANSI explicitly requires setting errno to a positive value on failure. */
int
_IO_fgetpos (fp, posp)
@ -39,6 +39,8 @@ _IO_fgetpos (fp, posp)
_IO_cleanup_region_end (1);
if (pos == _IO_pos_BAD)
{
/* ANSI explicitly requires setting errno to a positive value on
failure. */
#ifdef EIO
if (errno == 0)
__set_errno (EIO);

View File

@ -1,35 +1,36 @@
/*
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include <stdio.h>
char*
char *
_IO_fgets (buf, n, fp)
char* buf;
char *buf;
int n;
_IO_FILE* fp;
_IO_FILE *fp;
{
_IO_size_t count;
char *result;

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#ifdef __STDC__

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995 Free Software Foundation
/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include <libioP.h>
#include <stdio.h>
@ -39,8 +40,8 @@ static int _IO_cookie_close __P ((_IO_FILE* fp));
static _IO_ssize_t
_IO_cookie_read (fp, buf, size)
register _IO_FILE* fp;
void* buf;
_IO_FILE *fp;
void *buf;
_IO_ssize_t size;
{
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
@ -53,8 +54,8 @@ _IO_cookie_read (fp, buf, size)
static _IO_ssize_t
_IO_cookie_write (fp, buf, size)
register _IO_FILE* fp;
const void* buf;
_IO_FILE *fp;
const void *buf;
_IO_ssize_t size;
{
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
@ -88,7 +89,7 @@ _IO_cookie_seek (fp, offset, dir)
static int
_IO_cookie_close (fp)
_IO_FILE* fp;
_IO_FILE *fp;
{
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
@ -31,11 +32,13 @@ the executable file might be covered by the GNU General Public License. */
#endif
int
_IO_fprintf
#ifdef __STDC__
(_IO_FILE *fp, const char* format, ...)
_IO_fprintf (_IO_FILE *fp, const char* format, ...)
#else
(fp, format, va_alist) _IO_FILE *fp; char *format; va_dcl
_IO_fprintf (fp, format, va_alist)
_IO_FILE *fp;
char *format;
va_dcl
#endif
{
int ret;

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include <string.h>

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995 Free Software Foundation
/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
@ -29,7 +30,7 @@ _IO_fread (buf, size, count, fp)
void *buf;
_IO_size_t size;
_IO_size_t count;
_IO_FILE* fp;
_IO_FILE *fp;
{
_IO_size_t bytes_requested = size*count;
_IO_size_t bytes_read;

View File

@ -1,33 +1,34 @@
/*
Copyright (C) 1993, 1995 Free Software Foundation
/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include <libioP.h>
#include <errno.h>
int
_IO_fsetpos (fp, posp)
_IO_FILE* fp;
_IO_FILE *fp;
const _IO_fpos_t *posp;
{
int result;

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include <errno.h>
@ -28,7 +29,7 @@ the executable file might be covered by the GNU General Public License. */
long int
_IO_ftell (fp)
_IO_FILE* fp;
_IO_FILE *fp;
{
_IO_pos_t pos;
CHECK_FILE (fp, -1L);

View File

@ -1,37 +1,38 @@
/*
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
_IO_size_t
_IO_fwrite (buf, size, count, fp)
const void* buf;
const void *buf;
_IO_size_t size;
_IO_size_t count;
_IO_FILE *fp;
{
_IO_size_t request = size*count;
_IO_size_t request = size * count;
_IO_size_t written;
CHECK_FILE (fp, 0);
if (request == 0)
@ -41,11 +42,11 @@ _IO_fwrite (buf, size, count, fp)
written = _IO_sputn (fp, (const char *) buf, request);
_IO_cleanup_region_end (1);
/* Many traditional implementations return 0 if size==0 && count > 0,
but ANSI seems to require us to return count in this case. */
but ANSI requires us to return count in this case. */
if (written == request)
return count;
else
return written/size;
return written / size;
}
#ifdef weak_alias

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1994, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#ifdef __STDC__
#include <stdlib.h>
@ -39,11 +40,11 @@ _IO_ssize_t
_IO_getdelim (lineptr, n, delimiter, fp)
char **lineptr;
_IO_size_t *n;
int delimiter;
_IO_FILE *fp;
int delimiter;
_IO_FILE *fp;
{
int result;
register _IO_ssize_t cur_len = 0;
_IO_ssize_t cur_len = 0;
_IO_ssize_t len;
if (lineptr == NULL || n == NULL)

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include <string.h>
@ -34,38 +35,41 @@ the executable file might be covered by the GNU General Public License. */
If extract_delim > 0, insert delim in output. */
_IO_size_t
DEFUN(_IO_getline, (fp, buf, n, delim, extract_delim),
_IO_FILE *fp AND char* buf AND _IO_size_t n
AND int delim AND int extract_delim)
_IO_getline (fp, buf, n, delim, extract_delim)
_IO_FILE *fp;
char *buf;
_IO_size_t n;
int delim;
int extract_delim;
{
register char *ptr = buf;
char *ptr = buf;
do
{
_IO_ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr;
char *t;
if (len <= 0)
if (__underflow(fp) == EOF)
if (__underflow (fp) == EOF)
break;
else
len = fp->_IO_read_end - fp->_IO_read_ptr;
if ((_IO_size_t) len >= n)
len = n;
t = (char*)memchr((void*)fp->_IO_read_ptr, delim, len);
t = (char *) memchr ((void *) fp->_IO_read_ptr, delim, len);
if (t != NULL)
{
_IO_size_t old_len = ptr-buf;
len = t - fp->_IO_read_ptr;
if (extract_delim >= 0)
{
t++;
++t;
if (extract_delim > 0)
len++;
++len;
}
memcpy((void*)ptr, (void*)fp->_IO_read_ptr, len);
memcpy ((void *) ptr, (void *) fp->_IO_read_ptr, len);
fp->_IO_read_ptr = t;
return old_len + len;
}
memcpy((void*)ptr, (void*)fp->_IO_read_ptr, len);
memcpy ((void *) ptr, (void *) fp->_IO_read_ptr, len);
fp->_IO_read_ptr += len;
ptr += len;
n -= len;

View File

@ -1,33 +1,34 @@
/*
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include <limits.h>
char*
_IO_gets (buf)
char* buf;
char *buf;
{
_IO_size_t count;
int ch;
@ -46,7 +47,7 @@ _IO_gets (buf)
count = 0;
else
{
buf[0] = (char)ch;
buf[0] = (char) ch;
count = _IO_getline (_IO_stdin, buf + 1, INT_MAX, '\n', 0) + 1;
if (_IO_stdin->_IO_file_flags & _IO_ERR_SEEN)
{

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
@ -31,13 +32,16 @@ static char const zeroes[PADSIZE] =
{'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
_IO_ssize_t
DEFUN(_IO_padn, (fp, pad, count),
_IO_FILE *fp AND int pad AND _IO_ssize_t count)
_IO_padn (fp, pad, count)
_IO_FILE *fp;
int pad;
_IO_ssize_t count;
{
char padbuf[PADSIZE];
const char *padptr;
register int i;
_IO_size_t written = 0, w;
int i;
_IO_size_t written = 0;
_IO_size_t w;
if (pad == ' ')
padptr = blanks;
@ -45,12 +49,13 @@ DEFUN(_IO_padn, (fp, pad, count),
padptr = zeroes;
else
{
for (i = PADSIZE; --i >= 0; ) padbuf[i] = pad;
for (i = PADSIZE; --i >= 0; )
padbuf[i] = pad;
padptr = padbuf;
}
for (i = count; i >= PADSIZE; i -= PADSIZE)
{
w = _IO_sputn(fp, padptr, PADSIZE);
w = _IO_sputn (fp, padptr, PADSIZE);
written += w;
if (w != PADSIZE)
return written;
@ -58,7 +63,7 @@ DEFUN(_IO_padn, (fp, pad, count),
if (i > 0)
{
w = _IO_sputn(fp, padptr, i);
w = _IO_sputn (fp, padptr, i);
written += w;
}
return written;

View File

@ -1,28 +1,28 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
Written by Per Bothner <bothner@cygnus.com>.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
/* written by Per Bothner (bothner@cygnus.com) */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#ifndef _POSIX_SOURCE
# define _POSIX_SOURCE
@ -80,17 +80,19 @@ typedef struct _IO_proc_file _IO_proc_file;
static struct _IO_proc_file *proc_file_chain = NULL;
_IO_FILE *
DEFUN(_IO_proc_open, (fp, command, mode),
_IO_FILE* fp AND const char *command AND const char *mode)
_IO_proc_open (fp, command, mode)
_IO_FILE *fp;
const char *command;
const char *mode;
{
#if _IO_HAVE_SYS_WAIT
volatile int read_or_write;
volatile int parent_end, child_end;
int pipe_fds[2];
_IO_pid_t child_pid;
if (_IO_file_is_open(fp))
if (_IO_file_is_open (fp))
return NULL;
if (_IO_pipe(pipe_fds) < 0)
if (_IO_pipe (pipe_fds) < 0)
return NULL;
if (mode[0] == 'r')
{
@ -104,17 +106,17 @@ DEFUN(_IO_proc_open, (fp, command, mode),
child_end = pipe_fds[0];
read_or_write = _IO_NO_READS;
}
((_IO_proc_file*)fp)->pid = child_pid = _IO_fork();
((_IO_proc_file *) fp)->pid = child_pid = _IO_fork ();
if (child_pid == 0)
{
int child_std_end = mode[0] == 'r' ? 1 : 0;
_IO_close(parent_end);
_IO_close (parent_end);
if (child_end != child_std_end)
{
_IO_dup2(child_end, child_std_end);
_IO_close(child_end);
_IO_dup2 (child_end, child_std_end);
_IO_close (child_end);
}
/* Posix.2: "popen() shall ensure that any streams from previous
/* POSIX.2: "popen() shall ensure that any streams from previous
popen() calls that remain open in the parent process are closed
in the new child process." */
while (proc_file_chain)
@ -123,20 +125,20 @@ DEFUN(_IO_proc_open, (fp, command, mode),
proc_file_chain = proc_file_chain->next;
}
_IO_execl("/bin/sh", "sh", "-c", command, (char *) 0);
_IO__exit(127);
_IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0);
_IO__exit (127);
}
_IO_close(child_end);
_IO_close (child_end);
if (child_pid < 0)
{
_IO_close(parent_end);
_IO_close (parent_end);
return NULL;
}
_IO_fileno(fp) = parent_end;
_IO_fileno (fp) = parent_end;
/* Link into proc_file_chain. */
((_IO_proc_file*)fp)->next = proc_file_chain;
proc_file_chain = (_IO_proc_file*)fp;
((_IO_proc_file *) fp)->next = proc_file_chain;
proc_file_chain = (_IO_proc_file *) fp;
_IO_mask_flags (fp, read_or_write, _IO_NO_READS|_IO_NO_WRITES);
return fp;
@ -146,8 +148,9 @@ DEFUN(_IO_proc_open, (fp, command, mode),
}
_IO_FILE *
DEFUN(_IO_popen, (command, mode),
const char *command AND const char *mode)
_IO_popen (command, mode)
const char *command;
const char *mode;
{
struct locked_FILE
{
@ -165,11 +168,11 @@ DEFUN(_IO_popen, (command, mode),
new_f->fpx.file.file._lock = &new_f->lock;
#endif
fp = (_IO_FILE*)&new_f->fpx;
_IO_init(fp, 0);
_IO_JUMPS(fp) = &_IO_proc_jumps;
_IO_file_init(fp);
_IO_init (fp, 0);
_IO_JUMPS (fp) = &_IO_proc_jumps;
_IO_file_init (fp);
#if !_IO_UNIFIED_JUMPTABLES
((struct _IO_FILE_plus*)fp)->vtable = NULL;
((struct _IO_FILE_plus *) fp)->vtable = NULL;
#endif
if (_IO_proc_open (fp, command, mode) != NULL)
return fp;
@ -182,8 +185,8 @@ strong_alias (_IO_popen, popen);
#endif
int
DEFUN(_IO_proc_close, (fp),
_IO_FILE *fp)
_IO_proc_close (fp)
_IO_FILE *fp;
{
/* This is not name-space clean. FIXME! */
#if _IO_HAVE_SYS_WAIT
@ -195,7 +198,7 @@ DEFUN(_IO_proc_close, (fp),
/* Unlink from proc_file_chain. */
for ( ; *ptr != NULL; ptr = &(*ptr)->next)
{
if (*ptr == (_IO_proc_file*)fp)
if (*ptr == (_IO_proc_file *) fp)
{
*ptr = (*ptr)->next;
status = 0;
@ -203,7 +206,7 @@ DEFUN(_IO_proc_close, (fp),
}
}
if (status < 0 || _IO_close(_IO_fileno(fp)) < 0)
if (status < 0 || _IO_close (_IO_fileno(fp)) < 0)
return -1;
/* POSIX.2 Rationale: "Some historical implementations either block
or ignore the signals SIGINT, SIGQUIT, and SIGHUP while waiting
@ -211,8 +214,9 @@ DEFUN(_IO_proc_close, (fp),
described in POSIX.2, such implementations are not conforming." */
do
{
wait_pid = _IO_waitpid (((_IO_proc_file*)fp)->pid, &wstatus, 0);
} while (wait_pid == -1 && errno == EINTR);
wait_pid = _IO_waitpid (((_IO_proc_file *) fp)->pid, &wstatus, 0);
}
while (wait_pid == -1 && errno == EINTR);
if (wait_pid == -1)
return -1;
return wstatus;

View File

@ -1,37 +1,39 @@
/* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include <string.h>
int
_IO_puts (str)
const char *str;
const char *str;
{
int result;
_IO_size_t len = strlen (str);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
_IO_stdout);
_IO_stdout);
_IO_flockfile (_IO_stdout);
if (_IO_sputn (_IO_stdout, str, len) == len
&& _IO_putc_unlocked ('\n', _IO_stdout) != EOF)

View File

@ -1,32 +1,36 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include <libioP.h>
_IO_pos_t
DEFUN(_IO_seekoff, (fp, offset, dir, mode),
_IO_FILE* fp AND _IO_off_t offset AND int dir AND int mode)
_IO_seekoff (fp, offset, dir, mode)
_IO_FILE *fp;
_IO_off_t offset;
int dir;
int mode;
{
/* If we have a backup buffer, get rid of it, since the __seekoff
callback may not know to do the right thing about it.

View File

@ -1,32 +1,35 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include <libioP.h>
_IO_pos_t
DEFUN(_IO_seekpos, (fp, pos, mode),
_IO_FILE* fp AND _IO_pos_t pos AND int mode)
_IO_seekpos (fp, pos, mode)
_IO_FILE *fp;
_IO_pos_t pos;
int mode;
{
/* If we have a backup buffer, get rid of it, since the __seekoff
callback may not know to do the right thing about it.

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
@ -30,8 +31,8 @@ the executable file might be covered by the GNU General Public License. */
int
_IO_setvbuf (fp, buf, mode, size)
_IO_FILE* fp;
char* buf;
_IO_FILE *fp;
char *buf;
int mode;
_IO_size_t size;
{

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
@ -31,17 +32,19 @@ the executable file might be covered by the GNU General Public License. */
#endif
int
_IO_sprintf
#ifdef __STDC__
(char *string, const char* format, ...)
_IO_sprintf (char *string, const char* format, ...)
#else
(string, format, va_alist) char *string; char *format; va_dcl
_IO_sprintf (string, format, va_alist)
char *string;
char *format;
va_dcl
#endif
{
int ret;
va_list args;
_IO_va_start(args, format);
ret = _IO_vsprintf(string, format, args);
va_end(args);
_IO_va_start (args, format);
ret = _IO_vsprintf (string, format, args);
va_end (args);
return ret;
}

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1995 Free Software Foundation
/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "libio.h"
@ -63,4 +64,7 @@ _IO_vdprintf (d, format, arg)
return done;
}
#ifdef weak_alias
weak_alias (_IO_vdprintf, vdprintf)
#endif

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "strfile.h"
@ -29,7 +30,7 @@ int
_IO_vsprintf (string, format, args)
char *string;
const char *format;
_IO_va_list args;
_IO_va_list args;
{
_IO_strfile sf;
#ifdef _IO_MTSAFE_IO

View File

@ -1,33 +1,36 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "strfile.h"
int
DEFUN(_IO_vsscanf, (string, format, args),
const char *string AND const char *format AND _IO_va_list args)
_IO_vsscanf (string, format, args)
const char *string;
const char *format;
_IO_va_list args;
{
int ret;
_IO_strfile sf;
@ -35,12 +38,12 @@ DEFUN(_IO_vsscanf, (string, format, args),
_IO_lock_t lock;
sf._sbf._f._lock = &lock;
#endif
_IO_init(&sf._sbf._f, 0);
_IO_JUMPS(&sf._sbf._f) = &_IO_str_jumps;
_IO_init (&sf._sbf._f, 0);
_IO_JUMPS (&sf._sbf._f) = &_IO_str_jumps;
_IO_str_init_static (&sf._sbf._f, (char*)string, 0, NULL);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, &sf);
_IO_flockfile (&sf._sbf._f);
ret = _IO_vfscanf(&sf._sbf._f, format, args, NULL);
ret = _IO_vfscanf (&sf._sbf._f, format, args, NULL);
_IO_cleanup_region_end (1);
return ret;
}

View File

@ -1,28 +1,28 @@
/*
Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation
/* Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
Written by Per Bothner <bothner@cygnus.com>.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
/* This is part of the iostream library. Written by Per Bothner. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#ifndef _IO_STDIO_H
#define _IO_STDIO_H
@ -43,56 +43,56 @@ the executable file might be covered by the GNU General Public License. */
#ifdef _G_NEED_STDARG_H
/* This define avoids name pollution if we're using GNU stdarg.h */
#define __need___va_list
#include <stdarg.h>
#ifdef __GNUC_VA_LIST
#undef _IO_va_list
#define _IO_va_list __gnuc_va_list
#endif /* __GNUC_VA_LIST */
# define __need___va_list
# include <stdarg.h>
# ifdef __GNUC_VA_LIST
# undef _IO_va_list
# define _IO_va_list __gnuc_va_list
# endif /* __GNUC_VA_LIST */
#endif
#ifndef __P
#if _G_HAVE_SYS_CDEFS
#include <sys/cdefs.h>
#else
#ifdef __STDC__
#define __P(protos) protos
#else
#define __P(protos) ()
#endif
#endif
# if _G_HAVE_SYS_CDEFS
# include <sys/cdefs.h>
# else
# ifdef __STDC__
# define __P(protos) protos
# else
# define __P(protos) ()
# endif
# endif
#endif /*!__P*/
/* For backward compatibility */
#ifndef _PARAMS
#define _PARAMS(protos) __P(protos)
# define _PARAMS(protos) __P(protos)
#endif /*!_PARAMS*/
#ifndef __STDC__
#define const
# define const
#endif
#define _IO_UNIFIED_JUMPTABLES 1
#if 0
#ifdef _IO_NEED_STDARG_H
#include <stdarg.h>
#endif
# ifdef _IO_NEED_STDARG_H
# include <stdarg.h>
# endif
#endif
#ifndef EOF
#define EOF (-1)
# define EOF (-1)
#endif
#ifndef NULL
#if defined __GNUG__ && \
# if defined __GNUG__ && \
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
#define NULL (__null)
#else
#if !defined(__cplusplus)
#define NULL ((void*)0)
#else
#define NULL (0)
#endif
#endif
# define NULL (__null)
# else
# if !defined(__cplusplus)
# define NULL ((void*)0)
# else
# define NULL (0)
# endif
# endif
#endif
#define _IOS_INPUT 1
@ -153,7 +153,7 @@ struct _IO_jump_t; struct _IO_FILE;
/* Handle lock. */
#ifdef _IO_MTSAFE_IO
#include <bits/stdio-lock.h>
# include <bits/stdio-lock.h>
#else
typedef void _IO_lock_t;
#endif
@ -239,7 +239,8 @@ typedef struct
} _IO_cookie_io_functions_t;
/* Special file type for fopencookie function. */
struct _IO_cookie_file {
struct _IO_cookie_file
{
struct _IO_FILE file;
const void *vtable;
void *cookie;
@ -251,22 +252,22 @@ struct _IO_cookie_file {
extern "C" {
#endif
extern int __underflow __P((_IO_FILE*));
extern int __uflow __P((_IO_FILE*));
extern int __overflow __P((_IO_FILE*, int));
extern int __underflow __P ((_IO_FILE *));
extern int __uflow __P ((_IO_FILE *));
extern int __overflow __P ((_IO_FILE *, int));
#define _IO_getc_unlocked(_fp) \
((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end ? __uflow(_fp) \
: *(unsigned char*)(_fp)->_IO_read_ptr++)
((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end ? __uflow (_fp) \
: *(unsigned char *) (_fp)->_IO_read_ptr++)
#define _IO_peekc_unlocked(_fp) \
((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end \
&& __underflow(_fp) == EOF ? EOF \
: *(unsigned char*)(_fp)->_IO_read_ptr)
&& __underflow (_fp) == EOF ? EOF \
: *(unsigned char *) (_fp)->_IO_read_ptr)
#define _IO_putc_unlocked(_ch, _fp) \
(((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end) \
? __overflow(_fp, (unsigned char)(_ch)) \
: (unsigned char)(*(_fp)->_IO_write_ptr++ = (_ch)))
? __overflow (_fp, (unsigned char) (_ch)) \
: (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))
#define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0)
#define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0)
@ -294,32 +295,17 @@ extern int _IO_ftrylockfile __P ((_IO_FILE *));
# define _IO_cleanup_region_end(_Doit) /**/
#endif /* !_IO_MTSAFE_IO */
/* XXX Should we allow a symbol to be defined which selects the efficient
implementation when the user is really sure no threaded functions ever
will be used? */
#if 1
# define _IO_getc(_fp) _IO_getc (_fp)
# define _IO_peekc(_fp) _IO_peekc_locked (_fp)
# define _IO_putc(_ch, _fp) _IO_putc (_ch, _fp)
# define _IO_feof(_fp) _IO_feof (_fp)
# define _IO_ferror(_fp) _IO_ferror (_fp)
#else
# define _IO_getc(_fp) _IO_getc_unlocked (_fp)
# define _IO_peekc(_fp) _IO_peekc_unlocked (_fp)
# define _IO_putc(_ch, _fp) _IO_putc_unlocked (_ch, _fp)
# define _IO_feof(_fp) _IO_feof_unlocked (_fp)
# define _IO_ferror(_fp) _IO_ferror_unlocked (_fp)
#endif
#define _IO_peekc(_fp) _IO_peekc_locked (_fp)
extern int _IO_vfscanf __P((_IO_FILE*, const char*, _IO_va_list, int*));
extern int _IO_vfprintf __P((_IO_FILE*, const char*, _IO_va_list));
extern _IO_ssize_t _IO_padn __P((_IO_FILE *, int, _IO_ssize_t));
extern _IO_size_t _IO_sgetn __P((_IO_FILE *, void*, _IO_size_t));
extern int _IO_vfscanf __P ((_IO_FILE *, const char *, _IO_va_list, int *));
extern int _IO_vfprintf __P ((_IO_FILE *, const char *, _IO_va_list));
extern _IO_ssize_t _IO_padn __P ((_IO_FILE *, int, _IO_ssize_t));
extern _IO_size_t _IO_sgetn __P ((_IO_FILE *, void *, _IO_size_t));
extern _IO_fpos_t _IO_seekoff __P((_IO_FILE*, _IO_off_t, int, int));
extern _IO_fpos_t _IO_seekpos __P((_IO_FILE*, _IO_fpos_t, int));
extern _IO_fpos_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
extern _IO_fpos_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos_t, int));
extern void _IO_free_backup_area __P((_IO_FILE*));
extern void _IO_free_backup_area __P ((_IO_FILE *));
#ifdef __cplusplus
}

View File

@ -1,57 +1,34 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#include <bits/libc-lock.h>
#include "iolibio.h"
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(__cplusplus)
/* All known AIX compilers implement these things (but don't always
define __STDC__). The RISC/OS MIPS compiler defines these things
in SVR4 mode, but does not define __STDC__. */
#define AND ,
#define DEFUN(name, arglist, args) name(args)
#define DEFUN_VOID(name) name(void)
#else /* Not ANSI C. */
#define AND ;
#ifndef const /* some systems define it in header files for non-ansi mode */
#define const
#endif
#define DEFUN(name, arglist, args) name arglist args;
#define DEFUN_VOID(name) name()
#endif /* ANSI C. */
#ifdef __cplusplus
extern "C" {
#endif
__BEGIN_DECLS
#define _IO_seek_set 0
#define _IO_seek_cur 1
@ -78,103 +55,104 @@ extern "C" {
* object being acted on (i.e. the 'this' parameter).
*/
#define _IO_JUMPS(THIS) ((struct _IO_FILE_plus*)(THIS))->vtable
#define _IO_JUMPS(THIS) ((struct _IO_FILE_plus *) (THIS))->vtable
#ifdef _G_USING_THUNKS
#define JUMP_FIELD(TYPE, NAME) TYPE NAME
#define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC(THIS)
#define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC(THIS, X1)
#define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC(THIS, X1, X2)
#define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC(THIS, X1,X2, X3)
#define JUMP_INIT(NAME, VALUE) VALUE
#define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0), JUMP_INIT(dummy2, 0)
# define JUMP_FIELD(TYPE, NAME) TYPE NAME
# define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC (THIS)
# define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC (THIS, X1)
# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC (THIS, X1, X2)
# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC (THIS, X1,X2, X3)
# define JUMP_INIT(NAME, VALUE) VALUE
# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0), JUMP_INIT (dummy2, 0)
#else
/* These macros will change when we re-implement vtables to use "thunks"! */
#define JUMP_FIELD(TYPE, NAME) struct { short delta1, delta2; TYPE pfn; } NAME
#define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC.pfn(THIS)
#define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC.pfn(THIS, X1)
#define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC.pfn(THIS, X1, X2)
#define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC.pfn(THIS, X1,X2, X3)
#define JUMP_INIT(NAME, VALUE) {0, 0, VALUE}
#define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0)
# define JUMP_FIELD(TYPE, NAME) struct { short delta1, delta2; TYPE pfn; } NAME
# define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC.pfn (THIS)
# define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC.pfn (THIS, X1)
# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC.pfn (THIS, X1, X2)
# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC.pfn (THIS, X1,X2,X3)
# define JUMP_INIT(NAME, VALUE) {0, 0, VALUE}
# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0)
#endif
/* The 'finish' function does any final cleaning up of an _IO_FILE object.
It does not delete (free) it, but does everything else to finalize it/
It matches the streambuf::~streambuf virtual destructor. */
typedef void (*_IO_finish_t) __P((_IO_FILE*, int)); /* finalize */
#define _IO_FINISH(FP) JUMP1(__finish, FP, 0)
typedef void (*_IO_finish_t) __P ((_IO_FILE *, int)); /* finalize */
#define _IO_FINISH(FP) JUMP1 (__finish, FP, 0)
/* The 'overflow' hook flushes the buffer.
The second argument is a character, or EOF.
It matches the streambuf::overflow virtual function. */
typedef int (*_IO_overflow_t) __P((_IO_FILE*, int));
#define _IO_OVERFLOW(FP, CH) JUMP1(__overflow, FP, CH)
typedef int (*_IO_overflow_t) __P ((_IO_FILE *, int));
#define _IO_OVERFLOW(FP, CH) JUMP1 (__overflow, FP, CH)
/* The 'underflow' hook tries to fills the get buffer.
It returns the next character (as an unsigned char) or EOF. The next
character remains in the get buffer, and the get position is not changed.
It matches the streambuf::underflow virtual function. */
typedef int (*_IO_underflow_t) __P((_IO_FILE*));
#define _IO_UNDERFLOW(FP) JUMP0(__underflow, FP)
typedef int (*_IO_underflow_t) __P ((_IO_FILE *));
#define _IO_UNDERFLOW(FP) JUMP0 (__underflow, FP)
/* The 'uflow' hook returns the next character in the input stream
(cast to unsigned char), and increments the read position;
EOF is returned on failure.
It matches the streambuf::uflow virtual function, which is not in the
cfront implementation, but was added to C++ by the ANSI/ISO committee. */
#define _IO_UFLOW(FP) JUMP0(__uflow, FP)
#define _IO_UFLOW(FP) JUMP0 (__uflow, FP)
/* The 'pbackfail' hook handles backing up.
It matches the streambuf::pbackfail virtual function. */
typedef int (*_IO_pbackfail_t) __P((_IO_FILE*, int));
#define _IO_PBACKFAIL(FP, CH) JUMP1(__pbackfail, FP, CH)
typedef int (*_IO_pbackfail_t) __P ((_IO_FILE *, int));
#define _IO_PBACKFAIL(FP, CH) JUMP1 (__pbackfail, FP, CH)
/* The 'xsputn' hook writes upto N characters from buffer DATA.
Returns the number of character actually written.
It matches the streambuf::xsputn virtual function. */
typedef _IO_size_t (*_IO_xsputn_t)
__P((_IO_FILE *FP, const void *DATA, _IO_size_t N));
#define _IO_XSPUTN(FP, DATA, N) JUMP2(__xsputn, FP, DATA, N)
typedef _IO_size_t (*_IO_xsputn_t) __P ((_IO_FILE *FP, const void *DATA,
_IO_size_t N));
#define _IO_XSPUTN(FP, DATA, N) JUMP2 (__xsputn, FP, DATA, N)
/* The 'xsgetn' hook reads upto N characters into buffer DATA.
Returns the number of character actually read.
It matches the streambuf::xsgetn virtual function. */
typedef _IO_size_t (*_IO_xsgetn_t) __P((_IO_FILE*FP, void*DATA, _IO_size_t N));
#define _IO_XSGETN(FP, DATA, N) JUMP2(__xsgetn, FP, DATA, N)
typedef _IO_size_t (*_IO_xsgetn_t) __P ((_IO_FILE *FP, void *DATA,
_IO_size_t N));
#define _IO_XSGETN(FP, DATA, N) JUMP2 (__xsgetn, FP, DATA, N)
/* The 'seekoff' hook moves the stream position to a new position
relative to the start of the file (if DIR==0), the current position
(MODE==1), or the end of the file (MODE==2).
It matches the streambuf::seekoff virtual function.
It is also used for the ANSI fseek function. */
typedef _IO_fpos_t (*_IO_seekoff_t)
__P((_IO_FILE* FP, _IO_off_t OFF, int DIR, int MODE));
#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3(__seekoff, FP, OFF, DIR, MODE)
typedef _IO_fpos_t (*_IO_seekoff_t) __P ((_IO_FILE *FP, _IO_off_t OFF,
int DIR, int MODE));
#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE)
/* The 'seekpos' hook also moves the stream position,
but to an absolute position given by a fpos_t (seekpos).
It matches the streambuf::seekpos virtual function.
It is also used for the ANSI fgetpos and fsetpos functions. */
/* The _IO_seek_cur and _IO_seek_end options are not allowed. */
typedef _IO_fpos_t (*_IO_seekpos_t) __P((_IO_FILE*, _IO_fpos_t, int));
#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2(__seekpos, FP, POS, FLAGS)
typedef _IO_fpos_t (*_IO_seekpos_t) __P ((_IO_FILE *, _IO_fpos_t, int));
#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__seekpos, FP, POS, FLAGS)
/* The 'setbuf' hook gives a buffer to the file.
It matches the streambuf::setbuf virtual function. */
typedef _IO_FILE* (*_IO_setbuf_t) __P((_IO_FILE*, char *, _IO_ssize_t));
#define _IO_SETBUF(FP, BUFFER, LENGTH) JUMP2(__setbuf, FP, BUFFER, LENGTH)
typedef _IO_FILE* (*_IO_setbuf_t) __P ((_IO_FILE *, char *, _IO_ssize_t));
#define _IO_SETBUF(FP, BUFFER, LENGTH) JUMP2 (__setbuf, FP, BUFFER, LENGTH)
/* The 'sync' hook attempts to synchronize the internal data structures
of the file with the external state.
It matches the streambuf::sync virtual function. */
typedef int (*_IO_sync_t) __P((_IO_FILE*));
#define _IO_SYNC(FP) JUMP0(__sync, FP)
typedef int (*_IO_sync_t) __P ((_IO_FILE *));
#define _IO_SYNC(FP) JUMP0 (__sync, FP)
/* The 'doallocate' hook is used to tell the file to allocate a buffer.
It matches the streambuf::doallocate virtual function, which is not
in the ANSI/ISO C++ standard, but is part traditional implementations. */
typedef int (*_IO_doallocate_t) __P((_IO_FILE*));
#define _IO_DOALLOCATE(FP) JUMP0(__doallocate, FP)
typedef int (*_IO_doallocate_t) __P ((_IO_FILE *));
#define _IO_DOALLOCATE(FP) JUMP0 (__doallocate, FP)
/* The following four hooks (sysread, syswrite, sysclose, sysseek, and
sysstat) are low-level hooks specific to this implementation.
@ -191,42 +169,43 @@ typedef int (*_IO_doallocate_t) __P((_IO_FILE*));
an existing buffer. It generalizes the Unix read(2) function.
It matches the streambuf::sys_read virtual function, which is
specific to this implementation. */
typedef _IO_ssize_t (*_IO_read_t) __P((_IO_FILE*, void*, _IO_ssize_t));
#define _IO_SYSREAD(FP, DATA, LEN) JUMP2(__read, FP, DATA, LEN)
typedef _IO_ssize_t (*_IO_read_t) __P ((_IO_FILE *, void *, _IO_ssize_t));
#define _IO_SYSREAD(FP, DATA, LEN) JUMP2 (__read, FP, DATA, LEN)
/* The 'syswrite' hook is used to write data from an existing buffer
to an external file. It generalizes the Unix write(2) function.
It matches the streambuf::sys_write virtual function, which is
specific to this implementation. */
typedef _IO_ssize_t (*_IO_write_t) __P((_IO_FILE*,const void*,_IO_ssize_t));
#define _IO_SYSWRITE(FP, DATA, LEN) JUMP2(__write, FP, DATA, LEN)
typedef _IO_ssize_t (*_IO_write_t) __P ((_IO_FILE *,const void *,_IO_ssize_t));
#define _IO_SYSWRITE(FP, DATA, LEN) JUMP2 (__write, FP, DATA, LEN)
/* The 'sysseek' hook is used to re-position an external file.
It generalizes the Unix lseek(2) function.
It matches the streambuf::sys_seek virtual function, which is
specific to this implementation. */
typedef _IO_fpos_t (*_IO_seek_t) __P((_IO_FILE*, _IO_off_t, int));
#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2(__seek, FP, OFFSET, MODE)
typedef _IO_fpos_t (*_IO_seek_t) __P ((_IO_FILE *, _IO_off_t, int));
#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__seek, FP, OFFSET, MODE)
/* The 'sysclose' hook is used to finalize (close, finish up) an
external file. It generalizes the Unix close(2) function.
It matches the streambuf::sys_close virtual function, which is
specific to this implementation. */
typedef int (*_IO_close_t) __P((_IO_FILE*)); /* finalize */
#define _IO_SYSCLOSE(FP) JUMP0(__close, FP)
typedef int (*_IO_close_t) __P ((_IO_FILE *)); /* finalize */
#define _IO_SYSCLOSE(FP) JUMP0 (__close, FP)
/* The 'sysstat' hook is used to get information about an external file
into a struct stat buffer. It generalizes the Unix fstat(2) call.
It matches the streambuf::sys_stat virtual function, which is
specific to this implementation. */
typedef int (*_IO_stat_t) __P((_IO_FILE*, void*));
#define _IO_SYSSTAT(FP, BUF) JUMP1(__stat, FP, BUF)
typedef int (*_IO_stat_t) __P ((_IO_FILE *, void *));
#define _IO_SYSSTAT(FP, BUF) JUMP1 (__stat, FP, BUF)
#define _IO_CHAR_TYPE char /* unsigned char ? */
#define _IO_INT_TYPE int
struct _IO_jump_t {
struct _IO_jump_t
{
JUMP_FIELD(_G_size_t, __dummy);
#ifdef _G_USING_THUNKS
JUMP_FIELD(_G_size_t, __dummy2);
@ -260,63 +239,69 @@ struct _IO_jump_t {
This is for compatibility with C++ streambuf; the word can
be used to smash to a pointer to a virtual function table. */
struct _IO_FILE_plus {
struct _IO_FILE_plus
{
_IO_FILE file;
const struct _IO_jump_t *vtable;
};
/* Generic functions */
extern _IO_fpos_t _IO_seekoff __P((_IO_FILE*, _IO_off_t, int, int));
extern _IO_fpos_t _IO_seekpos __P((_IO_FILE*, _IO_fpos_t, int));
extern _IO_fpos_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
extern _IO_fpos_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos_t, int));
extern int _IO_switch_to_get_mode __P((_IO_FILE*));
extern void _IO_init __P((_IO_FILE*, int));
extern int _IO_sputbackc __P((_IO_FILE*, int));
extern int _IO_sungetc __P((_IO_FILE*));
extern void _IO_un_link __P((_IO_FILE*));
extern void _IO_link_in __P((_IO_FILE *));
extern void _IO_doallocbuf __P((_IO_FILE*));
extern void _IO_unsave_markers __P((_IO_FILE*));
extern void _IO_setb __P((_IO_FILE*, char*, char*, int));
extern unsigned _IO_adjust_column __P((unsigned, const char *, int));
#define _IO_sputn(__fp, __s, __n) _IO_XSPUTN(__fp, __s, __n)
extern void _IO_switch_to_main_get_area __P ((_IO_FILE *));
extern void _IO_switch_to_backup_area __P ((_IO_FILE *));
extern int _IO_switch_to_get_mode __P ((_IO_FILE *));
extern void _IO_init __P ((_IO_FILE *, int));
extern int _IO_sputbackc __P ((_IO_FILE *, int));
extern int _IO_sungetc __P ((_IO_FILE *));
extern void _IO_un_link __P ((_IO_FILE *));
extern void _IO_link_in __P ((_IO_FILE *));
extern void _IO_doallocbuf __P ((_IO_FILE *));
extern void _IO_unsave_markers __P ((_IO_FILE *));
extern void _IO_setb __P ((_IO_FILE *, char *, char *, int));
extern unsigned _IO_adjust_column __P ((unsigned, const char *, int));
#define _IO_sputn(__fp, __s, __n) _IO_XSPUTN (__fp, __s, __n)
/* Marker-related function. */
extern void _IO_init_marker __P((struct _IO_marker *, _IO_FILE *));
extern void _IO_remove_marker __P((struct _IO_marker*));
extern int _IO_marker_difference __P((struct _IO_marker *, struct _IO_marker *));
extern int _IO_marker_delta __P((struct _IO_marker *));
extern int _IO_seekmark __P((_IO_FILE *, struct _IO_marker *, int));
extern void _IO_init_marker __P ((struct _IO_marker *, _IO_FILE *));
extern void _IO_remove_marker __P ((struct _IO_marker *));
extern int _IO_marker_difference __P ((struct _IO_marker *,
struct _IO_marker *));
extern int _IO_marker_delta __P ((struct _IO_marker *));
extern int _IO_seekmark __P ((_IO_FILE *, struct _IO_marker *, int));
/* Default jumptable functions. */
extern int _IO_default_underflow __P((_IO_FILE*));
extern int _IO_default_uflow __P((_IO_FILE*));
extern int _IO_default_doallocate __P((_IO_FILE*));
extern void _IO_default_finish __P((_IO_FILE *, int));
extern int _IO_default_pbackfail __P((_IO_FILE*, int));
extern _IO_FILE* _IO_default_setbuf __P((_IO_FILE *, char*, _IO_ssize_t));
extern _IO_size_t _IO_default_xsputn __P((_IO_FILE *, const void*, _IO_size_t));
extern _IO_size_t _IO_default_xsgetn __P((_IO_FILE *, void*, _IO_size_t));
extern _IO_fpos_t _IO_default_seekoff __P((_IO_FILE*, _IO_off_t, int, int));
extern _IO_fpos_t _IO_default_seekpos __P((_IO_FILE*, _IO_fpos_t, int));
extern _IO_ssize_t _IO_default_write __P((_IO_FILE*,const void*,_IO_ssize_t));
extern _IO_ssize_t _IO_default_read __P((_IO_FILE*, void*, _IO_ssize_t));
extern int _IO_default_stat __P((_IO_FILE*, void*));
extern _IO_fpos_t _IO_default_seek __P((_IO_FILE*, _IO_off_t, int));
extern int _IO_default_sync __P((_IO_FILE*));
#define _IO_default_close ((_IO_close_t)_IO_default_sync)
extern int _IO_default_underflow __P ((_IO_FILE *));
extern int _IO_default_uflow __P ((_IO_FILE *));
extern int _IO_default_doallocate __P ((_IO_FILE *));
extern void _IO_default_finish __P ((_IO_FILE *, int));
extern int _IO_default_pbackfail __P ((_IO_FILE *, int));
extern _IO_FILE* _IO_default_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *,
_IO_size_t));
extern _IO_size_t _IO_default_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
extern _IO_fpos_t _IO_default_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
extern _IO_fpos_t _IO_default_seekpos __P ((_IO_FILE *, _IO_fpos_t, int));
extern _IO_ssize_t _IO_default_write __P ((_IO_FILE *, const void *,
_IO_ssize_t));
extern _IO_ssize_t _IO_default_read __P ((_IO_FILE *, void *, _IO_ssize_t));
extern int _IO_default_stat __P ((_IO_FILE *, void *));
extern _IO_fpos_t _IO_default_seek __P ((_IO_FILE *, _IO_off_t, int));
extern int _IO_default_sync __P ((_IO_FILE *));
#define _IO_default_close ((_IO_close_t) _IO_default_sync)
extern struct _IO_jump_t _IO_file_jumps;
extern struct _IO_jump_t _IO_streambuf_jumps;
extern struct _IO_jump_t _IO_proc_jumps;
extern struct _IO_jump_t _IO_str_jumps;
extern int _IO_do_write __P((_IO_FILE*, const char*, _IO_size_t));
extern int _IO_flush_all __P((void));
extern void _IO_cleanup __P((void));
extern void _IO_flush_all_linebuffered __P((void));
extern int _IO_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
extern int _IO_flush_all __P ((void));
extern void _IO_cleanup __P ((void));
extern void _IO_flush_all_linebuffered __P ((void));
#define _IO_do_flush(_f) \
_IO_do_write(_f, (_f)->_IO_write_base, \
@ -335,40 +320,41 @@ extern void _IO_flush_all_linebuffered __P((void));
/* Jumptable functions for files. */
extern int _IO_file_doallocate __P((_IO_FILE*));
extern _IO_FILE* _IO_file_setbuf __P((_IO_FILE *, char*, _IO_ssize_t));
extern _IO_fpos_t _IO_file_seekoff __P((_IO_FILE*, _IO_off_t, int, int));
extern _IO_size_t _IO_file_xsputn __P((_IO_FILE*,const void*,_IO_size_t));
extern int _IO_file_stat __P((_IO_FILE*, void*));
extern int _IO_file_close __P((_IO_FILE*));
extern int _IO_file_underflow __P((_IO_FILE *));
extern int _IO_file_overflow __P((_IO_FILE *, int));
extern int _IO_file_doallocate __P ((_IO_FILE *));
extern _IO_FILE* _IO_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
extern _IO_fpos_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
extern _IO_size_t _IO_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
extern int _IO_file_stat __P ((_IO_FILE *, void *));
extern int _IO_file_close __P ((_IO_FILE *));
extern int _IO_file_underflow __P ((_IO_FILE *));
extern int _IO_file_overflow __P ((_IO_FILE *, int));
#define _IO_file_is_open(__fp) ((__fp)->_fileno >= 0)
extern void _IO_file_init __P((_IO_FILE*));
extern _IO_FILE* _IO_file_attach __P((_IO_FILE*, int));
extern _IO_FILE* _IO_file_fopen __P((_IO_FILE*, const char*, const char*));
extern _IO_ssize_t _IO_file_write __P((_IO_FILE*,const void*,_IO_ssize_t));
extern _IO_ssize_t _IO_file_read __P((_IO_FILE*, void*, _IO_ssize_t));
extern int _IO_file_sync __P((_IO_FILE*));
extern int _IO_file_close_it __P((_IO_FILE*));
extern _IO_fpos_t _IO_file_seek __P((_IO_FILE *, _IO_off_t, int));
extern void _IO_file_finish __P((_IO_FILE*, int));
extern void _IO_file_init __P ((_IO_FILE *));
extern _IO_FILE* _IO_file_attach __P ((_IO_FILE *, int));
extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *));
extern _IO_ssize_t _IO_file_write __P ((_IO_FILE *, const void *,
_IO_ssize_t));
extern _IO_ssize_t _IO_file_read __P ((_IO_FILE *, void *, _IO_ssize_t));
extern int _IO_file_sync __P ((_IO_FILE *));
extern int _IO_file_close_it __P ((_IO_FILE *));
extern _IO_fpos_t _IO_file_seek __P ((_IO_FILE *, _IO_off_t, int));
extern void _IO_file_finish __P ((_IO_FILE *, int));
/* Jumptable functions for proc_files. */
extern _IO_FILE* _IO_proc_open __P((_IO_FILE*, const char*, const char *));
extern int _IO_proc_close __P((_IO_FILE*));
extern _IO_FILE* _IO_proc_open __P ((_IO_FILE *, const char *, const char *));
extern int _IO_proc_close __P ((_IO_FILE *));
/* Jumptable functions for strfiles. */
extern int _IO_str_underflow __P((_IO_FILE*));
extern int _IO_str_overflow __P((_IO_FILE *, int));
extern int _IO_str_pbackfail __P((_IO_FILE*, int));
extern _IO_fpos_t _IO_str_seekoff __P((_IO_FILE*,_IO_off_t,int,int));
extern void _IO_str_finish __P ((_IO_FILE*, int));
extern int _IO_str_underflow __P ((_IO_FILE *));
extern int _IO_str_overflow __P ((_IO_FILE *, int));
extern int _IO_str_pbackfail __P ((_IO_FILE *, int));
extern _IO_fpos_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
extern void _IO_str_finish __P ((_IO_FILE *, int));
/* Other strfile functions */
extern void _IO_str_init_static __P((_IO_FILE *, char*, int, char*));
extern void _IO_str_init_readonly __P((_IO_FILE *, const char*, int));
extern _IO_ssize_t _IO_str_count __P ((_IO_FILE*));
extern void _IO_str_init_static __P ((_IO_FILE *, char *, int, char *));
extern void _IO_str_init_readonly __P ((_IO_FILE *, const char *, int));
extern _IO_ssize_t _IO_str_count __P ((_IO_FILE *));
extern int _IO_vasprintf __P ((char **result_ptr, __const char *format,
_IO_va_list args));
@ -377,66 +363,66 @@ extern int _IO_vsnprintf __P ((char *string, _IO_size_t maxlen,
__const char *format, _IO_va_list args));
extern _IO_size_t _IO_getline __P((_IO_FILE*,char*,_IO_size_t,int,int));
extern _IO_ssize_t _IO_getdelim __P((char**, _IO_size_t*, int, _IO_FILE*));
extern double _IO_strtod __P((const char *, char **));
extern char * _IO_dtoa __P((double __d, int __mode, int __ndigits,
int *__decpt, int *__sign, char **__rve));
extern int _IO_outfloat __P((double __value, _IO_FILE *__sb, int __type,
int __width, int __precision, int __flags,
int __sign_mode, int __fill));
extern _IO_size_t _IO_getline __P ((_IO_FILE *,char *, _IO_size_t, int, int));
extern _IO_ssize_t _IO_getdelim __P ((char **, _IO_size_t *, int, _IO_FILE *));
extern double _IO_strtod __P ((const char *, char **));
extern char *_IO_dtoa __P ((double __d, int __mode, int __ndigits,
int *__decpt, int *__sign, char **__rve));
extern int _IO_outfloat __P ((double __value, _IO_FILE *__sb, int __type,
int __width, int __precision, int __flags,
int __sign_mode, int __fill));
extern _IO_FILE *_IO_list_all;
extern void (*_IO_cleanup_registration_needed) __P ((void));
#ifndef EOF
#define EOF (-1)
# define EOF (-1)
#endif
#ifndef NULL
#if defined __GNUG__ && \
# if defined __GNUG__ && \
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
#define NULL (__null)
#else
#if !defined(__cplusplus)
#define NULL ((void*)0)
#else
#define NULL (0)
#endif
#endif
# define NULL (__null)
# else
# if !defined(__cplusplus)
# define NULL ((void*)0)
# else
# define NULL (0)
# endif
# endif
#endif
#if _G_HAVE_MMAP
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/param.h>
# include <unistd.h>
# include <fcntl.h>
# include <sys/mman.h>
# include <sys/param.h>
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
#define MAP_ANONYMOUS MAP_ANON
#endif
# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
# define MAP_ANONYMOUS MAP_ANON
# endif
#if !defined(MAP_ANONYMOUS) || !defined(EXEC_PAGESIZE)
#undef _G_HAVE_MMAP
#define _G_HAVE_MMAP 0
#endif
# if !defined(MAP_ANONYMOUS) || !defined(EXEC_PAGESIZE)
# undef _G_HAVE_MMAP
# define _G_HAVE_MMAP 0
# endif
#endif /* _G_HAVE_MMAP */
#if _G_HAVE_MMAP
#ifdef _LIBC
# ifdef _LIBC
/* When using this code in the GNU libc we must not pollute the name space. */
#define mmap __mmap
#define munmap __munmap
#endif
# define mmap __mmap
# define munmap __munmap
# endif
#define ROUND_TO_PAGE(_S) \
# define ROUND_TO_PAGE(_S) \
(((_S) + EXEC_PAGESIZE - 1) & ~(EXEC_PAGESIZE - 1))
#define FREE_BUF(_B, _S) \
# define FREE_BUF(_B, _S) \
munmap ((_B), ROUND_TO_PAGE (_S))
#define ALLOC_BUF(_B, _S, _R) \
# define ALLOC_BUF(_B, _S, _R) \
do { \
(_B) = (char *) mmap (0, ROUND_TO_PAGE (_S), \
PROT_READ | PROT_WRITE, \
@ -447,9 +433,9 @@ extern void (*_IO_cleanup_registration_needed) __P ((void));
#else /* _G_HAVE_MMAP */
#define FREE_BUF(_B, _S) \
# define FREE_BUF(_B, _S) \
free(_B)
#define ALLOC_BUF(_B, _S, _R) \
# define ALLOC_BUF(_B, _S, _R) \
do { \
(_B) = (char*)malloc(_S); \
if ((_B) == NULL) \
@ -459,15 +445,15 @@ extern void (*_IO_cleanup_registration_needed) __P ((void));
#endif /* _G_HAVE_MMAP */
#ifndef OS_FSTAT
#define OS_FSTAT fstat
# define OS_FSTAT fstat
#endif
struct stat;
extern _IO_ssize_t _IO_read __P((int, void*, _IO_size_t));
extern _IO_ssize_t _IO_write __P((int, const void*, _IO_size_t));
extern _IO_off_t _IO_lseek __P((int, _IO_off_t, int));
extern int _IO_close __P((int));
extern int _IO_fstat __P((int, struct stat *));
extern int _IO_vscanf __P((const char *, _IO_va_list));
extern _IO_ssize_t _IO_read __P ((int, void *, _IO_size_t));
extern _IO_ssize_t _IO_write __P ((int, const void *, _IO_size_t));
extern _IO_off_t _IO_lseek __P ((int, _IO_off_t, int));
extern int _IO_close __P ((int));
extern int _IO_fstat __P ((int, struct stat *));
extern int _IO_vscanf __P ((const char *, _IO_va_list));
/* Operations on _IO_fpos_t.
Normally, these are trivial, but we provide hooks for configurations
@ -476,34 +462,32 @@ extern int _IO_vscanf __P((const char *, _IO_va_list));
/* _IO_pos_BAD is an _IO_fpos_t value indicating error, unknown, or EOF. */
#ifndef _IO_pos_BAD
#define _IO_pos_BAD ((_IO_fpos_t)(-1))
# define _IO_pos_BAD ((_IO_fpos_t) -1)
#endif
/* _IO_pos_as_off converts an _IO_fpos_t value to an _IO_off_t value. */
#ifndef _IO_pos_as_off
#define _IO_pos_as_off(__pos) ((_IO_off_t)(__pos))
# define _IO_pos_as_off(__pos) ((_IO_off_t) (__pos))
#endif
/* _IO_pos_adjust adjust an _IO_fpos_t by some number of bytes. */
#ifndef _IO_pos_adjust
#define _IO_pos_adjust(__pos, __delta) ((__pos) += (__delta))
# define _IO_pos_adjust(__pos, __delta) ((__pos) += (__delta))
#endif
/* _IO_pos_0 is an _IO_fpos_t value indicating beginning of file. */
#ifndef _IO_pos_0
#define _IO_pos_0 ((_IO_fpos_t)0)
# define _IO_pos_0 ((_IO_fpos_t) 0)
#endif
#ifdef __cplusplus
}
#endif
__END_DECLS
#ifdef _IO_MTSAFE_IO
/* check following! */
#define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD, \
0, 0, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
#else
/* check following! */
#define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD }
#endif
@ -511,57 +495,56 @@ extern int _IO_vscanf __P((const char *, _IO_va_list));
/* VTABLE_LABEL defines NAME as of the CLASS class.
CNLENGTH is strlen(#CLASS). */
#ifdef __GNUC__
#if _G_VTABLE_LABEL_HAS_LENGTH
#define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
# if _G_VTABLE_LABEL_HAS_LENGTH
# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CNLENGTH #CLASS);
#else
#define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
# else
# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CLASS);
#endif
# endif
#endif /* __GNUC__ */
#if !defined(builtinbuf_vtable) && defined(__cplusplus)
#ifdef __GNUC__
# ifdef __GNUC__
VTABLE_LABEL(builtinbuf_vtable, builtinbuf, 10)
#else
#if _G_VTABLE_LABEL_HAS_LENGTH
#define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##10builtinbuf
#else
#define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##builtinbuf
#endif
#endif
# else
# if _G_VTABLE_LABEL_HAS_LENGTH
# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##10builtinbuf
# else
# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##builtinbuf
# endif
# endif
#endif /* !defined(builtinbuf_vtable) && defined(__cplusplus) */
#if defined(__STDC__) || defined(__cplusplus)
#define _IO_va_start(args, last) va_start(args, last)
# define _IO_va_start(args, last) va_start(args, last)
#else
#define _IO_va_start(args, last) va_start(args)
# define _IO_va_start(args, last) va_start(args)
#endif
extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
#if 1
#define COERCE_FILE(FILE) /* Nothing */
# define COERCE_FILE(FILE) /* Nothing */
#else
/* This is part of the kludge for binary compatibility with old stdio. */
#define COERCE_FILE(FILE) \
# define COERCE_FILE(FILE) \
(((FILE)->_IO_file_flags & _IO_MAGIC_MASK) == _OLD_MAGIC_MASK \
&& (FILE) = *(FILE**)&((int*)fp)[1])
#endif
#ifdef EINVAL
#define MAYBE_SET_EINVAL __set_errno (EINVAL)
# define MAYBE_SET_EINVAL __set_errno (EINVAL)
#else
#define MAYBE_SET_EINVAL /* nothing */
# define MAYBE_SET_EINVAL /* nothing */
#endif
#ifdef IO_DEBUG
#define CHECK_FILE(FILE,RET) \
# define CHECK_FILE(FILE, RET) \
if ((FILE) == NULL) { MAYBE_SET_EINVAL; return RET; } \
else { COERCE_FILE(FILE); \
if (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
{ MAYBE_SET_EINVAL; return RET; }}
#else
#define CHECK_FILE(FILE,RET) \
COERCE_FILE(FILE)
# define CHECK_FILE(FILE, RET) COERCE_FILE (FILE)
#endif

View File

@ -1,5 +1,5 @@
/* Print output of stream to given obstack.
Copyright (C) 1996 Free Software Foundation, Inc.
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@ -148,7 +148,9 @@ _IO_obstack_vprintf (struct obstack *obstack, const char *format, va_list args)
return result;
}
#ifdef weak_alias
weak_alias (_IO_obstack_vprintf, obstack_vprintf)
#endif
int
@ -161,4 +163,6 @@ _IO_obstack_printf (struct obstack *obstack, const char *format, ...)
va_end (ap);
return result;
}
#ifdef weak_alias
weak_alias (_IO_obstack_printf, obstack_printf)
#endif

View File

@ -1,9 +1,34 @@
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"
#include <errno.h>
int
pclose(fp)
pclose (fp)
FILE *fp;
{
#if 0
@ -12,5 +37,5 @@ pclose(fp)
if (fp is not a proc_file)
return -1;
#endif
return _IO_fclose(fp);
return _IO_fclose (fp);
}

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"
@ -29,13 +30,13 @@ the executable file might be covered by the GNU General Public License. */
int
_IO_peekc_locked (fp)
FILE *fp;
_IO_FILE *fp;
{
int result;
CHECK_FILE (fp, EOF);
__libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
result = _IO_peekc_unlocked (fp);
__libc_cleanup_region_end (1);
_IO_cleanup_region_end (1);
return result;
}

View File

@ -28,11 +28,15 @@ _IO_putc (c, fp)
{
int result;
CHECK_FILE (fp, EOF);
__libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
result = _IO_putc_unlocked (c, fp);
__libc_cleanup_region_end (1);
_IO_cleanup_region_end (1);
return result;
}
#undef putc
#ifdef weak_alias
weak_alias (_IO_putc, putc)
#endif

View File

@ -26,10 +26,10 @@ putchar (c)
int c;
{
int result;
__libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
_IO_stdout);
_IO_flockfile (_IO_stdout);
result = _IO_putc_unlocked (c, _IO_stdout);
__libc_cleanup_region_end (1);
_IO_cleanup_region_end (1);
return result;
}

View File

@ -1,36 +1,38 @@
/* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"
void
rewind (fp)
_IO_FILE* fp;
_IO_FILE *fp;
{
CHECK_FILE (fp, );
__libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
_IO_rewind (fp);
__libc_cleanup_region_end (1);
_IO_cleanup_region_end (1);
}

View File

@ -1,25 +1,27 @@
/* Copyright (C) 1993 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation
/* Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
/* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr

View File

@ -1,12 +1,37 @@
/* Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"
/* Define non-macro versions of stdin/stdout/stderr,
* for use by debuggers. */
/* Define non-macro versions of stdin/stdout/stderr, for use by
debuggers. */
#undef stdin
#undef stdout
#undef stderr
FILE* stdin = &_IO_stdin_.file;
FILE* stdout = &_IO_stdout_.file;
FILE* stderr = &_IO_stderr_.file;
FILE *stdin = &_IO_stdin_.file;
FILE *stdout = &_IO_stdout_.file;
FILE *stderr = &_IO_stderr_.file;

View File

@ -1,34 +1,35 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include <libio.h>
#ifdef TODO
Merge into libio.h ?
#endif
typedef void *(*_IO_alloc_type) __P((_IO_size_t));
typedef void (*_IO_free_type) __P((void*));
typedef void *(*_IO_alloc_type) __P ((_IO_size_t));
typedef void (*_IO_free_type) __P ((void*));
struct _IO_str_fields
{

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "strfile.h"
#include "libioP.h"
@ -59,11 +60,14 @@ the executable file might be covered by the GNU General Public License. */
#endif
void
DEFUN(_IO_str_init_static, (fp, ptr, size, pstart),
_IO_FILE *fp AND char *ptr AND int size AND char *pstart)
_IO_str_init_static (fp, ptr, size, pstart)
_IO_FILE *fp;
char *ptr;
int size;
char *pstart;
{
if (size == 0)
size = strlen(ptr);
size = strlen (ptr);
else if (size < 0)
{
/* If size is negative 'the characters are assumed to
@ -80,7 +84,7 @@ DEFUN(_IO_str_init_static, (fp, ptr, size, pstart),
size += s;
}
}
_IO_setb(fp, ptr, ptr+size, 0);
_IO_setb (fp, ptr, ptr + size, 0);
fp->_IO_write_base = ptr;
fp->_IO_read_base = ptr;
@ -98,20 +102,23 @@ DEFUN(_IO_str_init_static, (fp, ptr, size, pstart),
fp->_IO_read_end = ptr+size;
}
/* A null _allocate_buffer function flags the strfile as being static. */
(((_IO_strfile*)(fp))->_s._allocate_buffer) = (_IO_alloc_type)0;
(((_IO_strfile *) fp)->_s._allocate_buffer) = (_IO_alloc_type)0;
}
void
DEFUN(_IO_str_init_readonly, (fp, ptr, size),
_IO_FILE *fp AND const char *ptr AND int size)
_IO_str_init_readonly (fp, ptr, size)
_IO_FILE *fp;
const char *ptr;
int size;
{
_IO_str_init_static (fp, (char*)ptr, size, NULL);
_IO_str_init_static (fp, (char *) ptr, size, NULL);
fp->_IO_file_flags |= _IO_NO_WRITES;
}
int
DEFUN(_IO_str_overflow, (fp, c),
register _IO_FILE* fp AND int c)
_IO_str_overflow (fp, c)
_IO_FILE *fp;
int c;
{
int flush_only = c == EOF;
_IO_size_t pos;
@ -124,7 +131,7 @@ DEFUN(_IO_str_overflow, (fp, c),
fp->_IO_read_ptr = fp->_IO_read_end;
}
pos = fp->_IO_write_ptr - fp->_IO_write_base;
if (pos >= (_IO_size_t) (_IO_blen(fp) + flush_only))
if (pos >= (_IO_size_t) (_IO_blen (fp) + flush_only))
{
if (fp->_flags & _IO_USER_BUF) /* not allowed to enlarge */
return EOF;
@ -132,9 +139,9 @@ DEFUN(_IO_str_overflow, (fp, c),
{
char *new_buf;
char *old_buf = fp->_IO_buf_base;
_IO_size_t new_size = 2 * _IO_blen(fp) + 100;
_IO_size_t new_size = 2 * _IO_blen (fp) + 100;
new_buf
= (char*)(*((_IO_strfile*)fp)->_s._allocate_buffer)(new_size);
= (char *) (*((_IO_strfile *) fp)->_s._allocate_buffer) (new_size);
if (new_buf == NULL)
{
/* __ferror(fp) = 1; */
@ -142,16 +149,16 @@ DEFUN(_IO_str_overflow, (fp, c),
}
if (fp->_IO_buf_base)
{
memcpy(new_buf, old_buf, _IO_blen(fp));
(*((_IO_strfile*)fp)->_s._free_buffer)(fp->_IO_buf_base);
memcpy (new_buf, old_buf, _IO_blen (fp));
(*((_IO_strfile *) fp)->_s._free_buffer) (fp->_IO_buf_base);
/* Make sure _IO_setb won't try to delete _IO_buf_base. */
fp->_IO_buf_base = NULL;
}
#if 0
if (lenp == &LEN(fp)) /* use '\0'-filling */
memset(new_buf + pos, 0, blen() - pos);
memset (new_buf + pos, 0, blen() - pos);
#endif
_IO_setb(fp, new_buf, new_buf + new_size, 1);
_IO_setb (fp, new_buf, new_buf + new_size, 1);
fp->_IO_read_base = new_buf + (fp->_IO_read_base - old_buf);
fp->_IO_read_ptr = new_buf + (fp->_IO_read_ptr - old_buf);
fp->_IO_read_end = new_buf + (fp->_IO_read_end - old_buf);
@ -170,8 +177,8 @@ DEFUN(_IO_str_overflow, (fp, c),
}
int
DEFUN(_IO_str_underflow, (fp),
register _IO_FILE* fp)
_IO_str_underflow (fp)
_IO_FILE *fp;
{
if (fp->_IO_write_ptr > fp->_IO_read_end)
fp->_IO_read_end = fp->_IO_write_ptr;
@ -190,19 +197,22 @@ DEFUN(_IO_str_underflow, (fp),
/* The size of the valid part of the buffer. */
_IO_ssize_t
DEFUN(_IO_str_count, (fp),
register _IO_FILE *fp)
_IO_str_count (fp)
_IO_FILE *fp;
{
return (fp->_IO_write_end > fp->_IO_read_end ? fp->_IO_write_end
: fp->_IO_read_end)
- fp->_IO_read_base;
return ((fp->_IO_write_end > fp->_IO_read_end
? fp->_IO_write_end : fp->_IO_read_end)
- fp->_IO_read_base);
}
_IO_pos_t
DEFUN(_IO_str_seekoff, (fp, offset, dir, mode),
register _IO_FILE *fp AND _IO_off_t offset AND int dir AND int mode)
_IO_str_seekoff (fp, offset, dir, mode)
_IO_FILE *fp;
_IO_off_t offset;
int dir;
int mode;
{
_IO_ssize_t cur_size = _IO_str_count(fp);
_IO_ssize_t cur_size = _IO_str_count (fp);
_IO_pos_t new_pos = EOF;
/* Move the get pointer, if requested. */
@ -219,7 +229,7 @@ DEFUN(_IO_str_seekoff, (fp, offset, dir, mode),
default: /* case _IO_seek_set: */
break;
}
if (offset < 0 || (_IO_ssize_t)offset > cur_size)
if (offset < 0 || (_IO_ssize_t) offset > cur_size)
return EOF;
fp->_IO_read_ptr = fp->_IO_read_base + offset;
fp->_IO_read_end = fp->_IO_read_base + cur_size;
@ -240,7 +250,7 @@ DEFUN(_IO_str_seekoff, (fp, offset, dir, mode),
default: /* case _IO_seek_set: */
break;
}
if (offset < 0 || (_IO_ssize_t)offset > cur_size)
if (offset < 0 || (_IO_ssize_t) offset > cur_size)
return EOF;
fp->_IO_write_ptr = fp->_IO_write_base + offset;
new_pos = offset;
@ -249,26 +259,29 @@ DEFUN(_IO_str_seekoff, (fp, offset, dir, mode),
}
int
DEFUN(_IO_str_pbackfail, (fp, c),
register _IO_FILE *fp AND int c)
_IO_str_pbackfail (fp, c)
_IO_FILE *fp;
int c;
{
if ((fp->_flags & _IO_NO_WRITES) && c != EOF)
return EOF;
return _IO_default_pbackfail(fp, c);
return _IO_default_pbackfail (fp, c);
}
void
DEFUN (_IO_str_finish, (fp, dummy),
register _IO_FILE* fp AND int dummy)
_IO_str_finish (fp, dummy)
_IO_FILE *fp;
int dummy;
{
if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
(((_IO_strfile*)fp)->_s._free_buffer)(fp->_IO_buf_base);
(((_IO_strfile *) fp)->_s._free_buffer) (fp->_IO_buf_base);
fp->_IO_buf_base = NULL;
_IO_default_finish(fp, 0);
_IO_default_finish (fp, 0);
}
struct _IO_jump_t _IO_str_jumps = {
struct _IO_jump_t _IO_str_jumps =
{
JUMP_INIT_DUMMY,
JUMP_INIT(finish, _IO_str_finish),
JUMP_INIT(overflow, _IO_str_overflow),

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1995 Free Software Foundation
/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include <malloc.h>
#include "libioP.h"
@ -42,19 +43,19 @@ _IO_vasprintf (result_ptr, format, args)
_IO_lock_t lock;
#endif
int ret;
string = malloc (init_string_size);
string = (char *) malloc (init_string_size);
if (string == NULL)
return -1;
#ifdef _IO_MTSAFE_IO
sf._sbf._f._lock = &lock;
#endif
_IO_init((_IO_FILE*)&sf, 0);
_IO_JUMPS((_IO_FILE*)&sf) = &_IO_str_jumps;
_IO_str_init_static ((_IO_FILE*)&sf, string, init_string_size, string);
_IO_init ((_IO_FILE *) &sf, 0);
_IO_JUMPS ((_IO_FILE *) &sf) = &_IO_str_jumps;
_IO_str_init_static ((_IO_FILE *) &sf, string, init_string_size, string);
sf._sbf._f._flags &= ~_IO_USER_BUF;
sf._s._allocate_buffer = (_IO_alloc_type) malloc;
sf._s._free_buffer = (_IO_free_type) free;
ret = _IO_vfprintf((_IO_FILE*)&sf, format, args);
ret = _IO_vfprintf ((_IO_FILE *) &sf, format, args);
if (ret < 0)
return ret;
*result_ptr = (char *) realloc (sf._sbf._f._IO_buf_base,
@ -65,4 +66,7 @@ _IO_vasprintf (result_ptr, format, args)
(*result_ptr)[sf._sbf._f._IO_write_ptr-sf._sbf._f._IO_write_base] = '\0';
return ret;
}
#ifdef weak_alias
weak_alias (_IO_vasprintf, vasprintf)
#endif

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1993 Free Software Foundation
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "stdio.h"
@ -34,4 +35,7 @@ _IO_vscanf (format, args)
{
return _IO_vfscanf (_IO_stdin, format, args, NULL);
}
#ifdef weak_alias
weak_alias (_IO_vscanf, vscanf)
#endif

View File

@ -1,26 +1,27 @@
/*
Copyright (C) 1994, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This 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 General Public License for more details.
This 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include "strfile.h"
@ -35,8 +36,12 @@ typedef struct
} _IO_strnfile;
static int _IO_strn_overflow __P ((_IO_FILE *fp, int c));
static int
_IO_strn_overflow (_IO_FILE* fp, int c)
_IO_strn_overflow (fp, c)
_IO_FILE *fp;
int c;
{
/* When we come to here this means the user supplied buffer is
filled. But since we must return the number of characters which
@ -70,7 +75,8 @@ _IO_strn_overflow (_IO_FILE* fp, int c)
}
static struct _IO_jump_t _IO_strn_jumps = {
static struct _IO_jump_t _IO_strn_jumps =
{
JUMP_INIT_DUMMY,
JUMP_INIT(finish, _IO_str_finish),
JUMP_INIT(overflow, _IO_strn_overflow),
@ -123,5 +129,8 @@ _IO_vsnprintf (string, maxlen, format, args)
*sf.f._sbf._f._IO_write_ptr = '\0';
return ret;
}
#ifdef weak_alias
weak_alias (_IO_vsnprintf, __vsnprintf)
weak_alias (_IO_vsnprintf, vsnprintf)
#endif

View File

@ -122,6 +122,8 @@ of the GNU C Library.
* Extended Characters:: Support for extended character sets.
* Locales:: The country and language can affect
the behavior of library functions.
* Message Translation:: How to make the program speak the users
language.
* Searching and Sorting:: General searching and sorting functions.
* Pattern Matching:: Matching wildcards and regular expressions,
and shell-style ``word expansion''.
@ -314,6 +316,11 @@ Locales and Internationalization
* Standard Locales:: Locale names available on all systems.
* Numeric Formatting:: How to format numbers for the chosen locale.
Message Translation
* Message catalogs a la X/Open:: The @code{catgets} family of functions.
* The Uniforum approach:: The @code{gettext} family of functions.
Searching and Sorting
* Comparison Functions:: Defining how to compare two objects.
@ -975,6 +982,7 @@ Porting the GNU C Library
@include time.texi
@include mbyte.texi
@include locale.texi
@include message.texi
@include setjmp.texi
@include signal.texi
@include startup.texi

View File

@ -1,4 +1,4 @@
@node Locales, Searching and Sorting, Extended Characters, Top
@node Locales, Message Translation, Extended Characters, Top
@chapter Locales and Internationalization
Different countries and cultures have varying conventions for how to

1185
manual/message.texi Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
@node Searching and Sorting, Pattern Matching, Locales, Top
@node Searching and Sorting, Pattern Matching, Message Translation, Top
@chapter Searching and Sorting
This chapter describes functions for searching and sorting arrays of

View File

@ -278,9 +278,9 @@ character, since this is assumed to terminate the string.
@menu
* Environment Access:: How to get and set the values of
environment variables.
environment variables.
* Standard Environment:: These environment variables have
standard interpretations.
standard interpretations.
@end menu
@node Environment Access
@ -290,7 +290,9 @@ character, since this is assumed to terminate the string.
The value of an environment variable can be accessed with the
@code{getenv} function. This is declared in the header file
@file{stdlib.h}.
@file{stdlib.h}. All of the following functions can be safely used in
multi-threaded programs. It is made sure that concurrent modifications
to the environment do not lead to errors.
@pindex stdlib.h
@comment stdlib.h
@ -314,11 +316,62 @@ definition is added to the environment. Otherwise, the @var{string} is
interpreted as the name of an environment variable, and any definition
for this variable in the environment is removed.
The GNU library provides this function for compatibility with SVID; it
may not be available in other systems.
This function is part of the extended Unix interface. Since it was also
available in old SVID libraries you should define either
@var{_XOPEN_SOURCE} or @var{_SVID_SOURCE} before including any header.
@end deftypefun
@comment stdlib.h
@comment BSD
@deftypefun int setenv (const char *@var{name}, const char *@var{value}, int @var{replace})
The @code{setenv} function can be used to add a new definition to the
environment. The entry with the name @var{name} is replaced by the
value @samp{@var{name}=@var{value}}. Please note that this is also true
if @var{value} is the empty string. A null pointer for the @var{value}
parameter is illegal. If the environment already contains an entry with
key @var{name} the @var{replace} parameter controls the action. If
replace is zero, nothing happens. otherwise the old entry is replaced
by the new one.
Please note that you cannot remove an entry completely using this function.
This function is part of the BSD library. The GNU C Library provides
this function for compatibility but it may not be available on other
systems.
@end deftypefun
@comment stdlib.h
@comment BSD
@deftypefun void unsetenv (const char *@var{name})
Using this function one can remove an entry completely from the
environment. If the environment contains an entry with the key
@var{name} this whole entry is removed. A call to this function is
equivalent to a call to @code{putenv} when the @var{value} part of the
string is empty.
This function is part of the BSD library. The GNU C Library provides
this function for compatibility but it may not be available on other
systems.
@end deftypefun
There is one more function to modify the whole environment. This
function is said to be used in the POSIX.9 (POSIX bindings for Fortran
77) and so one should expect it did made it into POSIX.1. But this
never happened. But we still provide this function as a GNU extension
to enable writing standard compliant Fortran environments.
@comment stdlib.h
@comment GNU
@deftypefun int clearenv (void)
The @code{clearenv} function removes all entries from the environment.
Using @code{putenv} and @code{setenv} new entries can be added again
later.
If the function is successful it returns @code{0}. Otherwise the return
value is nonzero.
@end deftypefun
@c !!! BSD function setenv
You can deal directly with the underlying representation of environment
objects to add more variables to the environment (for example, to
@ -444,6 +497,14 @@ attribute category environment variables, or for the @code{LANG}
environment variable.
@end ignore
@item LC_ALL
@cindex LC_ALL environment variable
If this environment variable is set it overrides the selection for all
the locales done using the other @code{LC_*} environment variables. The
value of the other @code{LC_*} environment variables is simply ignored
in this case.
@item LC_COLLATE
@cindex LC_COLLATE environment variable
@ -455,6 +516,12 @@ This specifies what locale to use for string sorting.
This specifies what locale to use for character sets and character
classification.
@item LC_MESSAGES
@cindex LC_MESSAGES environment variable
This specifies what locale to use for printing messages and to parse
reponses.
@item LC_MONETARY
@cindex LC_MONETARY environment variable
@ -470,6 +537,12 @@ This specifies what locale to use for formatting numbers.
This specifies what locale to use for formatting date/time values.
@item NLSPATH
@cindex NLSPATH environment variable
This specifies the directories in which the @code{catopen} function
looks for message translation catalogs.
@item _POSIX_OPTION_ORDER
@cindex _POSIX_OPTION_ORDER environment variable.

View File

@ -365,7 +365,7 @@ string has the same limitations as any block of memory allocated using
@code{alloca}.
For obvious reasons @code{strdupa} is implemented only as a macro. I.e.,
you cannot get the address of this function. Despite this limitations
you cannot get the address of this function. Despite this limitation
it is a useful function. The following code shows a situation where
using @code{malloc} would be a lot more expensive.
@ -374,7 +374,7 @@ using @code{malloc} would be a lot more expensive.
@end smallexample
Please note that calling @code{strtok} using @var{path} directly is
illegal.
invalid.
This function is only available if GNU CC is used.
@end deftypefun

View File

@ -80,9 +80,7 @@ tests = test-float test-double $(test-longdouble-$(long-double-fcts)) \
test-ifloat test-idouble test-matherr test-fenv
# We do the `long double' tests only if this data type is available and
# distrinct from `double'.
#
# XXX This test is disabled for now since the functions are too buggy.
#test-longdouble-yes = test-ldouble test-ildoubl
test-longdouble-yes = test-ldouble test-ildoubl
CFLAGS-test-float.c = -fno-inline
CFLAGS-test-double.c = -fno-inline

Some files were not shown because too many files have changed in this diff Show More