summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
Diffstat (limited to 'posix')
-rw-r--r--posix/confstr.c34
-rw-r--r--posix/execl.c64
-rw-r--r--posix/execle.c67
-rw-r--r--posix/execlp.c59
-rw-r--r--posix/execv.c35
-rw-r--r--posix/execvp.c34
-rw-r--r--posix/fnmatch.c31
-rw-r--r--posix/id.c119
-rw-r--r--posix/regex.c30
-rw-r--r--posix/setpgrp.c28
-rw-r--r--posix/unistd.h1
-rw-r--r--posix/wordexp.c39
12 files changed, 305 insertions, 236 deletions
diff --git a/posix/confstr.c b/posix/confstr.c
index b511ea0ab8..850130b2a9 100644
--- a/posix/confstr.c
+++ b/posix/confstr.c
@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 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
-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.  */
+/* Copyright (C) 1991, 1996, 1997 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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <stddef.h>
 #include <errno.h>
diff --git a/posix/execl.c b/posix/execl.c
index 9aa13b958f..4772f15474 100644
--- a/posix/execl.c
+++ b/posix/execl.c
@@ -1,37 +1,38 @@
-/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1992, 1994, 1997 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 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., 675 Mass Ave,
-Cambridge, MA 02139, 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 <ansidecl.h>
 #include <unistd.h>
 #include <stdarg.h>
 #include <stddef.h>
+#include <string.h>
 
 #ifndef	HAVE_GNU_LD
-#define	__environ	environ
+# define __environ	environ
 #endif
 
 /* Execute PATH with all arguments after PATH until
    a NULL pointer and environment from `environ'.  */
 int
-DEFUN(execl, (path, arg), CONST char *path AND CONST char *arg DOTS)
+execl (const char *path, const char *arg, ...)
 {
-  CONST char *argv[1024];
-  register unsigned int i;
+  size_t argv_max = 1024;
+  const char **argv = alloca (argv_max * sizeof (const char *));
+  unsigned int i;
   va_list args;
 
   argv[0] = arg;
@@ -40,9 +41,28 @@ DEFUN(execl, (path, arg), CONST char *path AND CONST char *arg DOTS)
   i = 1;
   do
     {
-      argv[i] = va_arg (args, CONST char *);
-    } while (argv[i++] != NULL);
+      if (i == argv_max)
+	{
+	  const char **nptr = alloca ((argv_max *= 2) * sizeof (const char *));
+
+	  if ((char *) nptr + argv_max == (char *) argv)
+	    {
+	      /* Stack grows down.  */
+	      argv = (const char **) memcpy (nptr, argv, i);
+	      argv_max += i;
+	    }
+	  else if ((char *) argv + i == (char *) nptr)
+	    /* Stack grows up.  */
+	    argv_max += i;
+	  else
+	    /* We have a hole in the stack.  */
+	    argv = (const char **) memcpy (nptr, argv, i);
+	}
+
+      argv[i] = va_arg (args, const char *);
+    }
+  while (argv[i++] != NULL);
   va_end (args);
 
-  return __execve (path, (char *CONST *) argv, __environ);
+  return __execve (path, (char *const *) argv, __environ);
 }
diff --git a/posix/execle.c b/posix/execle.c
index a36d49a407..3e0fcee87e 100644
--- a/posix/execle.c
+++ b/posix/execle.c
@@ -1,45 +1,66 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1997 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 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., 675 Mass Ave,
-Cambridge, MA 02139, 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 <ansidecl.h>
 #include <unistd.h>
 #include <stdarg.h>
 #include <stddef.h>
+#include <string.h>
 
 /* Execute PATH with all arguments after PATH until a NULL pointer,
    and the argument after that for environment.  */
 int
-DEFUN(execle, (path), CONST char *path AND CONST char *arg DOTS)
+execle (const char *path, const char *arg, ...)
 {
-  CONST char *argv[1024], *CONST *envp;
-  register unsigned int i;
+  size_t argv_max = 1024;
+  const char **argv = alloca (argv_max * sizeof (const char *));
+  const char *const *envp;
+  unsigned int i;
   va_list args;
+  argv[0] = arg;
 
   va_start(args, arg);
-  argv[0] = arg;
   i = 1;
   do
     {
-      argv[i] = va_arg(args, CONST char *);
-    } while (argv[i++] != NULL);
+      if (i == argv_max)
+	{
+	  const char **nptr = alloca ((argv_max *= 2) * sizeof (const char *));
+
+	  if ((char *) nptr + argv_max == (char *) argv)
+	    {
+	      /* Stack grows down.  */
+	      argv = (const char **) memcpy (nptr, argv, i);
+	      argv_max += i;
+	    }
+	  else if ((char *) argv + i == (char *) nptr)
+	    /* Stack grows up.  */
+	    argv_max += i;
+	  else
+	    /* We have a hole in the stack.  */
+	    argv = (const char **) memcpy (nptr, argv, i);
+	}
+
+      argv[i] = va_arg (args, const char *);
+    }
+  while (argv[i++] != NULL);
 
-  envp = va_arg(args, CONST char *CONST *);
+  envp = va_arg(args, const char *const *);
   va_end(args);
 
-  return __execve(path, (char *CONST *) argv, (char *CONST *) envp);
+  return __execve(path, (char *const *) argv, (char *const *) envp);
 }
diff --git a/posix/execlp.c b/posix/execlp.c
index f442c05d94..76b878ec6a 100644
--- a/posix/execlp.c
+++ b/posix/execlp.c
@@ -1,24 +1,25 @@
-/* Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1993, 1996, 1997 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 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., 675 Mass Ave,
-Cambridge, MA 02139, 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 <unistd.h>
 #include <stdarg.h>
 #include <stddef.h>
+#include <string.h>
 
 /* Execute FILE, searching in the `PATH' environment variable if
    it contains no slashes, with all arguments after FILE until a
@@ -26,16 +27,38 @@ Cambridge, MA 02139, USA.  */
 int
 execlp (const char *file, const char *arg, ...)
 {
-  const char *argv[1024];
+  size_t argv_max = 1024;
+  const char **argv = alloca (argv_max * sizeof (const char *));
   unsigned int i;
   va_list args;
 
+  argv[0] = arg;
+
   va_start (args, arg);
+  i = 1;
+  do
+    {
+      if (i == argv_max)
+	{
+	  const char **nptr = alloca ((argv_max *= 2) * sizeof (const char *));
 
-  argv[i = 0] = arg;
-  while (argv[i++] != NULL)
-    argv[i] = va_arg (args, const char *);
+	  if ((char *) nptr + argv_max == (char *) argv)
+	    {
+	      /* Stack grows down.  */
+	      argv = (const char **) memcpy (nptr, argv, i);
+	      argv_max += i;
+	    }
+	  else if ((char *) argv + i == (char *) nptr)
+	    /* Stack grows up.  */
+	    argv_max += i;
+	  else
+	    /* We have a hole in the stack.  */
+	    argv = (const char **) memcpy (nptr, argv, i);
+	}
 
+      argv[i] = va_arg (args, const char *);
+    }
+  while (argv[i++] != NULL);
   va_end (args);
 
   return execvp (file, (char *const *) argv);
diff --git a/posix/execv.c b/posix/execv.c
index 1749e24631..aba9d20f92 100644
--- a/posix/execv.c
+++ b/posix/execv.c
@@ -1,31 +1,30 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1992, 1997 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 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., 675 Mass Ave,
-Cambridge, MA 02139, 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 <ansidecl.h>
 #include <unistd.h>
 
 #ifndef	HAVE_GNU_LD
-#define	__environ	environ
+# define __environ	environ
 #endif
 
 /* Execute PATH with arguments ARGV and environment from `environ'.  */
 int
-DEFUN(execv, (path, argv), CONST char *path AND char *CONST argv[])
+execv (const char *path, char *const argv[])
 {
-  return __execve(path, argv, __environ);
+  return __execve (path, argv, __environ);
 }
diff --git a/posix/execvp.c b/posix/execvp.c
index 400e082937..c231ec69ca 100644
--- a/posix/execvp.c
+++ b/posix/execvp.c
@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 1992, 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
-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.  */
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <unistd.h>
 #include <stdarg.h>
diff --git a/posix/fnmatch.c b/posix/fnmatch.c
index edbfb6ae9a..e143743215 100644
--- a/posix/fnmatch.c
+++ b/posix/fnmatch.c
@@ -1,19 +1,20 @@
-/* Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-This 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.
+   This 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.
 
-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
-Library General Public License for more details.
+   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
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with this library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with this 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.  */
 
 #if HAVE_CONFIG_H
 # include <config.h>
@@ -37,10 +38,10 @@ Cambridge, MA 02139, USA.  */
    program understand `configure --with-gnu-libc' and omit the object files,
    it is simpler to just do this in the source for each such file.  */
 
-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
+#if defined _LIBC || !defined __GNU_LIBRARY__
 
 
-# if defined (STDC_HEADERS) || !defined (isascii)
+# if defined STDC_HEADERS || !defined isascii
 #  define ISASCII(c) 1
 # else
 #  define ISASCII(c) isascii(c)
diff --git a/posix/id.c b/posix/id.c
index b08d2501fa..6c602b21b4 100644
--- a/posix/id.c
+++ b/posix/id.c
@@ -1,22 +1,21 @@
-/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1995, 1997 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 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., 675 Mass Ave,
-Cambridge, MA 02139, 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 <ansidecl.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -27,61 +26,65 @@ Cambridge, MA 02139, USA.  */
 
 
 static void
-DEFUN(print_grpname, (id, parens),
-      gid_t id AND int parens)
+print_grpname (id, parens)
+     gid_t id;
+     int parens;
 {
-  CONST struct group *CONST g = getgrgid(id);
+  const struct group *const g = getgrgid (id);
   if (g == NULL)
     {
       if (parens)
 	return;
       else
 	{
-	  fprintf(stderr, _("Couldn't find name for group %d\n"), id);
-	  exit(EXIT_FAILURE);
+	  fprintf (stderr, _("Couldn't find name for group %d\n"), id);
+	  exit (EXIT_FAILURE);
 	}
     }
 
   if (parens)
-    printf("(%s)", g->gr_name);
+    printf ("(%s)", g->gr_name);
   else
-    puts(g->gr_name);
+    puts (g->gr_name);
 }
 
 static void
-DEFUN(print_pwdname, (id, parens),
-      uid_t id AND int parens)
+print_pwdname (id, parens)
+     uid_t id;
+     int parens;
 {
-  CONST struct passwd *CONST p = getpwuid(id);
+  const struct passwd *const p = getpwuid (id);
   if (p == NULL)
     {
       if (parens)
 	return;
       else
 	{
-	  fprintf(stderr, _("Couldn't find name for user %d\n"), (int) id);
-	  exit(EXIT_FAILURE);
+	  fprintf (stderr, _("Couldn't find name for user %d\n"), (int) id);
+	  exit (EXIT_FAILURE);
 	}
     }
 
   if (parens)
-    printf("(%s)", p->pw_name);
+    printf ("(%s)", p->pw_name);
   else
-    puts(p->pw_name);
+    puts (p->pw_name);
 }
 
 int
-DEFUN(main, (argc, argv), int argc AND char **argv)
+main (argc, argv)
+     int argc;
+     char **argv;
 {
   int print_gid = 1, print_uid = 1;
   int real = 0, name = 0;
   int error = 0;
-  register int c;
+  int c;
 
-  uid_t ruid = getuid(), euid = geteuid();
-  gid_t rgid = getgid(), egid = getegid();
+  uid_t ruid = getuid (), euid = geteuid ();
+  gid_t rgid = getgid (), egid = getegid ();
 
-  while ((c = getopt(argc, argv, "gurn")) != -1)
+  while ((c = getopt (argc, argv, "gurn")) != -1)
     switch (c)
       {
       default:
@@ -109,65 +112,65 @@ DEFUN(main, (argc, argv), int argc AND char **argv)
 
   if (error || argc != optind)
     {
-      fputs(_("Usage: id [-gurn]\n"), stderr);
-      exit(EXIT_FAILURE);
+      fputs (_("Usage: id [-gurn]\n"), stderr);
+      exit (EXIT_FAILURE);
     }
 
   if (print_uid && !print_gid)
     {
-      CONST uid_t uid = real ? ruid : euid;
+      const uid_t uid = real ? ruid : euid;
       if (name)
-	print_pwdname(uid, 0);
+	print_pwdname (uid, 0);
       else
-	printf("%d\n", (int) uid);
+	printf ("%d\n", (int) uid);
     }
   else if (print_gid && !print_uid)
     {
-      CONST gid_t gid = real ? rgid : egid;
+      const gid_t gid = real ? rgid : egid;
       if (name)
-	print_grpname(gid, 0);
+	print_grpname (gid, 0);
       else
-	printf("%d\n", (int) gid);
+	printf ("%d\n", (int) gid);
     }
   else
     {
 #if	NGROUPS_MAX > 0
       gid_t groups[NGROUPS_MAX];
       int ngroups;
-      ngroups = getgroups(NGROUPS_MAX, groups);
+      ngroups = getgroups (NGROUPS_MAX, groups);
 #endif
 
-      printf("uid=%d", (int) ruid);
-      print_pwdname(ruid, 1);
-      printf(" gid=%d", (int) rgid);
-      print_grpname(rgid, 1);
+      printf ("uid=%d", (int) ruid);
+      print_pwdname (ruid, 1);
+      printf (" gid=%d", (int) rgid);
+      print_grpname (rgid, 1);
       if (euid != ruid)
 	{
-	  printf(" euid=%d", (int) euid);
-	  print_pwdname(euid, 1);
+	  printf (" euid=%d", (int) euid);
+	  print_pwdname (euid, 1);
 	}
       if (egid != rgid)
 	{
-	  printf(" egid=%d", (int) egid);
-	  print_grpname(egid, 1);
+	  printf (" egid=%d", (int) egid);
+	  print_grpname (egid, 1);
 	}
 
 #if	NGROUPS > 0
       if (ngroups > 0)
 	{
-	  register size_t i;
-	  printf(" groups=%d", (int) groups[0]);
-	  print_grpname(groups[0], 1);
+	  size_t i;
+	  printf (" groups=%d", (int) groups[0]);
+	  print_grpname (groups[0], 1);
 	  for (i = 1; i < ngroups; ++i)
 	    {
-	      printf(", %d", (int) groups[i]);
-	      print_grpname(groups[i], 1);
+	      printf (", %d", (int) groups[i]);
+	      print_grpname (groups[i], 1);
 	    }
 	}
 #endif
 
-      putchar('\n');
+      putchar ('\n');
     }
 
-  exit(EXIT_SUCCESS);
+  exit (EXIT_SUCCESS);
 }
diff --git a/posix/regex.c b/posix/regex.c
index 4b640e6079..370a612603 100644
--- a/posix/regex.c
+++ b/posix/regex.c
@@ -3,25 +3,25 @@
    (Implements POSIX draft P10003.2/D11.2, except for
    internationalization features.)
 
-   Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1996, 1997 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.
+   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.
 
-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., 675 Mass Ave,
-Cambridge, MA 02139, 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.  */
 
 /* AIX requires this to be the first thing in the file. */
 #if defined (_AIX) && !defined (REGEX_MALLOC)
diff --git a/posix/setpgrp.c b/posix/setpgrp.c
index 56102a3c26..e3451e13e6 100644
--- a/posix/setpgrp.c
+++ b/posix/setpgrp.c
@@ -1,20 +1,20 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 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 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., 675 Mass Ave,
-Cambridge, MA 02139, 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 <unistd.h>
 
diff --git a/posix/unistd.h b/posix/unistd.h
index 5c8d1b7f04..57652bfc3c 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -235,6 +235,7 @@ extern unsigned int alarm __P ((unsigned int __seconds));
    SIGALRM signal while inside `sleep' call, the handling of the SIGALRM
    signal afterwards is undefined.  There is no return value to indicate
    error, but if `sleep' returns SECONDS, it probably didn't work.  */
+extern unsigned int __sleep __P ((unsigned int __seconds));
 extern unsigned int sleep __P ((unsigned int __seconds));
 
 #if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
diff --git a/posix/wordexp.c b/posix/wordexp.c
index 1922e44642..52869fe1d3 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -1,22 +1,21 @@
-/* Copyright (C) 1992 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1992, 1997 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 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., 675 Mass Ave,
-Cambridge, MA 02139, 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 <ansidecl.h>
 #include <sys/types.h>
 #include <wordexp.h>
 #include <stdio.h>
@@ -43,8 +42,10 @@ Cambridge, MA 02139, USA.  */
 
 
 int
-DEFUN(wordexp, (string, pwordexp, flags),
-      CONST char *string AND wordexp_t *pwordexp AND int flags)
+wordexp (string, pwordexp, flags)
+     const char *string;
+     wordexp_t *pwordexp;
+     int flags;
 {
   int error;
   pid_t pid;
@@ -67,7 +68,7 @@ DEFUN(wordexp, (string, pwordexp, flags),
     {
       /* Child.  Run the shell.  */
 
-      CONST char *argv[5];
+      const char *argv[5];
 
       close (d[STDIN_FILENO]);
       dup2 (d[STDOUT_FILENO], STDOUT_FILENO);
@@ -132,7 +133,7 @@ DEFUN(wordexp, (string, pwordexp, flags),
   wordc = start + wordc + 1;
 
   if (flags & WRDE_APPEND)
-    wordv = (char **) realloc ((PTR) pwordexp->we_wordv,
+    wordv = (char **) realloc ((void *) pwordexp->we_wordv,
 			       wordc * sizeof (char *));
   else
     wordv = (char **) malloc (wordc * sizeof (char *));