+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
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
/* 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
extern pid_t __getpgid __P ((pid_t));
pid_t
-getpgrp (pid)
- pid_t pid;
+getpgrp (pid_t pid)
{
return __getpgid (pid);
}
/* 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.
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
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.
-/* 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.
Instead the interface of all functions is extended to take an argument
which describes the current status. */
typedef struct _ENTRY
-{
+{
int used;
ENTRY 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;
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)
/* 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;
}
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
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)
{
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;
/* Second hash function, as suggested in [Knuth] */
hval2 = 1 + hval % (htab->size - 2);
-
+
do
{
/* Because SIZE is prime this guarantees to step through all
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;
/* 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
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])
{
__progname = argv[0];
else
__progname = p + 1;
+ __progname_full = argv[0];
}
}
-
-#ifdef HAVE_GNU_LD
-text_set_element (__libc_subinit, __init_misc);
-#endif
+++ /dev/null
-/* 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
-/* 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.
for (cnt = 5; cnt >= 0; --cnt)
{
- result[cnt] = n & 0x3f;
+ result[cnt] = conv_table[n & 0x3f];
n >>= 6;
}
-/* 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
#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. */
-/* 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
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);
}
-/* 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
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);
}
-/* 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>
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