]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Sun Jan 21 00:55:25 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu> cvs/libc-960121
authorRoland McGrath <roland@gnu.org>
Sun, 21 Jan 1996 10:01:05 +0000 (10:01 +0000)
committerRoland McGrath <roland@gnu.org>
Sun, 21 Jan 1996 10:01:05 +0000 (10:01 +0000)
* sysdeps/unix/sysv/linux/shmat.c: Include sys/shm.h instead of
sys/sem.h.

* stdlib/stdlib.h [__USE_SVID]: Declare a64l, l64a.

* stdlib/l64a.c: Use 6-bit numbers as indices in CONV_TABLE, not
literal byte values.

* misc/bsd-compat.c (getpgrp): Define with prototype.

* misc/init-misc.c (__progname_full): New variable.
(program_invocation_name, program_invocation_short_name): New aliases.
(__init_misc): Define with prototype.  Set __progname_full.
* misc/progname.c: File removed.
* misc/Makefile (aux): Remove progname.

* misc/hsearch_r.c (isprime): Define with prototype.

* sysdeps/unix/sysv/linux/seteuid.c: Just include unix/bsd version.
* sysdeps/unix/bsd/seteuid.c: Disallow arg of -1.
* sysdeps/unix/bsd/setegid.c: Likewise.

13 files changed:
ChangeLog
misc/Makefile
misc/bsd-compat.c
misc/error.c
misc/hsearch_r.c
misc/init-misc.c
misc/progname.c [deleted file]
stdlib/l64a.c
stdlib/stdlib.h
sysdeps/unix/bsd/setegid.c
sysdeps/unix/bsd/seteuid.c
sysdeps/unix/sysv/linux/seteuid.c
sysdeps/unix/sysv/linux/shmat.c

index f41f575b0a9931e827c88d13a62d169becdd2ceb..50785a204f7ac6c7f0adc1b2a4b3b907eb6d2de5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+Sun Jan 21 00:55:25 1996  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
+
+       * sysdeps/unix/sysv/linux/shmat.c: Include sys/shm.h instead of
+       sys/sem.h.
+
+       * stdlib/stdlib.h [__USE_SVID]: Declare a64l, l64a.
+
+       * stdlib/l64a.c: Use 6-bit numbers as indices in CONV_TABLE, not
+       literal byte values.
+
+       * misc/bsd-compat.c (getpgrp): Define with prototype.
+
+       * misc/init-misc.c (__progname_full): New variable.
+       (program_invocation_name, program_invocation_short_name): New aliases.
+       (__init_misc): Define with prototype.  Set __progname_full.
+       * misc/progname.c: File removed.
+       * misc/Makefile (aux): Remove progname.
+
+       * misc/hsearch_r.c (isprime): Define with prototype.
+
+       * sysdeps/unix/sysv/linux/seteuid.c: Just include unix/bsd version.
+       * sysdeps/unix/bsd/seteuid.c: Disallow arg of -1.
+       * sysdeps/unix/bsd/setegid.c: Likewise.
+
 Fri Jan 19 13:28:59 1996  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
 
        * sysdeps/unix/sysv/linux/tcdrain.c: Define tcdrain, not
index 775d6c6bb3ea376164a4c296bc3b4de4e2a5a918..4a5546634eeaab7e361e35d5153233d8b6ee434b 100644 (file)
@@ -53,7 +53,7 @@ routines := brk sbrk sstk ioctl \
            efgcvt efgcvt_r \
            hsearch hsearch_r tsearch \
            err error
-aux := progname init-misc
+aux := init-misc
 distribute := bsd-compat.c
 extra-objs := bsd-compat.o
 install-lib := libbsd-compat.a libg.a
index 2bcef9f9d4f4d41e2b4cd1deca35edfc0e553530..ad593b9e1c2ff7d2ad1515253415edad0aa8d0ee 100644 (file)
@@ -1,6 +1,6 @@
 /* BSD-compatible versions of functions where BSD and POSIX.1 conflict.
 
-Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
+Copyright (C) 1991, 1992, 1994, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -25,8 +25,7 @@ Cambridge, MA 02139, USA.  */
 extern pid_t __getpgid __P ((pid_t));
 
 pid_t
-getpgrp (pid)
-     pid_t pid;
+getpgrp (pid_t pid)
 {
   return __getpgid (pid);
 }
index da3c6ee1b25871c5fd27e1e8d06ba6aae67dcb1b..cdba47065604502bd1e05d33b3f4168e88b9897e 100644 (file)
@@ -1,5 +1,5 @@
 /* error.c -- error handler for noninteractive utilities
-   Copyright (C) 1990, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96 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.
@@ -47,23 +47,27 @@ Cambridge, MA 02139, USA.  */
 void exit ();
 #endif
 
-/* This variable is incremented each time `error' is called.  */
-unsigned int error_message_count;
-
 /* If NULL, error will flush stdout, then print on stderr the program
    name, a colon and a space.  Otherwise, error will call this
    function without parameters instead.  */
-void (*error_print_progname) () = NULL;
+void (*error_print_progname) ();
+
+/* This variable is incremented each time `error' is called.  */
+unsigned int error_message_count;
 
 #ifdef _LIBC
+/* In the GNU C library, there is a predefined variable for this.  */
+
 #define program_name program_invocation_name
-#endif
+#include <errno.h>
+
+#else
 
 /* The calling program should define program_name and set it to the
    name of the executing program.  */
 extern char *program_name;
 
-#if HAVE_STRERROR || _LIBC
+#if HAVE_STRERROR
 # ifndef strerror              /* On some systems, strerror is a macro */
 char *strerror ();
 # endif
@@ -80,7 +84,8 @@ private_strerror (errnum)
   return "Unknown system error";
 }
 #define strerror private_strerror
-#endif
+#endif /* HAVE_STRERROR */
+#endif /* _LIBC */
 
 /* Print the program name and error message MESSAGE, which is a printf-style
    format string with optional args.
index 5ea1d5e6c8d6c22c98076c8b239b29df21a27dfd..86dbe793c0cf8d85639ca5c56100a0a5697dd190 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
 Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
 This file is part of the GNU C Library.
 
@@ -31,7 +31,7 @@ Boston, MA 02111-1307, USA.  */
    Instead the interface of all functions is extended to take an argument
    which describes the current status.  */
 typedef struct _ENTRY
-{ 
+{
   int   used;
   ENTRY entry;
 }
@@ -44,8 +44,7 @@ _ENTRY;
    a)  the code is (most probably) called a few times per program run and
    b)  the number is small because the table must fit in the core  */
 static int
-isprime (number)
-     unsigned int number;
+isprime (unsigned int number)
 {
   /* no even number will be passed */
   unsigned int div = 3;
@@ -61,7 +60,7 @@ isprime (number)
    Test for an existing table are done. We allocate one element
    more as the found prime number says. This is done for more effective
    indexing as explained in the comment for the hsearch function.
-   The contents of the table is zeroed, especially the field used 
+   The contents of the table is zeroed, especially the field used
    becomes zero.  */
 int
 hcreate_r (nel, htab)
@@ -114,7 +113,7 @@ hdestroy_r (htab)
     /* free used memory */
     free (htab->table);
 
-  /* the sign for an existing table is an value != NULL in htable */ 
+  /* the sign for an existing table is an value != NULL in htable */
   htab->table = NULL;
 }
 
@@ -124,7 +123,7 @@ hdestroy_r (htab)
    probably strings of chars. The function for generating a number of the
    strings is simple but fast. It can be replaced by a more complex function
    like ajw (see [Aho,Sethi,Ullman]) if the needs are shown.
-  
+
    We use an trick to speed up the lookup. The table is created by hcreate
    with one more element available. This enables us to use the index zero
    special. This index will never be used because we store the first hash
@@ -144,7 +143,7 @@ hsearch_r (item, action, retval, htab)
   unsigned int len = strlen (item.key);
   unsigned int idx;
 
-  /* If table is full and another entry should be entered return with 
+  /* If table is full and another entry should be entered return with
      error.  */
   if (action == ENTER && htab->filled == htab->size)
     {
@@ -178,7 +177,7 @@ hsearch_r (item, action, retval, htab)
       if (htab->table[idx].used == hval
          && strcmp (item.key, htab->table[idx].entry.key) == 0)
        {
-          if (action == ENTER) 
+          if (action == ENTER)
            htab->table[idx].entry.data = item.data;
 
          *retval = &htab->table[idx].entry;
@@ -187,7 +186,7 @@ hsearch_r (item, action, retval, htab)
 
       /* Second hash function, as suggested in [Knuth] */
       hval2 = 1 + hval % (htab->size - 2);
-       
+
       do
        {
          /* Because SIZE is prime this guarantees to step through all
@@ -201,7 +200,7 @@ hsearch_r (item, action, retval, htab)
           if (htab->table[idx].used == hval
              && strcmp (item.key, htab->table[idx].entry.key) == 0)
            {
-              if (action == ENTER) 
+              if (action == ENTER)
                htab->table[idx].entry.data = item.data;
 
              *retval = &htab->table[idx].entry;
index 9fb876beb0023bb28405423acb6faf52dea8a798..44531a5e770493a15d2e7592eb63583bece827ed 100644 (file)
@@ -1,5 +1,5 @@
 /* Define and initialize `__progname'.
-Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -18,14 +18,15 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
 #include <string.h>
+#include <errno.h>
 
+char *__progname_full = (char *) "";
 char *__progname = (char *) "";
+weak_alias (__progname_full, program_invocation_name)
+weak_alias (__progname, program_invocation_short_name)
 
 void
-__init_misc (argc, argv, envp)
-     int argc;
-     char **argv;
-     char **envp;
+__init_misc (int argc, char **argv, char **envp)
 {
   if (argv && argv[0])
     {
@@ -34,9 +35,6 @@ __init_misc (argc, argv, envp)
        __progname = argv[0];
       else
        __progname = p + 1;
+      __progname_full = argv[0];
     }
 }
-
-#ifdef HAVE_GNU_LD
-text_set_element (__libc_subinit, __init_misc);
-#endif
diff --git a/misc/progname.c b/misc/progname.c
deleted file mode 100644 (file)
index d4efac9..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#ifdef HAVE_GNU_LD
-
-#include <ansidecl.h>
-#include <string.h>
-
-/* These must be initialized data definitions.  Common definitions satisfy
-   references to these variables, but do not cause the whole file to be
-   linked in, and so omit the set-up function.  */
-char *program_invocation_name = NULL;
-char *program_invocation_short_name = NULL;
-
-static void
-DEFUN(set_progname, (argc, argv, envp),
-      int argc AND char **argv AND char **envp)
-{
-  char *p;
-
-  if (argv && argv[0])
-    {
-      program_invocation_name = argv[0];
-      p = strrchr (argv[0], '/');
-      if (p == NULL)
-       program_invocation_short_name = argv[0];
-      else
-       program_invocation_short_name = p + 1;
-    }
-  else
-    program_invocation_name = program_invocation_short_name = 0;
-
-  (void) &set_progname;                /* Avoid "defined but not used" warning.  */
-}
-
-text_set_element (__libc_subinit, set_progname);
-
-#endif
index ad19a3b6ebee63a2be5dc8ec5558ef8092576d5c..ac2cb64804d764c03d50b2100d1ea6953e008f0a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -43,7 +43,7 @@ l64a (n)
 
   for (cnt = 5; cnt >= 0; --cnt)
     {
-      result[cnt] = n & 0x3f;
+      result[cnt] = conv_table[n & 0x3f];
       n >>= 6;
     }
 
index 09418afb28ad55d840760f21f84ecfdf650871a6..7c9c68974b937993fd053e80a0d4236482a9c2f9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -156,6 +156,17 @@ extern __inline long int atol (__const char *__nptr)
 #endif /* Optimizing GCC >=2.  */
 
 
+#ifdef __USE_SVID
+/* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant
+   digit first.  Returns a pointer to static storage overwritten by the
+   next call.  */
+extern char *l64a __P ((long int __n));
+
+/* Read a number from a string in base 64 as above.  */
+extern long int a64l __P ((const char *));
+#endif
+
+
 /* Return a random integer between 0 and RAND_MAX inclusive.  */
 extern int rand __P ((void));
 /* Seed the random number generator with the given number.  */
index 85ebea2c96030195b7aac2933dfdd4ab4be48499..c4a3780f6dab4a936fe82eaf26d538ee56d66178 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,12 +16,19 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
+#include <errno.h>
 #include <unistd.h>
 #include <sys/types.h>
 
 int
-DEFUN(setegid, (gid), gid_t gid)
+setegid (gid)
+     gid_t gid;
 {
+  if (gid == (gid_t) ~0)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
   return __setregid (-1, gid);
 }
index a4be2d98a3c04079d4bde556a64df87c71abecd6..f6aa37f153d0bdc79afec0fbe26dbdc770000878 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,12 +16,19 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
+#include <errno.h>
 #include <unistd.h>
 #include <sys/types.h>
 
 int
-DEFUN(seteuid, (uid), uid_t uid)
+seteuid (uid)
+     uid_t uid;
 {
+  if (uid == (uid_t) ~0)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
   return __setreuid (-1, uid);
 }
index 850f3c565626df8b048432036b43d7f33f4e2840..37fb72c020ba4cfd91354770fe823112f2e3798f 100644 (file)
@@ -1,36 +1 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-int
-__seteuid (uid)
-     uid_t uid;
-{
-  if (uid == (uid_t) ~0)
-    {
-      errno = EINVAL;
-      return -1;
-    }
-
-  return __setreuid (-1, uid);
-}
-
-weak_alias (__seteuid, seteuid)
+#include <sysdeps/unix/bsd/seteuid.c>
index 1efef29215865f44a7a11f9db9e42faff1508e29..b74b8a56ecae80c40ecd4364b7251f3a37692e2f 100644 (file)
@@ -17,7 +17,7 @@ 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 <sys/sem.h>
+#include <sys/shm.h>
 
 /* Attach the shared memory segment associated with SHMID to the data
    segment of the calling process.  SHMADDR and SHMFLG determine how