summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog19
-rw-r--r--Makefile17
-rw-r--r--Makerules16
-rw-r--r--catgets/catgets.c2
-rw-r--r--elf/eval.c10
-rw-r--r--libio/Banner1
-rw-r--r--libio/iofdopen.c4
-rw-r--r--libio/iofopen.c4
-rw-r--r--libio/iofopncook.c4
-rw-r--r--libio/iopopen.c4
-rw-r--r--libio/iovsprintf.c4
-rw-r--r--libio/iovsscanf.c2
-rw-r--r--libio/libio.h1
-rw-r--r--libio/libioP.h10
-rw-r--r--libio/memstream.c4
-rw-r--r--libio/stdfiles.c8
-rw-r--r--libio/vasprintf.c4
-rw-r--r--libio/vdprintf.c4
-rw-r--r--libio/vsnprintf.c4
-rw-r--r--version.c5
20 files changed, 120 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index dbec91baea..ce781aad4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+Sat Sep  7 14:00:33 1996  David Mosberger-Tang  <davidm@azstarnet.com>
+
+	* catgets/catgets.c (catopen): Allocate sizeof(*result) bytes
+	instead of sizeof(nl_catd) (which is just a pointer!).
+
+Sat Sep  7 19:39:19 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makefile ($(objpfx)version-info.h): Generate from Banner files.
+	* version.c (banner): Add contents of version-info.h to string.
+
+	* Makerules: If $($(subdir)-version) is available name versioned
+	shared library according to this value instead of glibc's version.
+
+	* libio/Banner: New file.
+
+	* elf/eval.c (funcall): Write error message in case function is
+	not found.
+	(eval): Recognize `_' in names.
+
 Sat Sep  7 05:15:45 1996  Ulrich Drepper  <drepper@cygnus.com>
 
  	* libio/iofdopen: Initialize _lock field only if _IO_MTSAFE_IO.
diff --git a/Makefile b/Makefile
index 039e3c90bd..014b581c45 100644
--- a/Makefile
+++ b/Makefile
@@ -129,6 +129,23 @@ $(objpfx)sysd-dirs: $(+sysdir_pfx)config.make
 	 echo endef) > $@-tmp
 	 mv -f $@-tmp $@
 
+$(objpfx)version-info.h: $(..)Makefile $(+sysdir_pfx)config.make
+	(first=yes;                                                           \
+	 for dir in $(subdirs); do                                            \
+	   if [ -r $$dir/Banner ]; then                                       \
+	     if [ $$first = yes ]; then                                       \
+	       echo "\"Available extensions:";                                \
+	       first=no;                                                      \
+	     fi;                                                              \
+	     sed -e '/^#/d' -e 's/^[[:space:]]*/	/' $$dir/Banner;    \
+	   fi;                                                                \
+	 done;                                                                \
+	 [ $first = yes ] || echo "\"") > $@-tmp
+	 mv -f $@-tmp $@
+
+version.c-objects := $(addprefix $(objpfx)version,$(object-suffixes))
+$(version.c-objects): $(objpfx)version-info.h
+
 # Makerules creates a file `stub-$(subdir)' for each subdirectory, which
 # contains `#define __stub_FUNCTION' for each function which is a stub.
 # Here we paste all of these together into <stubs.h>.
diff --git a/Makerules b/Makerules
index 441e24c34c..740cc0f247 100644
--- a/Makerules
+++ b/Makerules
@@ -643,6 +643,7 @@ object-suffixes-left := $(versioned)
 include $(o-iterator)
 
 
+ifeq (,$($(subdir)-version))
 define o-iterator-doit
 $(libdir)/$o$($o-version): $(libdir)/$(o:.so=)-$(version).so; $$(make-link)
 endef
@@ -654,6 +655,21 @@ $(libdir)/$(o:.so=)-$(version).so: $(objpfx)$o; $$(do-install-program)
 endef
 object-suffixes-left := $(versioned)
 include $(o-iterator)
+else
+define o-iterator-doit
+$(libdir)/$o$($o-version): $(libdir)/$(o:.so=)-$($(subdir)-version).so;
+	$$(make-link)
+endef
+object-suffixes-left := $(versioned)
+include $(o-iterator)
+
+define o-iterator-doit
+$(libdir)/$(o:.so=)-$($(subdir)-version).so: $(objpfx)$o;
+	$$(do-install-program)
+endef
+object-suffixes-left := $(versioned)
+include $(o-iterator)
+endif
 endif
 
 define do-install-so
diff --git a/catgets/catgets.c b/catgets/catgets.c
index eae962ffd7..0abc182414 100644
--- a/catgets/catgets.c
+++ b/catgets/catgets.c
@@ -34,7 +34,7 @@ catopen (const char *cat_name, int flag)
   __nl_catd result;
   const char *env_var;
 
-  result = (__nl_catd) malloc (sizeof (__nl_catd));
+  result = (__nl_catd) malloc (sizeof (*result));
   if (result == NULL)
     /* We cannot get enough memory.  */
     return (nl_catd) -1;
diff --git a/elf/eval.c b/elf/eval.c
index 91415bb6b6..59eb234166 100644
--- a/elf/eval.c
+++ b/elf/eval.c
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <dlfcn.h>
 
 static void *funcall (char **stringp);
@@ -27,6 +28,13 @@ funcall (char **stringp)
     /* Swallow closing paren.  */
     ++*stringp;
 
+  if (args[0] == NULL)
+    {
+      static const char unknown[] = "Unknown function\n";
+      write (1, unknown, sizeof unknown - 1);
+      return NULL;
+    }
+
   /* Do it to it.  */
   __builtin_return (__builtin_apply (args[0],
 				     &argcookie,
@@ -81,7 +89,7 @@ eval (char **stringp)
       value = p;
       do
 	++p;
-      while (*p != '\0' && !isspace (*p) && !ispunct (*p));
+      while (*p != '\0' && !isspace (*p) && (!ispunct (*p) || *p == '_'));
       c = *p;
       *p = '\0';
       value = dlsym (NULL, value);
diff --git a/libio/Banner b/libio/Banner
new file mode 100644
index 0000000000..8ec3141927
--- /dev/null
+++ b/libio/Banner
@@ -0,0 +1 @@
+GNU libio by Per Bothner
diff --git a/libio/iofdopen.c b/libio/iofdopen.c
index c49387b1a0..797192eaae 100644
--- a/libio/iofdopen.c
+++ b/libio/iofdopen.c
@@ -42,7 +42,9 @@ _IO_fdopen (fd, mode)
   struct locked_FILE
   {
     struct _IO_FILE_plus fp;
+#ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
+#endif
   } *new_f;
   int fd_flags;
 
@@ -104,7 +106,9 @@ _IO_fdopen (fd, mode)
   new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
   if (new_f == NULL)
     return NULL;
+#ifdef _IO_MTSAFE_IO
   new_f->fp.file._lock = &new_f->lock;
+#endif
   _IO_init (&new_f->fp.file, 0);
   _IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps;
   _IO_file_init (&new_f->fp.file);
diff --git a/libio/iofopen.c b/libio/iofopen.c
index 334df4652a..cea2415218 100644
--- a/libio/iofopen.c
+++ b/libio/iofopen.c
@@ -35,12 +35,16 @@ _IO_fopen (filename, mode)
   struct locked_FILE
   {
     struct _IO_FILE_plus fp;
+#ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
+#endif
   } *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
 
   if (new_f == NULL)
     return NULL;
+#ifdef _IO_MTSAFE_IO
   new_f->fp.file._lock = &new_f->lock;
+#endif
   _IO_init (&new_f->fp.file, 0);
   _IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps;
   _IO_file_init (&new_f->fp.file);
diff --git a/libio/iofopncook.c b/libio/iofopncook.c
index 4193c2447d..718205e073 100644
--- a/libio/iofopncook.c
+++ b/libio/iofopncook.c
@@ -131,7 +131,9 @@ fopencookie (cookie, mode, io_functions)
   struct locked_FILE
   {
     struct _IO_cookie_file cfile;
+#ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
+#endif
   } *new_f;
 
   switch (*mode++)
@@ -154,7 +156,9 @@ fopencookie (cookie, mode, io_functions)
   new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
   if (new_f == NULL)
     return NULL;
+#ifdef _IO_MTSAFE_IO
   new_f->cfile.file._lock = &new_f->lock;
+#endif
 
   _IO_init (&new_f->cfile.file, 0);
   _IO_JUMPS (&new_f->cfile.file) = &_IO_cookie_jumps;
diff --git a/libio/iopopen.c b/libio/iopopen.c
index ca2a18edac..dc1e74d3eb 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -152,14 +152,18 @@ DEFUN(_IO_popen, (command, mode),
   struct locked_FILE
   {
     struct _IO_proc_file fpx;
+#ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
+#endif
   } *new_f;
   _IO_FILE *fp;
 
   new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
   if (new_f == NULL)
     return NULL;
+#ifdef _IO_MTSAFE_IO
   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;
diff --git a/libio/iovsprintf.c b/libio/iovsprintf.c
index 916804f63d..b2e8b67a96 100644
--- a/libio/iovsprintf.c
+++ b/libio/iovsprintf.c
@@ -32,10 +32,14 @@ _IO_vsprintf (string, format, args)
       _IO_va_list args;
 {
   _IO_strfile sf;
+#ifdef _IO_MTSAFE_IO
   _IO_lock_t lock;
+#endif
   int ret;
 
+#ifdef _IO_MTSAFE_IO
   sf._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, -1, string);
diff --git a/libio/iovsscanf.c b/libio/iovsscanf.c
index 5b4c790517..6e7d8c59e2 100644
--- a/libio/iovsscanf.c
+++ b/libio/iovsscanf.c
@@ -30,8 +30,10 @@ DEFUN(_IO_vsscanf, (string, format, args),
       const char *string AND const char *format AND _IO_va_list args)
 {
   _IO_strfile sf;
+#ifdef _IO_MTSAFE_IO
   _IO_lock_t lock;
   sf._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, (char*)string, 0, NULL);
diff --git a/libio/libio.h b/libio/libio.h
index 17cef91121..36e839fa32 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -152,6 +152,7 @@ typedef struct
 #ifdef _IO_MTSAFE_IO
 #include <pthread.h>
 typedef pthread_mutex_t _IO_lock_t;
+#define _IO_lock_init PTHREAD_MUTEX_INITIALIZER
 #else
 typedef void _IO_lock_t;
 #endif
diff --git a/libio/libioP.h b/libio/libioP.h
index ac4df17ce8..f5e6dc5a0e 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -342,10 +342,18 @@ extern int _IO_vscanf __P((const char *, _IO_va_list));
 #else
 #define _IO_FJUMP &_IO_file_jumps,
 #endif
+#ifdef _IO_MTSAFE_IO
 /* check following! */
 #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, _IO_FJUMP FD}
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, _IO_FJUMP FD, \
+	   0, 0, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
+#else
+/* check following! */
+#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, _IO_FJUMP FD }
+#endif
 
 /* VTABLE_LABEL defines NAME as of the CLASS class.
    CNLENGTH is strlen(#CLASS).  */
diff --git a/libio/memstream.c b/libio/memstream.c
index 1a4f4b9e96..8f9c8ac92c 100644
--- a/libio/memstream.c
+++ b/libio/memstream.c
@@ -67,14 +67,18 @@ open_memstream (bufloc, sizeloc)
   struct locked_FILE
   {
     struct _IO_FILE_memstream fp;
+#ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
+#endif
   } *new_f;
   char *buf;
 
   new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
   if (new_f == NULL)
     return NULL;
+#ifdef _IO_MTSAFE_IO
   new_f->fp._sf._f._lock = &new_f->lock;
+#endif
 
   buf = ALLOC_BUF (_IO_BUFSIZ);
   _IO_init (&new_f->fp._sf._f, 0);
diff --git a/libio/stdfiles.c b/libio/stdfiles.c
index 1d0ef85be9..c50d5f1d8b 100644
--- a/libio/stdfiles.c
+++ b/libio/stdfiles.c
@@ -31,10 +31,16 @@ the executable file might be covered by the GNU General Public License. */
 
 #include "libioP.h"
 
-
+#ifdef _IO_MTSAFE_IO
+#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+  static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_init; \
+  struct _IO_FILE_plus NAME \
+    = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps}
+#else
 #define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
   struct _IO_FILE_plus NAME \
     = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps}
+#endif
 
 DEF_STDFILE(_IO_stdin_, 0, 0, _IO_NO_WRITES);
 DEF_STDFILE(_IO_stdout_, 1, &_IO_stdin_.file, _IO_NO_READS);
diff --git a/libio/vasprintf.c b/libio/vasprintf.c
index cf50603f0d..57a3b08eba 100644
--- a/libio/vasprintf.c
+++ b/libio/vasprintf.c
@@ -38,12 +38,16 @@ _IO_vasprintf (result_ptr, format, args)
   const _IO_size_t init_string_size = 100;
   char *string;
   _IO_strfile sf;
+#ifdef _IO_MTSAFE_IO
   _IO_lock_t lock;
+#endif
   int ret;
   string = ALLOC_BUF(init_string_size);
   if (string == NULL)
     return -1;
+#ifdef _IO_MTSAFE_IO
   sf._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);
diff --git a/libio/vdprintf.c b/libio/vdprintf.c
index 8c5833ccbf..b4b1cc337c 100644
--- a/libio/vdprintf.c
+++ b/libio/vdprintf.c
@@ -32,10 +32,14 @@ _IO_vdprintf (d, format, arg)
      _IO_va_list arg;
 {
   struct _IO_FILE_plus tmpfil;
+#ifdef _IO_MTSAFE_IO
   _IO_lock_t lock;
+#endif
   int done;
 
+#ifdef _IO_MTSAFE_IO
   tmpfil.file._lock = &lock;
+#endif
   _IO_init (&tmpfil.file, 0);
   _IO_JUMPS (&tmpfil.file) = &_IO_file_jumps;
   _IO_file_init (&tmpfil.file);
diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c
index 174640daac..9f767b5b06 100644
--- a/libio/vsnprintf.c
+++ b/libio/vsnprintf.c
@@ -33,9 +33,11 @@ _IO_vsnprintf (string, maxlen, format, args)
      _IO_va_list args;
 {
   _IO_strfile sf;
-  _IO_lock_t lock;
   int ret;
+#ifdef _IO_MTSAFE_IO
+  _IO_lock_t lock;
   sf._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, maxlen - 1, string);
diff --git a/version.c b/version.c
index c8f4ec5fe6..a001398409 100644
--- a/version.c
+++ b/version.c
@@ -26,8 +26,9 @@ Compiled by GNU CC version "__VERSION__".\n\
 Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.\n\
 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
-PARTICULAR PURPOSE.\n\
-Report bugs to <bug-glibc@gnu.ai.mit.edu>.\n";
+PARTICULAR PURPOSE.\n"
+#include "version-info.h"
+"Report bugs to <bug-glibc@gnu.ai.mit.edu>.\n";
 
 #include <unistd.h>