about summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-10-13 21:35:39 +0000
committerUlrich Drepper <drepper@redhat.com>1996-10-13 21:35:39 +0000
commitd41c6f6161ef2b500b68d7599fcbc6a4c4ca2285 (patch)
tree51df6ee380158ffb9c50d9dd7801b26411f645c7 /libio
parent31c95122ee73661bacd2b3f35140937e5950a7f5 (diff)
downloadglibc-d41c6f6161ef2b500b68d7599fcbc6a4c4ca2285.tar.gz
glibc-d41c6f6161ef2b500b68d7599fcbc6a4c4ca2285.tar.xz
glibc-d41c6f6161ef2b500b68d7599fcbc6a4c4ca2285.zip
update from main archvie 961013 cvs/libc-961015 cvs/libc-961014
Sun Oct 13 22:52:56 1996  Ulrich Drepper  <drepper@cygnus.com>

	* shlib-versions: Add version number/name for ld.so.
	* Makeconfig: Move definition of rtld-installed-name after
	inclusion of soversions.mk.
	Don't add . before version number from shlib-versions file when
	when name does not start with digit.  This is needed for ld.so.

Sat Oct 12 20:31:58 1996  Richard Henderson  <rth@tamu.edu>

	* libio/iogets.c: Warn when gets used.
	* stdio/gets.c: Strengthen the warning.

Sat Oct 12 23:10:43 1996  Ulrich Drepper  <drepper@cygnus.com>

	* libio/Makefile [_LIBC_REENTRANT] (routines): Add peekc.
	* libio/libio.h: Add prototypes for _IO_getc, _IO_putc, _IO_feof,
	_IO_ferror, _IO_peekc_locked, and _IO_ftrylockfile.
	Remove prototypes for _IO_getc_locked and _IO_putc_locked.
	[_IO_MTSAFE_IO]: Add weak aliases for _IO_flockfile and
	_IO_funlockfile.
	[! _IO_MTSAFE_IO]: Define _IO_ftrylockfile as empty.
	Define _IO_getc, _IO_peekc, _IO_putc, _IO_feof, _IO_ferror to
	appropriate values according to __USE_REENTRANT.
	* libio/stdio.h: Add prototype for ftrylockfile.
	[!_LIBC]: Define getc_locked, getchar_locked, putchar_locked,
	getc, getchar, putc, and putchar using _IO_* names.
	* libio/feof.c: Rename to _IO_feof and make feof weak alias.
	* libio/ferror.c: Rename to _IO_ferror and make ferror weak alias.
	* libio/getc.c: Rename to _IO_getc and make getc weak alias.
	* libio/putc.c: Rename to _IO_putc and make putc weak alias.
	* libio/putc_u.c: Don't define alias _IO_putc_unlocked.
	* libio/peekc.c: New file.

	* stdio-common/vfprintf.c (vfprintf): Unconditionally call
	__flockfile.

	* sysdeps/stub/locfile.c [USE_IN_LIBIO]: Also define _IO_* names.

	* crypt/Makefile (tests): Add md5test and md5c-test.
	* crypt/md5-crypt.c: Correct various error.  Now md5_process_bytes
	is called, the buffer limit is honoured and a loop in a inner
	loop is corrected.
	* crypt/md5.h (struct md5_ctx): Add new fields.
	Add prototypes for new functions.
	* crypt/md5.c (md5_init_ctx): Initialize new fields.
	(md5_finish_ctx): New function.  Like md5_read_ctx but before
	perform correct finalization.
	(md5_process_bytes): New function.  Similar to md5_proces_block,
	but does not require input size to be multiple of 64.
	(md5_stream): Rewrite using md5_process_bytes and md5_finish_ctx.
	(md5_buffer): Likewise.
	(md5_process_block): Count number of bytes.
	* crypt/md5test.c: New file.  Test program for MD5 functions.
	* crypt/md5c-test.c: New file:  Test program for MD5 crypt
	function.

	* po/fr.po: Update.

	* time/strptime.c: Recognize %s, %u, %g, and %G format.

	* posix/getopt.c: Add some more casts and initializations to
	prevent warnings.

Sat Oct 12 16:15:29 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/speed.c (speeds): Removed.  We provide
	an extra function to provide this functionality.
	(cfgetospeed): Simply return masked value.
	(cfsetospeed): Don't use speeds array and so we can simply test
	the value of SPEED for illegal values.
	* termios/cfsetspeed.c: Rewrite.  We convert here between the
	real values and the B* constants.
	Changes suggested by Uwe Ohse <uwe@tirka.gun.de>.

Fri Oct 11 21:45:34 1996  Andreas Jaeger  <aj@arthur.pfalz.de>

	* locale/programs/xstrdup.c: Define prototypes.
	* locale/programs/xmalloc.c: Likewise.

	* stdio-common/xbug.c (main): Change definition to avoid warning.

Fri Oct 11 23:36:31 1996  Miles Bader  <miles@gnu.ai.mit.edu>

	* db/hash/hash.c (__hash_open): Correctly test for a read-write db.
Diffstat (limited to 'libio')
-rw-r--r--libio/Makefile2
-rw-r--r--libio/feof.c5
-rw-r--r--libio/ferror.c3
-rw-r--r--libio/getc.c6
-rw-r--r--libio/iogets.c2
-rw-r--r--libio/libio.h35
-rw-r--r--libio/peekc.c41
-rw-r--r--libio/putc.c6
-rw-r--r--libio/putc_u.c4
-rw-r--r--libio/stdio.h13
10 files changed, 94 insertions, 23 deletions
diff --git a/libio/Makefile b/libio/Makefile
index ba64fc7752..0c34125ac6 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -42,7 +42,7 @@ include ../Makeconfig
 
 ifneq (,$(filter %REENTRANT, $(defines)))
 routines += clearerr_u feof_u ferror_u fputc_u getc_u getchar_u		      \
-	    iofflush_u putc_u putchar_u
+	    iofflush_u putc_u putchar_u peekc
 
 CPPFLAGS += -D_IO_MTSAFE_IO
 endif
diff --git a/libio/feof.c b/libio/feof.c
index 9fb0008afb..34ca1da161 100644
--- a/libio/feof.c
+++ b/libio/feof.c
@@ -25,7 +25,7 @@ the executable file might be covered by the GNU General Public License. */
 #include "stdio.h"
 
 int
-feof (fp)
+_IO_feof (fp)
      _IO_FILE* fp;
 {
   int result;
@@ -35,11 +35,12 @@ feof (fp)
   _IO_funlockfile (fp);
   return result;
 }
+weak_alias (_IO_feof, feof)
 
 #ifdef _IO_MTSAFE_IO
 /* The feof 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 (feof, feof_locked)
+weak_alias (_IO_feof, feof_locked)
 #endif
diff --git a/libio/ferror.c b/libio/ferror.c
index 32fd6d0dd9..4f75092149 100644
--- a/libio/ferror.c
+++ b/libio/ferror.c
@@ -25,7 +25,7 @@ the executable file might be covered by the GNU General Public License. */
 #include "stdio.h"
 
 int
-ferror (fp)
+_IO_ferror (fp)
      _IO_FILE* fp;
 {
   int result;
@@ -35,6 +35,7 @@ ferror (fp)
   _IO_funlockfile (fp);
   return result;
 }
+weak_alias (_IO_ferror, ferror)
 
 #ifdef _IO_MTSAFE_IO
 
diff --git a/libio/getc.c b/libio/getc.c
index c345e44ca6..0c0b6b84d3 100644
--- a/libio/getc.c
+++ b/libio/getc.c
@@ -25,10 +25,10 @@ the executable file might be covered by the GNU General Public License. */
 #include "libioP.h"
 #include "stdio.h"
 
-#undef getc
+#undef _IO_getc
 
 int
-getc (fp)
+_IO_getc (fp)
      FILE *fp;
 {
   int result;
@@ -39,6 +39,8 @@ getc (fp)
   __libc_cleanup_region_end (1);
   return result;
 }
+#undef getc
+weak_alias (_IO_getc, getc)
 
 #ifdef _IO_MTSAFE_IO
 # undef getc_locked
diff --git a/libio/iogets.c b/libio/iogets.c
index e132093e48..716ecd1b18 100644
--- a/libio/iogets.c
+++ b/libio/iogets.c
@@ -53,3 +53,5 @@ _IO_gets (buf)
 }
 
 weak_alias (_IO_gets, gets)
+
+link_warning (gets, "the `gets' function is dangerous and should not be used.")
diff --git a/libio/libio.h b/libio/libio.h
index e174ee183d..5118b1e980 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -26,6 +26,7 @@ the executable file might be covered by the GNU General Public License. */
 
 #ifndef _IO_STDIO_H
 #define _IO_STDIO_H
+#include <features.h>
 
 #include <_G_config.h>
 #define _IO_pos_t _G_fpos_t /* obsolete */
@@ -262,21 +263,43 @@ extern int __overflow __P((_IO_FILE*, int));
 #define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0)
 #define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0)
 
+extern int _IO_getc __P ((_IO_FILE *__fp));
+extern int _IO_putc __P ((int __c, _IO_FILE *__fp));
+extern int _IO_feof __P ((_IO_FILE *__fp));
+extern int _IO_ferror __P ((_IO_FILE *__fp));
+
+extern int _IO_peekc_locked __P ((_IO_FILE *__fp));
+
 /* This one is for Emacs. */
 #define _IO_PENDING_OUTPUT_COUNT(_fp)	\
 	((_fp)->_IO_write_ptr - (_fp)->_IO_write_base)
 
-extern int _IO_getc_locked __P ((_IO_FILE *));
-extern int _IO_putc_locked __P ((int, _IO_FILE *));
-
 extern void _IO_flockfile __P ((_IO_FILE *));
 extern void _IO_funlockfile __P ((_IO_FILE *));
+extern int _IO_ftrylockfile __P ((_IO_FILE *));
 
-#ifndef _IO_MTSAFE_IO
-# define _IO_flockfile(FILE) /**/
-# define _IO_funlockfile(FILE) /**/
+#ifdef _IO_MTSAFE_IO
+weak_extern (_IO_flockfile)
+weak_extern (_IO_funlockfile)
+#else
+# define _IO_flockfile(_fp) /**/
+# define _IO_funlockfile(_fp) /**/
+# define _IO_ftrylockfile(_fp) /**/
 #endif /* !_IO_MTSAFE_IO */
 
+#ifdef __USE_REENTRANT
+# 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
 
 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));
diff --git a/libio/peekc.c b/libio/peekc.c
new file mode 100644
index 0000000000..2b0a812868
--- /dev/null
+++ b/libio/peekc.c
@@ -0,0 +1,41 @@
+/*
+Copyright (C) 1993, 1995, 1996 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"
+
+#undef _IO_peekc
+
+int
+_IO_peekc_locked (fp)
+     FILE *fp;
+{
+  int result;
+  CHECK_FILE (fp, EOF);
+  __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
+  _IO_flockfile (fp);
+  result = _IO_peekc_unlocked (fp);
+  __libc_cleanup_region_end (1);
+  return result;
+}
diff --git a/libio/putc.c b/libio/putc.c
index bc69e2efb7..5aa3b68137 100644
--- a/libio/putc.c
+++ b/libio/putc.c
@@ -19,10 +19,10 @@ Cambridge, MA 02139, USA.  */
 #include "libioP.h"
 #include "stdio.h"
 
-#undef putc
+#undef _IO_putc
 
 int
-putc (c, fp)
+_IO_putc (c, fp)
      int c;
      _IO_FILE *fp;
 {
@@ -34,6 +34,8 @@ putc (c, fp)
   __libc_cleanup_region_end (1);
   return result;
 }
+#undef putc
+weak_alias (_IO_putc, putc)
 
 #ifdef _IO_MTSAFE_IO
 # undef putc_locked
diff --git a/libio/putc_u.c b/libio/putc_u.c
index 85912e583f..18bbd491d8 100644
--- a/libio/putc_u.c
+++ b/libio/putc_u.c
@@ -29,7 +29,3 @@ putc_unlocked (c, fp)
   CHECK_FILE (fp, EOF);
   return _IO_putc_unlocked (c, fp);
 }
-
-#ifdef _LIBC_REENTRANT
-weak_alias (putc_unlocked, _IO_putc_unlocked)
-#endif
diff --git a/libio/stdio.h b/libio/stdio.h
index c71cf4d1d2..a47b663cae 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -221,6 +221,7 @@ extern int fileno_locked __P ((FILE *));
 extern int fileno_unlocked __P ((FILE *));
 extern void flockfile __P ((FILE *));
 extern void funlockfile __P ((FILE *));
+extern int ftrylockfile __P ((FILE *));
 extern int fclose_unlocked __P ((FILE *));
 extern int fflush_locked __P ((FILE *));
 extern int fflush_unlocked __P ((FILE *));
@@ -240,17 +241,19 @@ extern int putchar_unlocked __P ((int));
 
 # ifndef _LIBC
 #  define getc_unlocked(fp) _IO_getc_unlocked (fp)
-#  define getc_locked(fp) fgetc (fp)
+#  define getc_locked(fp) _IO_getc (fp)
 #  define getchar_unlocked() _IO_getc_unlocked (stdin)
-#  define getchar_locked() getc (stdin)
+#  define getchar_locked() _IO_getc (stdin)
 #  define putchar_unlocked(c) _IO_putc_unlocked (c, stdout)
-#  define putchar_locked(c) putc (c, stdout)
+#  define putchar_locked(c) _IO_putc (c, stdout)
 # endif
 
 #endif /* __USE_REENTRANT */
 
-#define putchar(c) putc (c, stdout)
-#define getchar() getc (stdin)
+#define getc(_fp) _IO_getc (_fp)
+#define putc(_ch, _fp) _IO_putc (_ch, _fp)
+#define putchar(_ch) _IO_putc (_ch, stdout)
+#define getchar() _IO_getc (stdin)
 
 
 #ifdef __cplusplus