aboutsummaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-12-15 02:15:29 +0000
committerUlrich Drepper <drepper@redhat.com>1996-12-15 02:15:29 +0000
commit68dbb3a69e78e24a778c6602c8cc91d715839d08 (patch)
tree2201a2cfe38cf2817b6dfd37415dac21c7a41b2f /libio
parentf8b87ef0d47ea0db7304a9c59d5479aebdaea347 (diff)
downloadglibc-68dbb3a69e78e24a778c6602c8cc91d715839d08.zip
glibc-68dbb3a69e78e24a778c6602c8cc91d715839d08.tar.gz
glibc-68dbb3a69e78e24a778c6602c8cc91d715839d08.tar.bz2
update from main archive 961214cvs/libc-961215
Sun Dec 15 01:53:20 1996 Ulrich Drepper <drepper@cygnus.com> * Makefile (subdirs): Change crypt to md5-crypt. * crypt/Makefile, crypt/md5-crypt.c, crypt/md5.c, crypt/md5.h, crypt/md5c-test.c, crypt/md5test.c: Move to new directory md5-crypt. * sysdeps/unix/sysv/linux/configure.in: Refer to linuxthreads and crypt instead of LinuxThreads and des-crypt. * Makefile (subdirs): Add nss back. * sysdeps/unix/inet/Subdirs: Move nis to end of file to fulfill dependencies. * libio/iofclose.c: Implement fclose(NULL) as closing all streams. * stdio-common/Makefile (routines): Add fcloseall. * stdio-common/fcloseall.c: New file. * sysdeps/generic/abort.c: Make implementation POSIX.1 compatible. * sysdeps/mach/libc-lock.h: Add definition of __libc_lock_trylock. * sysdeps/stub/libc-lock.h: Define __libc_lock_trylock to always return 0. * stdio-common/printf.h: Define MIN and MAX only if not already defined. * stdio-common/vfprintf.c: Set errno to EBADF if stream does not allow writing. Required by POSIX.1. * libio/libioP.h (CHECK_FILE): Use MAYBE_SET_EINVAL instead of assignment. * interp.c: Update copyright. * libio/clearerr.c: Likewise. * libio/ioseekoff.c: Likewise. * libio/ioseekpos.c: Likewise. * stdio/fclose.c: Likewise. * stdio/fflus.c: Likewise. * libio/libio.h [!_IO_MTSAFE_IO]: Define _IO_cleanup_region_start and _IO_cleanup_region_end as empty. * libio/fgetc.c: Use _IO_cleanup_region_start and _IO_cleanup_region_end instead of __libc_cleanup_region_start and __libc_cleanup_region_end. * libio/fputc.c: Likewise. * libio/freopen.c: Likewise. * libio/fseek.c: Likewise. * libio/getc.c: Likewise. * libio/getchar.c: Likewise. * libio/iofclose.c: Likewise. * libio/iofflush.c: Likewise. * libio/iofgetpos.c: Likewise. * libio/iofgets.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/iogets.c: Likewise. * libio/ioputs.c: Likewise. * libio/iosetbuffer.c: Likewise. * libio/iosetvbuf.c: Likewise. * libio/ioungetc.c: Likewise. * libio/iovspintf.c: Use cleanup handler to make sure no dangling locks can stay over. * libio/iovsscanf.c: Likewise. * libio/genops.c: Use _IO_lock_init_recursive and _IO_lock_fini instead of __libc_lock_init_recursive and __libc_lock_fini. * libio/filedoalloc.c: Only use __isatty when compiling GNU libc. Otherwise use isatty. * libio/fileops.c: Likewise for __open and open. * login/utmp_file.c (getutent_r_file): Use fcntl instead of flock. * nis/ypclnt.h: Add more casts to prevent warnings. * nss/Makefile (services): Remove dns. (libnss_dns, libnss_dns-inhibit-o): Remove definition. ($(objpfx)libnss_dns.so): Removed. * nss/nss_dns/dns-host.c, nss/nss_dns/dns-network.c: Moved to... * resolv/nss_dns: ...here. * resolv/Makefile (extra-libs): Add libnss_dns. (libnss_dns-routines, libnss_dns-inhibit-o): Define as in nss/Makefile. * nss/XXX-lookup.c: Call __nss_database_lookup with new argument specifying alternate name for entry in /etc/nsswitch.conf * nss/nsswitch.c: If no entry with primary name is found in /etc/nsswitch.conf try alternate name if given. * nss/nsswitch.h: Add new parameter in prototype for __nss_database_lookup. * nss/spwd-lookup.c: Provide alternative entry name to look for. This makes our NSS compatible with Solaris' nsswitch.conf files. * string/tst-strlen.c: Change all counting variables to type size_t to prevent warnings. * sysdeps/posix/fpathconf.c: Update copyright. * sysdeps/posix/pathconf.c: Don't call fpathconf to do the work. Opening the file at this path may fail if it is a FIFO or pipe. These changes make the time implementation POSIX.1 compliant. * time/localtime.c (__localtime_r): Always call __tzset not only if __tzset_run is zero. * time/strftime.c: Add definition of memset_space to help to reduce for systems which have memset. (strftime): Don't use tm_zone member of argument for zone name. Instead always use tzname[]. Call tzset() as required by POSIX.1 before any action. * time/tzset.c (tzset): Set tzname[] as required by POSIX.1. Remove global variable __tzset_run. __tzset is now called always when a dependent function is used. (__tzset): Caching happens based on the contents of the environment variable TZ. Fri Dec 13 01:06:52 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/unix/sysv/linux/paths.h: Add _PATH_KLOG. Thu Dec 12 09:16:35 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * rellns-sh: Correctly handle a relative source file name. Wed Dec 11 19:18:40 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * login/utmp_file.c (setutent_file): Seek back to beginning of the file if resetting. Thu Dec 12 16:39:12 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * hurd/hurdinit.c (map0): Delete function. Don't do this on _hurd_preinit_hook. * hurd/hurdstartup.c (_hurd_startup): Map page zero redzone here.
Diffstat (limited to 'libio')
-rw-r--r--libio/clearerr.c26
-rw-r--r--libio/fgetc.c4
-rw-r--r--libio/filedoalloc.c7
-rw-r--r--libio/fileops.c17
-rw-r--r--libio/fputc.c4
-rw-r--r--libio/freopen.c4
-rw-r--r--libio/fseek.c4
-rw-r--r--libio/genops.c4
-rw-r--r--libio/getc.c4
-rw-r--r--libio/getchar.c5
-rw-r--r--libio/iofclose.c34
-rw-r--r--libio/iofflush.c5
-rw-r--r--libio/iofgetpos.c4
-rw-r--r--libio/iofgets.c4
-rw-r--r--libio/iofputs.c4
-rw-r--r--libio/iofread.c4
-rw-r--r--libio/iofsetpos.c4
-rw-r--r--libio/ioftell.c4
-rw-r--r--libio/iofwrite.c4
-rw-r--r--libio/iogetdelim.c4
-rw-r--r--libio/iogets.c8
-rw-r--r--libio/iopadn.c6
-rw-r--r--libio/ioputs.c4
-rw-r--r--libio/ioseekoff.c6
-rw-r--r--libio/ioseekpos.c6
-rw-r--r--libio/iosetbuffer.c4
-rw-r--r--libio/iosetvbuf.c4
-rw-r--r--libio/ioungetc.c4
-rw-r--r--libio/iovsprintf.c3
-rw-r--r--libio/iovsscanf.c11
-rw-r--r--libio/libio.h2
-rw-r--r--libio/libioP.h2
32 files changed, 123 insertions, 87 deletions
diff --git a/libio/clearerr.c b/libio/clearerr.c
index 9dfdb11..7c7fb93 100644
--- a/libio/clearerr.c
+++ b/libio/clearerr.c
@@ -1,20 +1,20 @@
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is 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.
+ 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. */
+ 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. */
#include "libioP.h"
#include "stdio.h"
diff --git a/libio/fgetc.c b/libio/fgetc.c
index a754c4b..25bfed5 100644
--- a/libio/fgetc.c
+++ b/libio/fgetc.c
@@ -31,9 +31,9 @@ fgetc (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_getc_unlocked (fp);
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
diff --git a/libio/filedoalloc.c b/libio/filedoalloc.c
index f36bfb3..836c56b 100644
--- a/libio/filedoalloc.c
+++ b/libio/filedoalloc.c
@@ -49,9 +49,12 @@ the executable file might be covered by the GNU General Public License. */
#include <sys/stat.h>
#ifdef __STDC__
#include <stdlib.h>
+#include <unistd.h>
#endif
+
#ifdef _LIBC
-# include <unistd.h>
+# undef isatty
+# define isatty(Fd) __isatty (Fd)
#endif
/*
@@ -100,7 +103,7 @@ DEFUN(_IO_file_doallocate, (fp),
}
ALLOC_BUF(p, size, EOF);
_IO_setb(fp, p, p+size, 1);
- if (couldbetty && __isatty (fp->_fileno))
+ if (couldbetty && isatty(fp->_fileno))
fp->_flags |= _IO_LINE_BUF;
return 1;
}
diff --git a/libio/fileops.c b/libio/fileops.c
index 3294bef..dd1f573 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -37,6 +37,11 @@ the executable file might be covered by the GNU General Public License. */
extern int errno;
#endif
+
+#ifdef _LIBC
+# define open(Name, Flags, Prot) __open ((Name), (Flags), (Prot))
+#endif
+
/* An fstream can be in at most one of put mode, get mode, or putback mode.
Putback mode is a variant of get mode.
@@ -177,7 +182,7 @@ DEFUN(_IO_file_fopen, (fp, filename, mode),
omode = O_RDWR;
read_write &= _IO_IS_APPENDING;
}
- fdesc = __open (filename, omode|oflags, oprot);
+ fdesc = open(filename, omode|oflags, oprot);
if (fdesc < 0)
return NULL;
fp->_fileno = fdesc;
@@ -223,7 +228,7 @@ DEFUN(_IO_file_setbuf, (fp, p, len),
}
/* Write TO_DO bytes from DATA to FP.
- Then mark FP has having empty buffers. */
+ Then mark FP as having empty buffers. */
int
DEFUN(_IO_do_write, (fp, data, to_do),
@@ -548,6 +553,10 @@ DEFUN(_IO_file_read, (fp, 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
+ error EINTR if this happens. There must be the possibility
+ that stream operations time out. --drepper */
if (count == -1 && errno == EINTR)
continue;
#endif
@@ -587,6 +596,10 @@ DEFUN(_IO_file_write, (f, data, n),
if (count == EOF)
{
#if 0 && defined EINTR
+ /* We must not do this optimization since POSIX.1 explicitly
+ requests that the stream operations must return with the
+ error EINTR if this happens. There must be the
+ possibility that stream operations time out. --drepper */
if (errno == EINTR)
continue;
else
diff --git a/libio/fputc.c b/libio/fputc.c
index 865ac8c..89359dc 100644
--- a/libio/fputc.c
+++ b/libio/fputc.c
@@ -32,10 +32,10 @@ fputc (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;
}
diff --git a/libio/freopen.c b/libio/freopen.c
index 0b782dd..bb0c597 100644
--- a/libio/freopen.c
+++ b/libio/freopen.c
@@ -35,9 +35,9 @@ freopen (filename, mode, fp)
CHECK_FILE (fp, NULL);
if (!(fp->_flags & _IO_IS_FILEBUF))
return NULL;
- __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_freopen (filename, mode, fp);
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
diff --git a/libio/fseek.c b/libio/fseek.c
index 61f2e92..3d4e492 100644
--- a/libio/fseek.c
+++ b/libio/fseek.c
@@ -33,9 +33,9 @@ fseek (fp, offset, whence)
{
int result;
CHECK_FILE (fp, -1);
- __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_fseek (fp, offset, whence);
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
diff --git a/libio/genops.c b/libio/genops.c
index 52b8fc3..7679445 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -466,7 +466,7 @@ DEFUN(_IO_init, (fp, flags),
fp->_markers = NULL;
fp->_cur_column = 0;
#ifdef _IO_MTSAFE_IO
- __libc_lock_init_recursive (*fp->_lock);
+ _IO_lock_init_recursive (*fp->_lock);
#endif
}
@@ -501,7 +501,7 @@ DEFUN(_IO_default_finish, (fp),
}
#ifdef _IO_MTSAFE_IO
- __libc_lock_fini (*fp->_lock);
+ _IO_lock_fini (*fp->_lock);
#endif
_IO_un_link(fp);
diff --git a/libio/getc.c b/libio/getc.c
index 0c0b6b8..eede639 100644
--- a/libio/getc.c
+++ b/libio/getc.c
@@ -33,10 +33,10 @@ _IO_getc (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_getc_unlocked (fp);
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
#undef getc
diff --git a/libio/getchar.c b/libio/getchar.c
index d54ec58..aa67559 100644
--- a/libio/getchar.c
+++ b/libio/getchar.c
@@ -31,11 +31,10 @@ int
getchar ()
{
int result;
- __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
- stdin);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, stdin);
_IO_flockfile (stdin);
result = _IO_getc_unlocked (stdin);
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
diff --git a/libio/iofclose.c b/libio/iofclose.c
index 77c7b50..79a0543 100644
--- a/libio/iofclose.c
+++ b/libio/iofclose.c
@@ -33,21 +33,31 @@ _IO_fclose (fp)
{
int status;
- CHECK_FILE(fp, EOF);
-
- __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
- _IO_flockfile (fp);
- if (fp->_IO_file_flags & _IO_IS_FILEBUF)
- status = _IO_file_close_it (fp);
+ if (fp == NULL)
+ {
+ /* Close all streams. */
+ _IO_cleanup ();
+ status = 0;
+ }
else
- status = fp->_flags & _IO_ERR_SEEN ? -1 : 0;
- _IO_FINISH (fp);
- __libc_cleanup_region_end (1);
- if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr)
{
- fp->_IO_file_flags = 0;
- free(fp);
+ CHECK_FILE(fp, EOF);
+
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_flockfile (fp);
+ if (fp->_IO_file_flags & _IO_IS_FILEBUF)
+ status = _IO_file_close_it (fp);
+ else
+ status = fp->_flags & _IO_ERR_SEEN ? -1 : 0;
+ _IO_FINISH (fp);
+ _IO_cleanup_region_end (1);
+ if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr)
+ {
+ fp->_IO_file_flags = 0;
+ free(fp);
+ }
}
+
return status;
}
diff --git a/libio/iofflush.c b/libio/iofflush.c
index 385c962..af69486 100644
--- a/libio/iofflush.c
+++ b/libio/iofflush.c
@@ -35,11 +35,10 @@ _IO_fflush (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_SYNC (fp) ? EOF : 0;
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
}
diff --git a/libio/iofgetpos.c b/libio/iofgetpos.c
index 07128c1..cae5df7 100644
--- a/libio/iofgetpos.c
+++ b/libio/iofgetpos.c
@@ -33,10 +33,10 @@ _IO_fgetpos (fp, posp)
{
_IO_fpos_t pos;
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);
pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
if (pos == _IO_pos_BAD)
{
#ifdef EIO
diff --git a/libio/iofgets.c b/libio/iofgets.c
index 79ba1a9..7a1044f 100644
--- a/libio/iofgets.c
+++ b/libio/iofgets.c
@@ -36,7 +36,7 @@ _IO_fgets (buf, n, fp)
CHECK_FILE (fp, NULL);
if (n <= 0)
return NULL;
- __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
count = _IO_getline (fp, buf, n - 1, '\n', 1);
if (count == 0 || (fp->_IO_file_flags & _IO_ERR_SEEN))
@@ -46,7 +46,7 @@ _IO_fgets (buf, n, fp)
buf[count] = '\0';
result = buf;
}
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
diff --git a/libio/iofputs.c b/libio/iofputs.c
index 6e94223..9ce3caa 100644
--- a/libio/iofputs.c
+++ b/libio/iofputs.c
@@ -33,13 +33,13 @@ _IO_fputs (str, fp)
_IO_size_t len = strlen (str);
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);
if (_IO_sputn (fp, str, len) != len)
result = EOF;
else
result = 1;
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
diff --git a/libio/iofread.c b/libio/iofread.c
index 8610b0c..5fed0d8 100644
--- a/libio/iofread.c
+++ b/libio/iofread.c
@@ -36,10 +36,10 @@ _IO_fread (buf, size, count, fp)
CHECK_FILE (fp, 0);
if (bytes_requested == 0)
return 0;
- __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
bytes_read = _IO_sgetn (fp, (char *) buf, bytes_requested);
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return bytes_requested == bytes_read ? count : bytes_read / size;
}
weak_alias (_IO_fread, fread)
diff --git a/libio/iofsetpos.c b/libio/iofsetpos.c
index 52700f7..ec913e3 100644
--- a/libio/iofsetpos.c
+++ b/libio/iofsetpos.c
@@ -32,7 +32,7 @@ _IO_fsetpos (fp, posp)
{
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);
if (_IO_seekpos (fp, *posp, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD)
{
@@ -45,7 +45,7 @@ _IO_fsetpos (fp, posp)
}
else
result = 0;
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
diff --git a/libio/ioftell.c b/libio/ioftell.c
index 1fc7c55..7fe18f8 100644
--- a/libio/ioftell.c
+++ b/libio/ioftell.c
@@ -32,10 +32,10 @@ _IO_ftell (fp)
{
_IO_pos_t pos;
CHECK_FILE (fp, -1L);
- __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
if (pos == _IO_pos_BAD)
{
#ifdef EIO
diff --git a/libio/iofwrite.c b/libio/iofwrite.c
index 7767a94..542fa77 100644
--- a/libio/iofwrite.c
+++ b/libio/iofwrite.c
@@ -36,10 +36,10 @@ _IO_fwrite (buf, size, count, fp)
CHECK_FILE (fp, 0);
if (request == 0)
return 0;
- __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
written = _IO_sputn (fp, (const char *) buf, request);
- __libc_cleanup_region_end (1);
+ _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. */
if (written == request)
diff --git a/libio/iogetdelim.c b/libio/iogetdelim.c
index d41bb6b..b1662e4 100644
--- a/libio/iogetdelim.c
+++ b/libio/iogetdelim.c
@@ -52,7 +52,7 @@ _IO_getdelim (lineptr, n, delimiter, fp)
return -1;
}
CHECK_FILE (fp, -1);
- __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
if (_IO_ferror_unlocked (fp))
{
@@ -114,7 +114,7 @@ _IO_getdelim (lineptr, n, delimiter, fp)
result = cur_len;
unlock_return:
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
diff --git a/libio/iogets.c b/libio/iogets.c
index b5611f2..0e87504 100644
--- a/libio/iogets.c
+++ b/libio/iogets.c
@@ -33,8 +33,8 @@ _IO_gets (buf)
int ch;
char *retval;
- __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
- _IO_stdin);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
+ _IO_stdin);
_IO_flockfile (_IO_stdin);
ch = _IO_getc_unlocked (_IO_stdin);
if (ch == EOF)
@@ -57,10 +57,12 @@ _IO_gets (buf)
buf[count] = 0;
retval = buf;
unlock_return:
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return retval;
}
weak_alias (_IO_gets, gets)
+#ifdef _LIBC
link_warning (gets, "the `gets' function is dangerous and should not be used.")
+#endif
diff --git a/libio/iopadn.c b/libio/iopadn.c
index 94166a3..be2c2a6 100644
--- a/libio/iopadn.c
+++ b/libio/iopadn.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (C) 1993 Free Software Foundation
This file is part of the GNU IO Library. This library is free
@@ -38,7 +38,7 @@ DEFUN(_IO_padn, (fp, pad, count),
const char *padptr;
register int i;
_IO_size_t written = 0, w;
-
+
if (pad == ' ')
padptr = blanks;
else if (pad == '0')
@@ -55,7 +55,7 @@ DEFUN(_IO_padn, (fp, pad, count),
if (w != PADSIZE)
return written;
}
-
+
if (i > 0)
{
w = _IO_sputn(fp, padptr, i);
diff --git a/libio/ioputs.c b/libio/ioputs.c
index 34e68b9..c35ceb8 100644
--- a/libio/ioputs.c
+++ b/libio/ioputs.c
@@ -30,7 +30,7 @@ _IO_puts (str)
{
int result;
_IO_size_t len = strlen (str);
- __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
_IO_stdout);
_IO_flockfile (_IO_stdout);
if (_IO_sputn (_IO_stdout, str, len) == len
@@ -38,7 +38,7 @@ _IO_puts (str)
result = len + 1;
else
result = EOF;
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
weak_alias (_IO_puts, puts)
diff --git a/libio/ioseekoff.c b/libio/ioseekoff.c
index 1de4f7b..80720e5 100644
--- a/libio/ioseekoff.c
+++ b/libio/ioseekoff.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (C) 1993 Free Software Foundation
This file is part of the GNU IO Library. This library is free
@@ -13,8 +13,8 @@ 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.
+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
diff --git a/libio/ioseekpos.c b/libio/ioseekpos.c
index be68633..dfb3b16 100644
--- a/libio/ioseekpos.c
+++ b/libio/ioseekpos.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (C) 1993 Free Software Foundation
This file is part of the GNU IO Library. This library is free
@@ -13,8 +13,8 @@ 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.
+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
diff --git a/libio/iosetbuffer.c b/libio/iosetbuffer.c
index d14e5d4..09751af 100644
--- a/libio/iosetbuffer.c
+++ b/libio/iosetbuffer.c
@@ -31,13 +31,13 @@ _IO_setbuffer (fp, buf, size)
_IO_size_t size;
{
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);
fp->_flags &= ~_IO_LINE_BUF;
if (!buf)
size = 0;
(void) _IO_SETBUF (fp, buf, size);
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
}
weak_alias (_IO_setbuffer, setbuffer)
diff --git a/libio/iosetvbuf.c b/libio/iosetvbuf.c
index 8ba9753..0bd6025 100644
--- a/libio/iosetvbuf.c
+++ b/libio/iosetvbuf.c
@@ -37,7 +37,7 @@ _IO_setvbuf (fp, buf, mode, size)
{
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);
switch (mode)
{
@@ -90,7 +90,7 @@ _IO_setvbuf (fp, buf, mode, size)
}
result = _IO_SETBUF (fp, buf, size) == NULL ? EOF : 0;
unlock_return:
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
diff --git a/libio/ioungetc.c b/libio/ioungetc.c
index 180e789..d36b07a 100644
--- a/libio/ioungetc.c
+++ b/libio/ioungetc.c
@@ -33,10 +33,10 @@ _IO_ungetc (c, fp)
CHECK_FILE (fp, EOF);
if (c == EOF)
return 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_sputbackc (fp, (unsigned char) c);
- __libc_cleanup_region_end (1);
+ _IO_cleanup_region_end (1);
return result;
}
diff --git a/libio/iovsprintf.c b/libio/iovsprintf.c
index f0c9889..a4fc949 100644
--- a/libio/iovsprintf.c
+++ b/libio/iovsprintf.c
@@ -43,8 +43,11 @@ _IO_vsprintf (string, format, args)
_IO_init ((_IO_FILE *) &sf, 0);
_IO_JUMPS ((_IO_FILE *) &sf) = &_IO_str_jumps;
_IO_str_init_static ((_IO_FILE *) &sf, string, -1, string);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, &sf);
+ _IO_flockfile (&sf);
ret = _IO_vfprintf ((_IO_FILE *) &sf, format, args);
_IO_putc_unlocked ('\0', (_IO_FILE *) &sf);
+ _IO_cleanup_region_end (1);
return ret;
}
diff --git a/libio/iovsscanf.c b/libio/iovsscanf.c
index 473b714..6546e2d 100644
--- a/libio/iovsscanf.c
+++ b/libio/iovsscanf.c
@@ -13,8 +13,8 @@ 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.
+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
@@ -29,6 +29,7 @@ int
DEFUN(_IO_vsscanf, (string, format, args),
const char *string AND const char *format AND _IO_va_list args)
{
+ int ret;
_IO_strfile sf;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
@@ -37,7 +38,11 @@ DEFUN(_IO_vsscanf, (string, format, args),
_IO_init((_IO_FILE*)&sf, 0);
_IO_JUMPS((_IO_FILE*)&sf) = &_IO_str_jumps;
_IO_str_init_static ((_IO_FILE*)&sf, (char*)string, 0, NULL);
- return _IO_vfscanf((_IO_FILE*)&sf, format, args, NULL);
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, &sf);
+ _IO_flockfile (&sf);
+ ret = _IO_vfscanf((_IO_FILE*)&sf, format, args, NULL);
+ _IO_cleanup_region_end (1);
+ return ret;
}
weak_alias (_IO_vsscanf, __vsscanf)
weak_alias (_IO_vsscanf, vsscanf)
diff --git a/libio/libio.h b/libio/libio.h
index 49f1d8c..f6293ec 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -288,6 +288,8 @@ extern int _IO_ftrylockfile __P ((_IO_FILE *));
# define _IO_flockfile(_fp) /**/
# define _IO_funlockfile(_fp) /**/
# define _IO_ftrylockfile(_fp) /**/
+# define _IO_cleanup_region_start(_fct, _fp) /**/
+# define _IO_cleanup_region_end(_Doit) /**/
#endif /* !_IO_MTSAFE_IO */
#ifdef __USE_REENTRANT
diff --git a/libio/libioP.h b/libio/libioP.h
index c9a639a..1f8d890 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -557,7 +557,7 @@ extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
if ((FILE) == NULL) { MAYBE_SET_EINVAL; return RET; } \
else { COERCE_FILE(FILE); \
if (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
- { errno = EINVAL; return RET; }}
+ { MAYBE_SET_EINVAL; return RET; }}
#else
#define CHECK_FILE(FILE,RET) \
COERCE_FILE(FILE)