summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-05-22 02:11:55 +0000
committerRoland McGrath <roland@gnu.org>1996-05-22 02:11:55 +0000
commitb8fe19fa809ac786b7d3dbb464cb1b3f887dc69d (patch)
tree0758f3dea04af210777ee864f4fa99e7f107b29e
parent1b82a4a8cacdca3d02e98c1799b206da043d940c (diff)
downloadglibc-b8fe19fa809ac786b7d3dbb464cb1b3f887dc69d.tar.gz
glibc-b8fe19fa809ac786b7d3dbb464cb1b3f887dc69d.tar.xz
glibc-b8fe19fa809ac786b7d3dbb464cb1b3f887dc69d.zip
Wed May 22 01:48:54 1996 Ulrich Drepper <drepper@cygnus.com>
	* stdlib/strtol.c [!QUAD] (ULONG_MAX, LONG_MAX): Define these
	macros if they are not available.
	(WEAKNAME): New macro to declare argument as weak.
	Define function with __ prefix and add normal name as weak alias.

	* sysdeps/posix/euidaccess.c (S_IROTH, S_IWOTH, S_IXOTH): Defines
	these macros if not already available based on R_OK, W_OK, and
	X_OK.

Tue May 21 18:48:46 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>

	* misc/sys/syslog.h (__need___va_list): Define this instead of
	__need_va_list before including <stdarg.h>.

	* Makerules (o-iterator): Use $(object-suffixes-left) instead
	of $(object-suffixes) to produce repetitions; this is used for other
	lists than just that one.
	[versioned]: Use $(o-iterator) properly.

	* sysdeps/unix/sysv/linux/Implies: Include `gnu'.
	* sysdeps/mach/hurd/Implies: Likewise.

Sat May 18 02:57:46 1996  Ulrich Drepper  <drepper@cygnus.com>

	* login/Makefile: New file.  This directory contains functions
	for user administration.
	* Makefile (subdirs): Add login.

	* misc/Makefile (headers): Remove utmp.h.  Now in login/utmp.h.
	(extra-libs, libutil-routines): Ditto.
	* misc/login.c, misc/login_tty.c, misc/logout.c, misc/logwtmp.c,
	misc/utmp.h: Moved to misc/.
	* login/login.c, login/login_tty.c, login/logout.c,
        login/logwtmp.c, login/utmp.h: Moved to here from misc/.

	* login/utmp.h: Split file.  Definitions of data structures
	and constants are now in the system dependent utmpbits.h file.

	* login/setutent_r.c, login/setutent.c, login/endutent_r.c,
	login/endutent.c, login/getutent_r.c, login/getutent.c,
	login/getutid_r.c, login/getutid.c, login/getutline_r.c,
	login/getutline.c, login/pututline_r.c, login/pututline.c:
	New files.  Routines to handle utmp-style files.

	* sysdeps/gnu/utmpbits.h: New file.  Contains GNU/Linux
	specific definitions of utmp data structures and constants.

	* sysdeps/unix/sysv/utmpbits.h: Renamed from sysdeps/unix/sysv/utmp.h.

	* sysdeps/generic/utmpbits.h: New file.  Generic (BSDish) version of
	definitions of utmp data structures and constants.

Fri May 17 00:01:31 1996  Ulrich Drepper  <drepper@cygnus.com>

	* locale/C-monetary.c: Default value for mon_decimal_point should be
        '.'.

	* stdio-common/printf.h: Remove Linux libc compatibility stuff.
	Add `extra' flag.  Currently used in __printf_fp.

	* stdio-common/printf_fp.c (__guess_grouping): Renamed from
        `guess_grouping' and extend visibility to extern.  This function
        is now used in `strfmon'.
	(__printf_fp): Recognize new bit flag in info struct.  This
	triggers to use the grouping information and decimal point from
	the LC_MONETARY category instead of the LC_NUMERIC category.

	* stdio-common/vfprintf.c (process_arg): Correct major bug.  In
	`complicated' loop we must not use the varargs because the args
	are already available in the ARGS_VALUE array.

	* stdlib/Makefile (headers): Add monetary.h.
	(routines): Add strfmon.
	* stdlib/monetary.h: New file.  Header for strfmon function.
	* stdlib/strfmon.c: New file.  Implement strfmon function to print
	monetary amounts according to current locale's rules.

	* sysdeps/unix/sysv/linux/i386/sys/vm86.h: The kernel header is
	now (>= Linux-1.3.100) called <asm/vm86.h>.
-rw-r--r--ChangeLog82
-rw-r--r--Makefile2
-rwxr-xr-xconfig.sub1
-rw-r--r--locale/C-monetary.c2
-rw-r--r--login/Makefile38
-rw-r--r--login/endutent.c31
-rw-r--r--login/endutent_r.c32
-rw-r--r--login/getutent.c36
-rw-r--r--login/getutent_r.c50
-rw-r--r--login/getutid.c36
-rw-r--r--login/getutid_r.c61
-rw-r--r--login/getutline.c36
-rw-r--r--login/getutline_r.c61
-rw-r--r--login/login.c (renamed from misc/login.c)0
-rw-r--r--login/login_tty.c (renamed from misc/login_tty.c)0
-rw-r--r--login/logout.c (renamed from misc/logout.c)0
-rw-r--r--login/logwtmp.c (renamed from misc/logwtmp.c)0
-rw-r--r--login/pututline.c34
-rw-r--r--login/pututline_r.c89
-rw-r--r--login/setutent.c31
-rw-r--r--login/setutent_r.c72
-rw-r--r--login/utmp.h96
-rw-r--r--manual/arith.texi22
-rw-r--r--manual/errno.texi25
-rw-r--r--manual/libc.texinfo102
-rw-r--r--misc/Makefile8
-rw-r--r--misc/utmp.h82
-rw-r--r--resolv/gethnamaddr.c4
-rw-r--r--stdio-common/printf.h5
-rw-r--r--stdio-common/printf_fp.c56
-rw-r--r--stdio-common/vfprintf.c105
-rw-r--r--stdlib/Makefile6
-rw-r--r--stdlib/monetary.h36
-rw-r--r--stdlib/strfmon.c504
-rw-r--r--stdlib/strtol.c29
-rw-r--r--sysdeps/generic/utmpbits.h52
-rw-r--r--sysdeps/gnu/utmpbits.h83
-rw-r--r--sysdeps/mach/hurd/Implies3
-rw-r--r--sysdeps/posix/euidaccess.c10
-rw-r--r--sysdeps/unix/sysv/linux/Implies4
-rw-r--r--sysdeps/unix/sysv/linux/i386/sys/vm86.h2
-rw-r--r--sysdeps/unix/sysv/utmp.h23
-rw-r--r--sysdeps/unix/sysv/utmpbits.h42
43 files changed, 1751 insertions, 242 deletions
diff --git a/ChangeLog b/ChangeLog
index d3d8abcaa3..47f8446058 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,85 @@
+Wed May 22 01:48:54 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* stdlib/strtol.c [!QUAD] (ULONG_MAX, LONG_MAX): Define these
+	macros if they are not available.
+	(WEAKNAME): New macro to declare argument as weak.
+	Define function with __ prefix and add normal name as weak alias.
+
+	* sysdeps/posix/euidaccess.c (S_IROTH, S_IWOTH, S_IXOTH): Defines
+	these macros if not already available based on R_OK, W_OK, and
+	X_OK.
+
+Tue May 21 18:48:46 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>
+
+	* misc/sys/syslog.h (__need___va_list): Define this instead of
+	__need_va_list before including <stdarg.h>.
+
+	* Makerules (o-iterator): Use $(object-suffixes-left) instead
+	of $(object-suffixes) to produce repetitions; this is used for other
+	lists than just that one.
+	[versioned]: Use $(o-iterator) properly.
+
+	* sysdeps/unix/sysv/linux/Implies: Include `gnu'.
+	* sysdeps/mach/hurd/Implies: Likewise.
+
+Sat May 18 02:57:46 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* login/Makefile: New file.  This directory contains functions
+	for user administration.
+	* Makefile (subdirs): Add login.
+
+	* misc/Makefile (headers): Remove utmp.h.  Now in login/utmp.h.
+	(extra-libs, libutil-routines): Ditto.
+	* misc/login.c, misc/login_tty.c, misc/logout.c, misc/logwtmp.c,
+	misc/utmp.h: Moved to misc/.
+	* login/login.c, login/login_tty.c, login/logout.c,
+        login/logwtmp.c, login/utmp.h: Moved to here from misc/.
+
+	* login/utmp.h: Split file.  Definitions of data structures
+	and constants are now in the system dependent utmpbits.h file.
+
+	* login/setutent_r.c, login/setutent.c, login/endutent_r.c,
+	login/endutent.c, login/getutent_r.c, login/getutent.c,
+	login/getutid_r.c, login/getutid.c, login/getutline_r.c,
+	login/getutline.c, login/pututline_r.c, login/pututline.c:
+	New files.  Routines to handle utmp-style files.
+
+	* sysdeps/gnu/utmpbits.h: New file.  Contains GNU/Linux
+	specific definitions of utmp data structures and constants.
+
+	* sysdeps/unix/sysv/utmpbits.h: Renamed from sysdeps/unix/sysv/utmp.h.
+
+	* sysdeps/generic/utmpbits.h: New file.  Generic (BSDish) version of
+	definitions of utmp data structures and constants.
+
+Fri May 17 00:01:31 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* locale/C-monetary.c: Default value for mon_decimal_point should be
+        '.'.
+
+	* stdio-common/printf.h: Remove Linux libc compatibility stuff.
+	Add `extra' flag.  Currently used in __printf_fp.
+
+	* stdio-common/printf_fp.c (__guess_grouping): Renamed from
+        `guess_grouping' and extend visibility to extern.  This function
+        is now used in `strfmon'.
+	(__printf_fp): Recognize new bit flag in info struct.  This
+	triggers to use the grouping information and decimal point from
+	the LC_MONETARY category instead of the LC_NUMERIC category.
+
+	* stdio-common/vfprintf.c (process_arg): Correct major bug.  In
+	`complicated' loop we must not use the varargs because the args
+	are already available in the ARGS_VALUE array.
+
+	* stdlib/Makefile (headers): Add monetary.h.
+	(routines): Add strfmon.
+	* stdlib/monetary.h: New file.  Header for strfmon function.
+	* stdlib/strfmon.c: New file.  Implement strfmon function to print
+	monetary amounts according to current locale's rules.
+
+	* sysdeps/unix/sysv/linux/i386/sys/vm86.h: The kernel header is
+	now (>= Linux-1.3.100) called <asm/vm86.h>.
+
 Thu May 16 00:31:44 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>
 
 	* Makerules [versioned]: Make symlinks in the build directory, because
diff --git a/Makefile b/Makefile
index ef211a6160..ae32c77001 100644
--- a/Makefile
+++ b/Makefile
@@ -53,7 +53,7 @@ endif
 # These are the subdirectories containing the library source.
 subdirs = csu assert ctype db locale intl catgets math setjmp signal stdlib \
 	  stdio-common $(stdio) malloc string wcsmbs time dirent grp pwd\
-	  posix io termios resource misc socket sysvipc gmon gnulib	\
+	  posix io termios resource misc login socket sysvipc gmon gnulib \
 	  wctype $(wildcard crypt) manual $(sysdep-subdirs) elf po
 export subdirs := $(subdirs)	# Benign, useless in GNU make before 3.63.
 
diff --git a/config.sub b/config.sub
index 9542fb28ef..27a3689f78 100755
--- a/config.sub
+++ b/config.sub
@@ -307,6 +307,7 @@ case $basic_machine in
 		basic_machine=m68k-hp
 		os=-hpux
 		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
 		basic_machine=m68000-hp
 		;;
 	hp9k3[2-9][0-9])
diff --git a/locale/C-monetary.c b/locale/C-monetary.c
index b661a57493..542e5c30d1 100644
--- a/locale/C-monetary.c
+++ b/locale/C-monetary.c
@@ -27,7 +27,7 @@ const struct locale_data _nl_C_LC_MONETARY =
   {
     { string: "" },
     { string: "" },
-    { string: "" },
+    { string: "." },
     { string: "" },
     { string: "\177" },
     { string: "" },
diff --git a/login/Makefile b/login/Makefile
new file mode 100644
index 0000000000..d3e6ac8aa5
--- /dev/null
+++ b/login/Makefile
@@ -0,0 +1,38 @@
+# Copyright (C) 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.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#
+#	Sub-makefile for login portion of the library.
+#
+
+subdir	:= login
+
+headers	:= utmp.h utmpbits.h
+
+routines := setutent endutent getutent getutid getutline pututline	\
+	    setutent_r endutent_r getutent_r getutid_r getutline_r	\
+	    pututline_r
+
+# Build the -lutil library with these extra functions.
+extra-libs      := libutil
+libutil-routines:= login login_tty logout logwtmp pty
+
+
+include ../Rules
+
+override CFLAGS += -D_THREAD_SAFE
diff --git a/login/endutent.c b/login/endutent.c
new file mode 100644
index 0000000000..9aed00d7a7
--- /dev/null
+++ b/login/endutent.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+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 <utmp.h>
+
+
+/* The global data defined in setutent.c.  */
+extern struct utmp_data __utmp_data;
+
+
+void
+endutent (void)
+{
+  endutent_r (&__utmp_data);
+}
diff --git a/login/endutent_r.c b/login/endutent_r.c
new file mode 100644
index 0000000000..b15f57a964
--- /dev/null
+++ b/login/endutent_r.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+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 <utmp.h>
+
+
+void
+endutent_r (struct utmp_data *utmp_data)
+{
+  if (utmp_data->ut_fd != -1)
+    {
+      close (utmp_data->ut_fd);
+      utmp_data->ut_fd = -1;
+    }
+}
diff --git a/login/getutent.c b/login/getutent.c
new file mode 100644
index 0000000000..36411469a0
--- /dev/null
+++ b/login/getutent.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+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 <utmp.h>
+
+
+/* The global data defined in setutent.c.  */
+extern struct utmp_data __utmp_data;
+
+
+struct utmp *
+getutent (void)
+{
+  struct utmp *result;
+
+  if (getutent_r (&result, &__utmp_data) < 0)
+    return NULL;
+
+  return result;
+}
diff --git a/login/getutent_r.c b/login/getutent_r.c
new file mode 100644
index 0000000000..ad8e9eb7c2
--- /dev/null
+++ b/login/getutent_r.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+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 <utmp.h>
+
+
+int
+getutent_r (struct utmp **utmp, struct utmp_data *utmp_data)
+{
+  /* Open utmp file if not already done.  */
+  if (utmp_data->ut_fd == -1)
+    {
+      setutent_r (utmp_data);
+      if (utmp_data->ut_fd == -1)
+	return -1;
+    }
+
+  /* Position file correctly.  */
+  if (lseek (utmp_data->ut_fd, utmp_data->loc_utmp, SEEK_SET) == -1)
+    return -1;
+
+  /* Read the next entry.  */
+  if (read (utmp_data->ut_fd, &utmp_data->ubuf, sizeof (struct utmp))
+      != sizeof (struct utmp))
+    return -1;
+
+  /* Update position pointer.  */
+  utmp_data->loc_utmp += sizeof (struct utmp);
+
+  *utmp = &utmp_data->ubuf;
+
+  return 0;
+}
diff --git a/login/getutid.c b/login/getutid.c
new file mode 100644
index 0000000000..6b29d38fd0
--- /dev/null
+++ b/login/getutid.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+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 <utmp.h>
+
+
+/* The global data defined in setutent.c.  */
+extern struct utmp_data __utmp_data;
+
+
+struct utmp *
+getutid (const struct utmp *id)
+{
+  struct utmp *result;
+
+  if (getutid_r (id, &result, &__utmp_data) < 0)
+    return NULL;
+
+  return (struct utmp *) result;
+}
diff --git a/login/getutid_r.c b/login/getutid_r.c
new file mode 100644
index 0000000000..351f96e65e
--- /dev/null
+++ b/login/getutid_r.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+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 <errno.h>
+#include <unistd.h>
+#include <utmp.h>
+
+
+/* For implementing this function we don't use the getutent_r function
+   because we can avoid the reposition on every new entry this way.  */
+int
+getutid_r (const struct utmp *id, struct utmp **utmp,
+	   struct utmp_data *utmp_data)
+{
+  /* Open utmp file if not already done.  */
+  if (utmp_data->ut_fd == -1)
+    {
+      setutent_r (utmp_data);
+      if (utmp_data->ut_fd == -1)
+	return -1;
+    }
+
+  /* Position file correctly.  */
+  if (lseek (utmp_data->ut_fd, utmp_data->loc_utmp, SEEK_SET) == -1)
+    return -1;
+
+  do
+    {
+      /* Read the next entry.  */
+      if (read (utmp_data->ut_fd, &utmp_data->ubuf, sizeof (struct utmp))
+	  != sizeof (struct utmp))
+	{
+	  errno = ESRCH;
+	  return -1;
+	}
+
+      /* Update position pointer.  */
+      utmp_data->loc_utmp += sizeof (struct utmp);
+    }
+  while (id->ut_type != utmp_data->ubuf.ut_type);
+
+  *utmp = &utmp_data->ubuf;
+
+  return 0;
+}
diff --git a/login/getutline.c b/login/getutline.c
new file mode 100644
index 0000000000..23ca6a8107
--- /dev/null
+++ b/login/getutline.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+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 <utmp.h>
+
+
+/* The global data defined in setutent.c.  */
+extern struct utmp_data __utmp_data;
+
+
+struct utmp *
+getutline (const struct utmp *line)
+{
+  struct utmp *result;
+
+  if (getutline_r (line, &result, &__utmp_data) < 0)
+    return NULL;
+
+  return (struct utmp *) result;
+}
diff --git a/login/getutline_r.c b/login/getutline_r.c
new file mode 100644
index 0000000000..62c8c2fd66
--- /dev/null
+++ b/login/getutline_r.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+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 <errno.h>
+#include <unistd.h>
+#include <utmp.h>
+
+
+/* For implementing this function we don't use the getutent_r function
+   because we can avoid the reposition on every new entry this way.  */
+int
+getutline_r (const struct utmp *line, struct utmp **utmp,
+	     struct utmp_data *utmp_data)
+{
+  /* Open utmp file if not already done.  */
+  if (utmp_data->ut_fd == -1)
+    {
+      setutent_r (utmp_data);
+      if (utmp_data->ut_fd == -1)
+	return -1;
+    }
+
+  /* Position file correctly.  */
+  if (lseek (utmp_data->ut_fd, utmp_data->loc_utmp, SEEK_SET) == -1)
+    return -1;
+
+  do
+    {
+      /* Read the next entry.  */
+      if (read (utmp_data->ut_fd, &utmp_data->ubuf, sizeof (struct utmp))
+	  != sizeof (struct utmp))
+	{
+	  errno = ESRCH;
+	  return -1;
+	}
+
+      /* Update position pointer.  */
+      utmp_data->loc_utmp += sizeof (struct utmp);
+    }
+  while (line->ut_line != utmp_data->ubuf.ut_line);
+
+  *utmp = &utmp_data->ubuf;
+
+  return 0;
+}
diff --git a/misc/login.c b/login/login.c
index 5b71082c52..5b71082c52 100644
--- a/misc/login.c
+++ b/login/login.c
diff --git a/misc/login_tty.c b/login/login_tty.c
index e4e075c6ed..e4e075c6ed 100644
--- a/misc/login_tty.c
+++ b/login/login_tty.c
diff --git a/misc/logout.c b/login/logout.c
index 40ae25456f..40ae25456f 100644
--- a/misc/logout.c
+++ b/login/logout.c
diff --git a/misc/logwtmp.c b/login/logwtmp.c
index 7734ca9624..7734ca9624 100644
--- a/misc/logwtmp.c
+++ b/login/logwtmp.c
diff --git a/login/pututline.c b/login/pututline.c
new file mode 100644
index 0000000000..a704e380fa
--- /dev/null
+++ b/login/pututline.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+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 <utmp.h>
+
+
+/* The global data defined in setutent.c.  */
+extern struct utmp_data __utmp_data;
+
+
+struct utmp *
+pututline (const struct utmp *utmp)
+{
+  if (pututline_r (utmp, &__utmp_data) < 0)
+    return NULL;
+
+  return (struct utmp *) utmp;
+}
diff --git a/login/pututline_r.c b/login/pututline_r.c
new file mode 100644
index 0000000000..365a37672e
--- /dev/null
+++ b/login/pututline_r.c
@@ -0,0 +1,89 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+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 <alloca.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <utmp.h>
+#include <sys/file.h>
+
+
+int
+pututline_r (const struct utmp *utmp_ptr, struct utmp_data *utmp_data)
+{
+  /* Open utmp file if not already done.  */
+  if (utmp_data->ut_fd == -1)
+    {
+      setutent_r (utmp_data);
+      if (utmp_data->ut_fd == -1)
+	return -1;
+    }
+
+  /* Seek position to write.  */
+  if (utmp_data->ubuf.ut_type != utmp_ptr->ut_type)
+    {
+      /* We must not overwrite the data in UTMP_DATA.  */
+      struct utmp_data *data_tmp = alloca (sizeof (utmp_data));
+      struct utmp *dummy;
+
+      memcpy (data_tmp, utmp_data, sizeof (utmp_data));
+      utmp_data = data_tmp;
+      
+      if (getutid_r (utmp_ptr, &dummy, utmp_data) < 0)
+	{
+	  if (errno != ESRCH)
+	    return -1;
+
+	  utmp_data->loc_utmp = lseek (utmp_data->ut_fd, 0, SEEK_END);
+	  if (utmp_data->loc_utmp == -1)
+	    return -1;
+	}
+    }
+
+  /* Position file correctly.  */
+  if (utmp_data->loc_utmp > 0
+      && lseek (utmp_data->ut_fd, utmp_data->loc_utmp - sizeof (struct utmp),
+		SEEK_SET) < 0)
+    return -1;
+
+  /* XXX An alternative solution would be to call an SUID root program
+     which write the new value.  */
+  
+  /* Try to lock the file.  */
+  if (flock (utmp_data->ut_fd, LOCK_EX | LOCK_NB) < 0 && errno != ENOSYS)
+    {
+      /* Oh, oh.  The file is already locked.  Wait a bit and try again.  */
+      sleep (1);
+
+      /* This time we ignore the error.  */
+      (void) flock (utmp_data->ut_fd, LOCK_EX | LOCK_NB);
+    }
+  
+  /* Write the new data.  */
+  if (write (utmp_data->ut_fd, &utmp_data->ubuf, sizeof (struct utmp))
+      != sizeof (struct utmp))
+    return -1;
+
+  /* And unlock the file.  */
+  (void) flock (utmp_data->ut_fd, LOCK_UN);
+
+  return 0;
+}
diff --git a/login/setutent.c b/login/setutent.c
new file mode 100644
index 0000000000..aab28c0015
--- /dev/null
+++ b/login/setutent.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+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 <utmp.h>
+
+/* Global variable with values for non-reentrent functions.  If must
+   be initialized so that field `ut_fd' is set to -1.  */
+struct utmp_data __utmp_data = { ut_fd: -1 };
+
+
+void
+setutent (void)
+{
+  setutent_r (&__utmp_data);
+}
diff --git a/login/setutent_r.c b/login/setutent_r.c
new file mode 100644
index 0000000000..715101d659
--- /dev/null
+++ b/login/setutent_r.c
@@ -0,0 +1,72 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+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 <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <utmp.h>
+
+/* This is the default name.  */
+static const char default_utmp_name[] = _PATH_UTMP;
+
+/* Current file name.  */
+static const char *utmp_file_name = (const char *) default_utmp_name;
+
+
+void
+setutent_r (struct utmp_data *utmp_data)
+{
+  /* Before the UTMP_DATA is used before the first time the UT_FD
+     field must be set to -1.  */
+  if (utmp_data->ut_fd == -1)
+    {
+      utmp_data->ut_fd = open (utmp_file_name, O_RDWR);
+      if (utmp_data->ut_fd == -1)
+	{
+	  /* Hhm, read-write access did not work.  Try read-only.  */
+	  utmp_data->ut_fd = open (utmp_file_name, O_RDONLY);
+	  if (utmp_data->ut_fd == -1)
+	    {
+	      perror (_("while opening UTMP file"));
+	      return;
+	    }
+	}
+    }
+
+  /* Remember we are at beginning of file.  */
+  utmp_data->loc_utmp = 0;
+  utmp_data->ubuf.ut_type = -1;
+}
+
+
+int
+utmpname (const char *file)
+{
+  char *fname = strdup (file);
+  if (fname == NULL)
+    return 0;
+
+  if (utmp_file_name != default_utmp_name)
+    free ((void *) utmp_file_name);
+
+  utmp_file_name = fname;
+
+  return 1;
+}
diff --git a/login/utmp.h b/login/utmp.h
new file mode 100644
index 0000000000..2ba3da8e0b
--- /dev/null
+++ b/login/utmp.h
@@ -0,0 +1,96 @@
+/* Copyright (C) 1993, 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., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+#ifndef	_UTMP_H_
+
+#define	_UTMP_H_	1
+#include <features.h>
+
+#include <sys/types.h>
+
+/* Get system dependent values and data structures.  */
+#include <utmpbits.h>
+
+
+/* Write the given entry into utmp and wtmp.  */
+extern void login __P ((__const struct utmp *));
+
+/* Write the utmp entry to say the user on UT_LINE has logged out.  */
+extern int logout __P ((__const char *ut_line));
+
+/* Append to wtmp an entry for the current time and the given info.  */
+extern void logwtmp __P ((__const char *ut_line, __const char *ut_name,
+			  __const char *ut_host));
+
+/* Change name of the examine utmp file.  */
+extern int utmpname __P ((__const char *__file));
+
+/* Read next entry from a utmp-like file.  */
+extern struct utmp *getutent __P ((void));
+
+/* Rest the input stream to the beginning of the file.  */
+extern void setutent __P ((void));
+
+/* Close the current open file.  */
+extern void endutent __P ((void));
+
+/* Search forward from the current point in the utmp file until the
+   next entry with a ut_type matching ID->ut_type.  */
+extern struct utmp *getutid __P ((__const struct utmp *__id));
+
+/* Search forward from the current point in the utmp file until the
+   next entry with a ut_line matching LINE->ut_line.  */
+extern struct utmp *getutline __P ((__const struct utmp *__line));
+
+/* Write out entry pointed to by UTMP_PTR into the utmp file.  */
+extern struct utmp *pututline __P ((__const struct utmp *__utmp_ptr));
+
+
+#if defined(_REENTRANT) || defined(_THREAD_SAFE)
+/* Define the data structure needed for the reentrent version.  */
+struct utmp_data
+{
+  int ut_fd;
+  off_t loc_utmp;
+  struct utmp ubuf;
+};
+
+
+/* Reentrent versions of the file for handling utmp files.  */
+extern int getutent_r __P ((struct utmp **__utmp,
+			    struct utmp_data *__utmp_data));
+
+extern void setutent_r __P ((struct utmp_data *__utmp_data));
+
+extern void endutent_r __P ((struct utmp_data *__utmp_data));
+
+extern int getutid_r __P ((__const struct utmp *__id, struct utmp **__utmp,
+			   struct utmp_data *__utmp_data));
+
+extern int getutline_r __P ((__const struct utmp *__line, struct utmp **__utmp,
+			     struct utmp_data *__utmp_data));
+
+extern int pututline_r __P ((__const struct utmp *__utmp_ptr,
+			     struct utmp_data *__utmp_data));
+
+#endif /* _REENTRENT || _THREAD_SAFE */
+
+__END_DECLS
+
+#endif /* utmp.h  */
diff --git a/manual/arith.texi b/manual/arith.texi
index a5d2814b1d..b3f646a187 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -446,20 +446,20 @@ These functions are declared in @file{stdlib.h}.
 @deftypefun {long int} strtol (const char *@var{string}, char **@var{tailptr}, int @var{base})
 The @code{strtol} (``string-to-long'') function converts the initial
 part of @var{string} to a signed integer, which is returned as a value
-of type @code{long int}.  
+of type @code{long int}.
 
 This function attempts to decompose @var{string} as follows:
 
 @itemize @bullet
-@item 
+@item
 A (possibly empty) sequence of whitespace characters.  Which characters
 are whitespace is determined by the @code{isspace} function
 (@pxref{Classification of Characters}).  These are discarded.
 
-@item 
+@item
 An optional plus or minus sign (@samp{+} or @samp{-}).
 
-@item 
+@item
 A nonempty sequence of digits in the radix specified by @var{base}.
 
 If @var{base} is zero, decimal radix is assumed unless the series of
@@ -471,7 +471,7 @@ Otherwise @var{base} must have a value between @code{2} and @code{35}.
 If @var{base} is @code{16}, the digits may optionally be preceded by
 @samp{0x} or @samp{0X}.
 
-@item 
+@item
 Any remaining characters in the string.  If @var{tailptr} is not a null
 pointer, @code{strtol} stores a pointer to this tail in
 @code{*@var{tailptr}}.
@@ -499,9 +499,11 @@ There is an example at the end of this section.
 @comment ANSI
 @deftypefun {unsigned long int} strtoul (const char *@var{string}, char **@var{tailptr}, int @var{base})
 The @code{strtoul} (``string-to-unsigned-long'') function is like
-@code{strtol} except that it returns its value with type @code{unsigned
-long int}.  The value returned in case of overflow is @code{ULONG_MAX}
-(@pxref{Range of Type}).
+@code{strtol} except it deals with unsigned numbers, and returns its
+value with type @code{unsigned long int}.  No @samp{+} or @samp{-} sign
+may appear before the number, but the syntax is otherwise the same as
+described above for @code{strtol}.  The value returned in case of
+overflow is @code{ULONG_MAX} (@pxref{Range of Type}).
 @end deftypefun
 
 @comment stdlib.h
@@ -568,12 +570,12 @@ These functions are declared in @file{stdlib.h}.
 @deftypefun double strtod (const char *@var{string}, char **@var{tailptr})
 The @code{strtod} (``string-to-double'') function converts the initial
 part of @var{string} to a floating-point number, which is returned as a
-value of type @code{double}.  
+value of type @code{double}.
 
 This function attempts to decompose @var{string} as follows:
 
 @itemize @bullet
-@item 
+@item
 A (possibly empty) sequence of whitespace characters.  Which characters
 are whitespace is determined by the @code{isspace} function
 (@pxref{Classification of Characters}).  These are discarded.
diff --git a/manual/errno.texi b/manual/errno.texi
index 836fff3bf2..a00ac7859d 100644
--- a/manual/errno.texi
+++ b/manual/errno.texi
@@ -18,7 +18,7 @@ facility.
 
 @menu
 * Checking for Errors::         How errors are reported by library functions.
-* Error Codes::                 Error code macros; all of these expand 
+* Error Codes::                 Error code macros; all of these expand
                                  into integer constant values.
 * Error Messages::              Mapping error codes onto error messages.
 @end menu
@@ -492,7 +492,7 @@ A file that isn't a socket was specified when a socket is required.
 @deftypevr Macro int EMSGSIZE
 @comment errno 40 @c DO NOT REMOVE
 The size of a message sent on a socket was larger than the supported
-maximum size.  
+maximum size.
 @end deftypevr
 
 @comment errno.h
@@ -836,6 +836,14 @@ of error you get if you request them and they are not supported.
 @end deftypevr
 
 @comment errno.h
+@comment ISO C: Invalid or incomplete multibyte or wide character
+@deftypevr Macro int EILSEQ
+@comment errno 106 @c DO NOT REMOVE
+While decoding a multibyte character the function came along an invalid
+or an incomplete sequence of bytes or the given wide character is invalid.
+@end deftypevr
+
+@comment errno.h
 @comment GNU: Inappropriate operation for background process
 @deftypevr Macro int EBACKGROUND
 @comment errno 100 @c DO NOT REMOVE
@@ -920,11 +928,11 @@ This function prints an error message to the stream @code{stderr};
 see @ref{Standard Streams}.
 
 If you call @code{perror} with a @var{message} that is either a null
-pointer or an empty string, @code{perror} just prints the error message 
+pointer or an empty string, @code{perror} just prints the error message
 corresponding to @code{errno}, adding a trailing newline.
 
 If you supply a non-null @var{message} argument, then @code{perror}
-prefixes its output with this string.  It adds a colon and a space 
+prefixes its output with this string.  It adds a colon and a space
 character to separate the @var{message} from the error string corresponding
 to @code{errno}.
 
@@ -952,7 +960,7 @@ variable @code{program_invocation_name}:
 
 @comment errno.h
 @comment GNU
-@deftypevar {char *} program_invocation_name 
+@deftypevar {char *} program_invocation_name
 This variable's value is the name that was used to invoke the program
 running in the current process.  It is the same as @code{argv[0]}.  Note
 that this is not necessarily a useful file name; often it contains no
@@ -961,7 +969,7 @@ directory names.  @xref{Program Arguments}.
 
 @comment errno.h
 @comment GNU
-@deftypevar {char *} program_invocation_short_name 
+@deftypevar {char *} program_invocation_short_name
 This variable's value is the name that was used to invoke the program
 running in the current process, with directory names removed.  (That is
 to say, it is the same as @code{program_invocation_name} minus
@@ -997,10 +1005,10 @@ functions might overwrite @code{errno} in the meantime.
 
 FILE *
 open_sesame (char *name)
-@{ 
+@{
   FILE *stream;
 
-  errno = 0;                     
+  errno = 0;
   stream = fopen (name, "r");
   if (stream == NULL)
     @{
@@ -1012,4 +1020,3 @@ open_sesame (char *name)
     return stream;
 @}
 @end smallexample
-
diff --git a/manual/libc.texinfo b/manual/libc.texinfo
index 1ba44c2071..7a8c1c3327 100644
--- a/manual/libc.texinfo
+++ b/manual/libc.texinfo
@@ -10,10 +10,10 @@
 @set xref-automatic-section-title
 @smallbook
 
-@c  I've already told people the printed edition will be 0.06
-@set EDITION 0.06
+@c sold 0.06/1.09, print run out 21may96
+@set EDITION 0.07 DRAFT
 @set VERSION 1.09 Beta
-@set UPDATED 23 December 1994
+@set UPDATED 21 May 1996
 @set ISBN 1-882114-53-1
 
 @ifinfo
@@ -22,7 +22,7 @@ This file documents the GNU C library.
 This is Edition @value{EDITION}, last updated @value{UPDATED},
 of @cite{The GNU C Library Reference Manual}, for Version @value{VERSION}.
 
-Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+Copyright (C) 1993, '94, '95, '96 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -66,11 +66,11 @@ Foundation.
 @center for version @value{VERSION}
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1993, 1994, 1995 Free Software Foundation, Inc.
+Copyright @copyright{} 1993, '94, '95, '96 Free Software Foundation, Inc.
 @sp 2
 Published by the Free Software Foundation @*
-675 Massachusetts Avenue @*
-Cambridge, MA 02139 USA @*
+59 Temple Place -- Suite 330, @*
+Boston, MA 02111-1307 USA @*
 Printed copies are available for $50 each. @*
 ISBN @value{ISBN} @*
 
@@ -145,7 +145,7 @@ of the GNU C Library.
 
 Appendices
 
-* Language Features::           C language features provided by the library. 
+* Language Features::           C language features provided by the library.
 
 * Library Summary::             A summary showing the syntax, header file,
                                  and derivation of each library feature.
@@ -173,10 +173,10 @@ Introduction
 Standards and Portability
 
 * ANSI C::                      The American National Standard for the
-                                 C programming language.  
+                                 C programming language.
 * POSIX::                       The IEEE 1003 standards for operating systems.
 * Berkeley Unix::               BSD and SunOS.
-* SVID::                        The System V Interface Description.  
+* SVID::                        The System V Interface Description.
 
 Using the Library
 
@@ -243,9 +243,9 @@ Obstacks
 				 complicated) growing objects.
 * Status of an Obstack::        Inquiries about the status of an obstack.
 * Obstacks Data Alignment::     Controlling alignment of objects in obstacks.
-* Obstack Chunks::              How obstacks obtain and release chunks. 
+* Obstack Chunks::              How obstacks obtain and release chunks.
 				Efficiency considerations.
-* Summary of Obstacks::         
+* Summary of Obstacks::
 
 Automatic Storage with Variable Size
 
@@ -291,7 +291,7 @@ Extended Characters
                                    and vice versa.
 * Length of Char::              how many bytes make up one multibyte char.
 * Converting One Char::         Converting a string character by character.
-* Example of Conversion::       Example showing why converting 
+* Example of Conversion::       Example showing why converting
 				   one character at a time may be useful.
 * Shift State::                 Multibyte codes with "shift characters".
 
@@ -305,7 +305,7 @@ Locales and Internationalization
 * Standard Locales::            Locale names available on all systems.
 * Numeric Formatting::          How to format numbers for the chosen locale.
 
-Searching and Sorting 
+Searching and Sorting
 
 * Comparison Functions::        Defining how to compare two objects.
 				Since the sort and search facilities are
@@ -345,7 +345,7 @@ File Names
 I/O on Streams
 
 * Streams::                     About the data type representing a stream.
-* Standard Streams::            Streams to the standard input and output 
+* Standard Streams::            Streams to the standard input and output
                                  devices are created for you.
 * Opening Streams::             How to create a stream to talk to a file.
 * Closing Streams::             Close a stream when you are finished with it.
@@ -388,10 +388,10 @@ Formatted Output
 
 Customizing Printf
 
-* Registering New Conversions::  
-* Conversion Specifier Options::  
-* Defining the Output Handler::  
-* Printf Extension Example::    
+* Registering New Conversions::
+* Conversion Specifier Options::
+* Defining the Output Handler::
+* Printf Extension Example::
 
 Formatted Input
 
@@ -412,13 +412,13 @@ Stream Buffering
 
 Other Kinds of Streams
 
-* String Streams::              
-* Custom Streams::              
+* String Streams::
+* Custom Streams::
 
 Programming Your Own Custom Streams
 
-* Streams and Cookies::         
-* Hook Functions::              
+* Streams and Cookies::
+* Hook Functions::
 
 Low-Level I/O
 
@@ -512,7 +512,7 @@ Internet Domain
 * Services Database::           Ports may have symbolic names.
 * Byte Order::                  Different hosts may use different byte
                                  ordering conventions; you need to
-                                 canonicalize host address and port number. 
+                                 canonicalize host address and port number.
 * Inet Example::                Putting it all together.
 
 Host Addresses
@@ -588,9 +588,9 @@ Terminal Modes
 
 Special Characters
 
-* Editing Characters::          
-* Signal Characters::           
-* Start/Stop Characters::       
+* Editing Characters::
+* Signal Characters::
+* Start/Stop Characters::
 
 Mathematics
 
@@ -689,12 +689,12 @@ Specifying Signal Actions
 
 Defining Signal Handlers
 
-* Handler Returns::             
-* Termination in Handler::      
-* Longjmp in Handler::          
-* Signals in Handler::       
-* Nonreentrancy::               
-* Atomic Data Access::          
+* Handler Returns::
+* Termination in Handler::
+* Longjmp in Handler::
+* Signals in Handler::
+* Nonreentrancy::
+* Atomic Data Access::
 
 Generating Signals
 
@@ -726,7 +726,7 @@ Waiting for a Signal
 BSD Signal Handling
 
 * BSD Handler::                 BSD Function to Establish a Handler.
-* Blocking in BSD::             BSD Functions for Blocking Signals 
+* Blocking in BSD::             BSD Functions for Blocking Signals
 
 Process Startup and Termination
 
@@ -756,12 +756,12 @@ Program Termination
 
 * Normal Termination::          If a program calls @code{exit}, a
                                  process terminates normally.
-* Exit Status::                 The @code{exit status} provides information 
-                                 about why the process terminated. 
+* Exit Status::                 The @code{exit status} provides information
+                                 about why the process terminated.
 * Cleanups on Exit::            A process can run its own cleanup
-                                 functions upon normal termination. 
+                                 functions upon normal termination.
 * Aborting a Program::          The @code{abort} function causes
-                                 abnormal program termination. 
+                                 abnormal program termination.
 * Termination Internals::       What happens when a process terminates.
 
 
@@ -773,7 +773,7 @@ Child Processes
 * Creating a Process::          How to fork a child process.
 * Executing a File::            How to make a child execute another program.
 * Process Completion::          How to tell when a child process has completed.
-* Process Completion Status::   How to interpret the status value 
+* Process Completion Status::   How to interpret the status value
                                  returned from a child process.
 * BSD Wait Functions::          More functions, for backward compatibility.
 * Process Creation Example::    A complete example program.
@@ -814,11 +814,11 @@ Users and Groups
                                  its user and/or group IDs.
 * How Change Persona::          Restrictions on changing user and group IDs.
 * Reading Persona::             Examining the process's user and group IDs.
-* Setting User ID::             
-* Setting Groups::              
-* Enable/Disable Setuid::       
+* Setting User ID::
+* Setting Groups::
+* Enable/Disable Setuid::
 * Setuid Program Example::      Setuid Program Example
-* Tips for Setuid::             
+* Tips for Setuid::
 * Who Logged In::               Getting the name of the user who logged in,
                                  or of the real user ID of the current process.
 
@@ -831,15 +831,15 @@ Users and Groups
 
 User Database
 
-* User Data Structure::         
-* Lookup User::                 
+* User Data Structure::
+* Lookup User::
 * Scanning All Users::          Scanning the List of All Users
-* Writing a User Entry::        
+* Writing a User Entry::
 
 Group Database
 
-* Group Data Structure::        
-* Lookup Group::                
+* Group Data Structure::
+* Lookup Group::
 * Scanning All Groups::         Scanning the List of All Groups
 
 System Information
@@ -858,17 +858,17 @@ System Configuration Limits
 * Sysconf::			Getting specific configuration values
 				 of general limits and system options.
 * Minimums::			Minimum values for general limits.
-   
+
 * Limits for Files::		Size limitations on individual files.
 				 These can vary between file systems
 				  or even from file to file.
 * Options for Files::		Optional features that some files may support.
 * File Minimums::		Minimum values for file limits.
 * Pathconf::			Getting the limit values for a particular file.
-   
+
 * Utility Limits::		Capacity limits of POSIX.2 utility programs.
 * Utility Minimums::		Minimum allowable values of those limits.
-   
+
 * String Parameters::		Getting the default search path.
 
 Library Facilities that are Part of the C Language
diff --git a/misc/Makefile b/misc/Makefile
index db08014d78..b36e46f09a 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -25,8 +25,8 @@ subdir	:= misc
 headers	:= sys/uio.h iovec.h sys/ioctl.h sys/ptrace.h ioctls.h sys/file.h\
 	   a.out.h nlist.h stab.h stab.def sgtty.h sys/dir.h sys/cdefs.h \
 	   ttyent.h syscall.h syslog.h sys/syslog.h paths.h sys/reboot.h \
-	   sys/mman.h sys/param.h fstab.h mntent.h search.h utmp.h	 \
-	   err.h error.h sys/queue.h sysexits.h
+	   sys/mman.h sys/param.h fstab.h mntent.h search.h err.h error.h\
+	   sys/queue.h sysexits.h
 
 routines := brk sbrk sstk ioctl \
 	    readv writev \
@@ -60,10 +60,6 @@ install-lib := libbsd-compat.a libg.a
 non-lib.a := libbsd-compat.a
 gpl2lgpl := error.c error.h
 
-# Build the -lutil library with these extra functions.
-extra-libs	:= libutil
-libutil-routines:= login login_tty logout logwtmp pty
-
 
 include ../Rules
 
diff --git a/misc/utmp.h b/misc/utmp.h
deleted file mode 100644
index cfd9438f5f..0000000000
--- a/misc/utmp.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *	The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)utmp.h	8.2 (Berkeley) 1/21/94
- */
-
-#ifndef	_UTMP_H_
-#define	_UTMP_H_
-
-#include <sys/cdefs.h>
-
-#define	_PATH_UTMP	"/var/run/utmp"
-#define	_PATH_WTMP	"/var/log/wtmp"
-#define	_PATH_LASTLOG	"/var/log/lastlog"
-
-#define	UT_NAMESIZE	8
-#define	UT_LINESIZE	8
-#define	UT_HOSTSIZE	16
-
-__BEGIN_DECLS
-
-struct lastlog {
-	time_t	ll_time;
-	char	ll_line[UT_LINESIZE];
-	char	ll_host[UT_HOSTSIZE];
-};
-
-struct utmp {
-	char	ut_line[UT_LINESIZE];
-	char	ut_name[UT_NAMESIZE];
-	char	ut_host[UT_HOSTSIZE];
-	long	ut_time;
-};
-
-
-/* Write the given entry into utmp and wtmp.  */
-extern void login __P ((const struct utmp *));
-
-/* Write the utmp entry to say the user on UT_LINE has logged out.  */
-extern int logout __P ((const char *ut_line));
-
-/* Append to wtmp an entry for the current time and the given info.  */
-extern void logwtmp __P ((const char *ut_line, const char *ut_name,
-			  const char *ut_host));
-
-__END_DECLS
-
-#endif /* !_UTMP_H_ */
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index 6872be0b7e..f108f2778f 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -409,8 +409,8 @@ struct hostent *
 gethostbyname(name)
 	const char *name;
 {
-  /* Moved #if line to here because declararing HP would lead to a
-     warining.  --drepper@gnu  */
+  /* Moved #if line to here because declaring HP would lead to a
+     warning.  --drepper@gnu  */
 #if defined(AF_INET6) && defined(RES_TRY_INET6)
 	struct hostent *hp;
 
diff --git a/stdio-common/printf.h b/stdio-common/printf.h
index dfd96bea1e..c84978cfc9 100644
--- a/stdio-common/printf.h
+++ b/stdio-common/printf.h
@@ -34,11 +34,7 @@ struct printf_info
 {
   int prec;			/* Precision.  */
   int width;			/* Width.  */
-#ifdef THIS_IS_INCOMPATIBLE_WITH_LINUX_LIBC
   wchar_t spec;			/* Format letter.  */
-#else
-  char spec;			/* Format letter.  */
-#endif
   unsigned int is_long_double:1;/* L flag.  */
   unsigned int is_short:1;	/* h flag.  */
   unsigned int is_long:1;	/* l flag.  */
@@ -47,6 +43,7 @@ struct printf_info
   unsigned int left:1;		/* - flag.  */
   unsigned int showsign:1;	/* + flag.  */
   unsigned int group:1;		/* ' flag.  */
+  unsigned int extra:1;		/* For special use.  */
   char pad;			/* Padding character.  */
 };
 
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 9e14b67509..9112d467c5 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -121,10 +121,10 @@ extern mp_size_t __mpn_extract_double (mp_ptr res_ptr, mp_size_t size,
 extern mp_size_t __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
 					    int *expt, int *is_neg,
 					    long double value);
+extern unsigned int __guess_grouping (unsigned int intdig_max,
+				      const char *grouping, wchar_t sepchar);
 
 
-static unsigned int guess_grouping (unsigned int intdig_max,
-				    const char *grouping, wchar_t sepchar);
 static char *group_number (char *buf, char *bufend, unsigned int intdig_no,
 			   const char *grouping, wchar_t thousands_sep);
 
@@ -229,22 +229,51 @@ __printf_fp (FILE *fp,
 
 
   /* Figure out the decimal point character.  */
-  if (mbtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
-	      strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT))) <= 0)
-    decimal = (wchar_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
+  if (info->extra == 0)
+    {
+      if (mbtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
+		  strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT))) <= 0)
+	decimal = (wchar_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
+    }
+  else
+    {
+      if (mbtowc (&decimal, _NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT),
+		  strlen (_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT))) <= 0)
+	decimal = (wchar_t) *_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT);
+    }
 
 
   if (info->group)
     {
-      grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
+      if (info->extra == 0)
+	grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
+      else
+	grouping = _NL_CURRENT (LC_MONETARY, MON_GROUPING);
+	
       if (*grouping <= 0 || *grouping == CHAR_MAX)
 	grouping = NULL;
       else
 	{
 	  /* Figure out the thousands seperator character.  */
-	  if (mbtowc (&thousands_sep, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
-		      strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
-	    thousands_sep = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
+	  if (info->extra == 0)
+	    {
+	      if (mbtowc (&thousands_sep, _NL_CURRENT (LC_NUMERIC,
+						       THOUSANDS_SEP),
+			  strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)))
+		  <= 0)
+		thousands_sep = (wchar_t) *_NL_CURRENT (LC_NUMERIC,
+							THOUSANDS_SEP);
+	    }
+	  else
+	    {
+	      if (mbtowc (&thousands_sep, _NL_CURRENT (LC_MONETARY,
+						       MON_THOUSANDS_SEP),
+			  strlen (_NL_CURRENT (LC_MONETARY,
+					       MON_THOUSANDS_SEP))) <= 0)
+		thousands_sep = (wchar_t) *_NL_CURRENT (LC_MONETARY,
+							MON_THOUSANDS_SEP);
+	    }
+	    
 	  if (thousands_sep == L'\0')
 	    grouping = NULL;
 	}
@@ -726,7 +755,7 @@ __printf_fp (FILE *fp,
     if (grouping)
       /* Guess the number of groups we will make, and thus how
 	 many spaces we need for separator characters.  */
-      chars_needed += guess_grouping (intdig_max, grouping, thousands_sep);
+      chars_needed += __guess_grouping (intdig_max, grouping, thousands_sep);
 
     /* Allocate buffer for output.  We need two more because while rounding
        it is possible that we need two more characters in front of all the
@@ -933,8 +962,9 @@ __printf_fp (FILE *fp,
 /* Return the number of extra grouping characters that will be inserted
    into a number with INTDIG_MAX integer digits.  */
 
-static unsigned int
-guess_grouping (unsigned int intdig_max, const char *grouping, wchar_t sepchar)
+unsigned int
+__guess_grouping (unsigned int intdig_max, const char *grouping,
+		  wchar_t sepchar)
 {
   unsigned int groups;
 
@@ -972,7 +1002,7 @@ static char *
 group_number (char *buf, char *bufend, unsigned int intdig_no,
 	      const char *grouping, wchar_t thousands_sep)
 {
-  unsigned int groups = guess_grouping (intdig_no, grouping, thousands_sep);
+  unsigned int groups = __guess_grouping (intdig_no, grouping, thousands_sep);
   char *p;
 
   if (groups == 0)
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 1643f370fd..b27bc493ad 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -414,7 +414,10 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	{								      \
 	  long long int signed_number;					      \
 									      \
-	  signed_number = va_arg (ap, long long int);			      \
+	  if (fspec == NULL)						      \
+	    signed_number = va_arg (ap, long long int);			      \
+	  else								      \
+	    signed_number = args_value[fspec->data_arg].pa_long_long_int;     \
 									      \
 	  is_negative = signed_number < 0;				      \
 	  number.longlong = is_negative ? (- signed_number) : signed_number;  \
@@ -425,10 +428,16 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	{								      \
 	  long int signed_number;					      \
 									      \
-	  if (is_long)							      \
-	    signed_number = va_arg (ap, long int);			      \
-	  else	/* `short int' will be promoted to `int'.  */		      \
-	    signed_number = va_arg (ap, int);				      \
+	  if (fspec == NULL)						      \
+	    if (is_long)						      \
+	      signed_number = va_arg (ap, long int);			      \
+	    else	/* `short int' will be promoted to `int'.  */	      \
+	      signed_number = va_arg (ap, int);				      \
+	  else								      \
+	    if (is_long)						      \
+	      signed_number = args_value[fspec->data_arg].pa_long_int;	      \
+	    else							      \
+	      signed_number = args_value[fspec->data_arg].pa_int;	      \
 									      \
 	  is_negative = signed_number < 0;				      \
 	  number.word = is_negative ? (- signed_number) : signed_number;      \
@@ -463,7 +472,10 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 									      \
       if (is_longlong)							      \
 	{								      \
-	  number.longlong = va_arg (ap, unsigned long long int);	      \
+	  if (fspec == NULL)						      \
+	    number.longlong = va_arg (ap, unsigned long long int);	      \
+	  else								      \
+	    number.longlong = args_value[fspec->data_arg].pa_u_long_long_int; \
 									      \
 	LABEL (longlong_number):					      \
 	  if (prec < 0)							      \
@@ -493,12 +505,21 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	}								      \
       else								      \
 	{								      \
-	  if (is_long)							      \
-	    number.word = va_arg (ap, unsigned long int);		      \
-	  else if (!is_short)						      \
-	    number.word = va_arg (ap, unsigned int);			      \
+	  if (fspec == NULL)						      \
+	    if (is_long)						      \
+	      number.word = va_arg (ap, unsigned long int);		      \
+	    else if (!is_short)						      \
+	      number.word = va_arg (ap, unsigned int);			      \
+	    else							      \
+	      number.word = (unsigned short int) va_arg (ap, unsigned int);   \
 	  else								      \
-	    number.word = (unsigned short int) va_arg (ap, unsigned int);     \
+	    if (is_long)						      \
+	      number.word = args_value[fspec->data_arg].pa_u_long_int;	      \
+	    else if (!is_short)						      \
+	      number.word = args_value[fspec->data_arg].pa_u_int;	      \
+	    else							      \
+	      number.word = (unsigned short int)			      \
+		args_value[fspec->data_arg].pa_u_short_int;		      \
 									      \
 	LABEL (number):							      \
 	  if (prec < 0)							      \
@@ -617,13 +638,6 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	const void *ptr;						      \
 	int function_done;						      \
 									      \
-	if (is_long_double)						      \
-	  the_arg.pa_long_double = va_arg (ap, long double);		      \
-	else								      \
-	  the_arg.pa_double = va_arg (ap, double);			      \
-									      \
-	ptr = (const void *) &the_arg;					      \
-									      \
 	if (fspec == NULL)						      \
 	  {								      \
 	    struct printf_info info = { prec: prec,			      \
@@ -637,12 +651,23 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 					left: left,			      \
 					showsign: showsign,		      \
 					group: group,			      \
-					pad: pad };			      \
+					pad: pad,			      \
+					extra: 0 };			      \
+									      \
+	    if (is_long_double)						      \
+	      the_arg.pa_long_double = va_arg (ap, long double);	      \
+	    else							      \
+	      the_arg.pa_double = va_arg (ap, double);			      \
+	    ptr = (const void *) &the_arg;				      \
 									      \
 	    function_done = __printf_fp (s, &info, &ptr);		      \
 	  }								      \
 	else								      \
-	  function_done = __printf_fp (s, &fspec->info, &ptr);		      \
+	  {								      \
+	    ptr = (const void *) &args_value[fspec->data_arg];		      \
+									      \
+	    function_done = __printf_fp (s, &fspec->info, &ptr);	      \
+	  }								      \
 									      \
 	if (function_done < 0)						      \
 	  /* Error in print handler.  */				      \
@@ -657,7 +682,10 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       --width;	/* Account for the character itself.  */		      \
       if (!left)							      \
 	PAD (' ');							      \
-      outchar ((unsigned char) va_arg (ap, int));	/* Promoted.  */      \
+      if (fspec == NULL)						      \
+	outchar ((unsigned char) va_arg (ap, int));	/* Promoted.  */      \
+      else								      \
+	outchar ((unsigned char) args_value[fspec->data_arg].pa_char);	      \
       if (left)								      \
 	PAD (' ');							      \
       break;								      \
@@ -668,7 +696,10 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 									      \
 	/* The string argument could in fact be `char *' or `wchar_t *'.      \
 	   But this should not make a difference here.  */		      \
-	string = (char *) va_arg (ap, const char *);			      \
+	if (fspec == NULL)						      \
+	  string = (char *) va_arg (ap, const char *);			      \
+	else								      \
+	  string = (char *) args_value[fspec->data_arg].pa_string;	      \
 									      \
 	/* Entry point for printing other strings.  */			      \
       LABEL (print_string):						      \
@@ -738,7 +769,10 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       /* Generic pointer.  */						      \
       {									      \
 	const void *ptr;						      \
-	ptr = va_arg (ap, void *);					      \
+	if (fspec == NULL)						      \
+	  ptr = va_arg (ap, void *);					      \
+	else								      \
+	  ptr = args_value[fspec->data_arg].pa_pointer;			      \
 	if (ptr != NULL)						      \
 	  {								      \
 	    /* If the pointer is not NULL, write it as a %#x spec.  */	      \
@@ -765,14 +799,24 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 									      \
     LABEL (form_number):						      \
       /* Answer the count of characters written.  */			      \
-      if (is_longlong)							      \
-	*(long long int *) va_arg (ap, void *) = done;			      \
-      else if (is_long)							      \
-	*(long int *) va_arg (ap, void *) = done;			      \
-      else if (!is_short)						      \
-	*(int *) va_arg (ap, void *) = done;				      \
+      if (fspec == NULL)						      \
+	if (is_longlong)						      \
+	  *(long long int *) va_arg (ap, void *) = done;		      \
+	else if (is_long)						      \
+	  *(long int *) va_arg (ap, void *) = done;			      \
+	else if (!is_short)						      \
+	  *(int *) va_arg (ap, void *) = done;				      \
+	else								      \
+	  *(short int *) va_arg (ap, void *) = done;			      \
       else								      \
-	*(short int *) va_arg (ap, void *) = done;			      \
+	if (is_longlong)						      \
+	  *(long long int *) args_value[fspec->data_arg].pa_pointer = done;   \
+	else if (is_long)						      \
+	  *(long int *) args_value[fspec->data_arg].pa_pointer = done;	      \
+	else if (!is_short)						      \
+	  *(int *) args_value[fspec->data_arg].pa_pointer = done;	      \
+	else								      \
+	  *(short int *) args_value[fspec->data_arg].pa_pointer = done;	      \
       break;								      \
 									      \
     LABEL (form_strerror):						      \
@@ -827,6 +871,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       STEP0_3_TABLE;
       STEP4_TABLE;
 
+      union printf_arg *args_value;	/* This is not used here but ... */
       int is_negative;	/* Flag for negative number.  */
       union
       {
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 212ea0a54b..ddcc385ab9 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -21,7 +21,7 @@
 #
 subdir	:= stdlib
 
-headers	:= stdlib.h alloca.h
+headers	:= stdlib.h alloca.h monetary.h
 
 routines	:=							      \
 	atof atoi atol							      \
@@ -40,9 +40,9 @@ routines	:=							      \
 	drand48-iter							      \
 	strtol strtoul strtoq strtouq					      \
 	strtof strtod strtold						      \
-	system								      \
+	system realpath							      \
 	a64l l64a							      \
-	rpmatch
+	rpmatch strfmon
 
 distribute	:= exit.h grouping.h
 tests		:= tst-strtol tst-strtod testmb testrand testsort testdiv
diff --git a/stdlib/monetary.h b/stdlib/monetary.h
new file mode 100644
index 0000000000..c2a1bc8d5e
--- /dev/null
+++ b/stdlib/monetary.h
@@ -0,0 +1,36 @@
+/* Header file for monetary value formatting functions.
+Copyright (C) 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., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#ifndef	_MONETARY_H
+
+#define	_MONETARY_H	1
+#include <features.h>
+
+/* Get needed types.  */
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+/* Formating a monetary value according to the current locale.  */
+extern ssize_t strfmon __P ((char *__s, size_t __maxsize,
+			     __const char *__format, ...));
+
+__END_DECLS
+
+#endif	/* monetary.h */
diff --git a/stdlib/strfmon.c b/stdlib/strfmon.c
new file mode 100644
index 0000000000..2074f29e46
--- /dev/null
+++ b/stdlib/strfmon.c
@@ -0,0 +1,504 @@
+/* strfmon -- formating a monetary value according to the current locale
+Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>
+and Jochen Hein <Jochen.Hein@informatik.TU-Clausthal.de>, 1996.
+
+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 <ctype.h>
+#include <errno.h>
+#include <langinfo.h>
+#include <monetary.h>
+#ifdef USE_IN_LIBIO
+# include "../libio/libioP.h"
+# include "../libio/strfile.h"
+#endif
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include "../stdio-common/printf.h"
+#include "../locale/localeinfo.h"
+
+
+#define out_char(Ch)							      \
+  do {									      \
+    if (dest >= s + maxsize - 1)					      \
+      {									      \
+	errno = E2BIG;							      \
+	va_end (ap);							      \
+	return -1;							      \
+      }									      \
+    *dest++ = (Ch);							      \
+  } while (0)
+
+#define out_string(String)						      \
+  do {									      \
+    const char *_s = (String);						      \
+    while (*_s)								      \
+      out_char (*_s++);							      \
+  } while (0)
+
+#define to_digit(Ch) ((Ch) - '0')
+
+extern int __printf_fp (FILE *, const struct printf_info *,
+			const void **const);
+/* This function determines the number of digit groups in the output.
+   The definition is in printf_fp.c.  */
+extern unsigned int __guess_grouping (unsigned int intdig_max,
+				      const char *grouping, wchar_t sepchar);
+
+
+/* We have to overcome some problems with this implementation.  On the
+   one hand the strfmon() function is specified by in XPG4 and of
+   course it has to follow this.  But on the other hand POSIX.2
+   specifies some information in the LC_MONETARY category which should
+   be used, too.  Some of the information contradicts the information
+   which can be specified in format string.  */
+ssize_t
+strfmon (char *s, size_t maxsize, const char *format, ...)
+{
+#ifdef USE_IN_LIBIO
+  _IO_strfile f;
+#else
+  FILE f;
+#endif
+  struct printf_info info;
+  va_list ap;			/* Scan through the varargs.  */
+  char *dest;			/* Pointer so copy the output.  */
+  const char *fmt;		/* Pointer that walks through format.  */
+
+  va_start (ap, format);
+
+  dest = s;
+  fmt = format;
+
+  /* Loop through the format-string.  */
+  while (*fmt != '\0')
+    {
+      /* The floating-point value to output.  */
+      union
+      {
+	double dbl;
+	__long_double_t ldbl;
+      }
+      fpnum;
+      int print_curr_symbol;
+      int left_prec;
+      int right_prec;
+      int group;
+      char pad;
+      int is_long_double;
+      int p_sign_posn;
+      int n_sign_posn;
+      int sign_posn;
+      int left;
+      int is_negative;
+      int sep_by_space;
+      int cs_precedes;
+      char sign_char;
+      int done;
+      const char *currency_symbol;
+      int width;
+      char *startp;
+      const void *ptr;
+
+      /* Process all character which do not introduce a format
+	 specification.  */
+      if (*fmt != '%')
+	{
+	  out_char (*fmt++);
+	  continue;
+	}
+
+      /* "%%" means a single '%' character.  */
+      if (fmt[1] == '%')
+	{
+	  out_char (*++fmt);
+	  ++fmt;
+	  continue;
+	}
+
+      /* Defaults for formatting.  */
+      print_curr_symbol = 1;		/* Print the currency symbol.  */
+      left_prec = -1;			/* No left precision specified.  */
+      right_prec = -1;			/* No right precision specified.  */
+      group = 1;			/* Print digits grouped.  */
+      pad = ' ';			/* Fill character is <SP>.  */
+      is_long_double = 0;		/* Double argument by default.  */
+      p_sign_posn = -1;			/* This indicates whether the */
+      n_sign_posn = -1;			/* '(' flag is given.  */
+      width = -1;			/* No width specified so far.  */
+      left = 0;				/* Right justified by default.  */
+
+      /* Parse group characters.  */
+      while (1)
+	{
+	  switch (*++fmt)
+	    {
+	    case '=':			/* Set fill character.  */
+	      pad = *++fmt;
+	      continue;
+	    case '^':			/* Don't group digits.  */
+	      group = 0;
+	      continue;
+	    case '+':			/* Use +/- for sign of number.  */
+	      if (n_sign_posn != -1)
+		{
+		  errno = EINVAL;
+		  va_end (ap);
+		  return -1;
+		}
+	      if (*_NL_CURRENT (LC_MONETARY, P_SIGN_POSN) == '\0')
+		p_sign_posn = 1;
+	      else
+		p_sign_posn = *_NL_CURRENT (LC_MONETARY, P_SIGN_POSN);
+	      if (*_NL_CURRENT (LC_MONETARY, N_SIGN_POSN) == '\0')
+		n_sign_posn = 1;
+	      else
+		n_sign_posn = *_NL_CURRENT (LC_MONETARY, N_SIGN_POSN);
+	      continue;
+	    case '(':			/* Use ( ) for negative sign.  */
+	      if (n_sign_posn != -1)
+		{
+		  errno = EINVAL;
+		  va_end (ap);
+		  return -1;
+		}
+	      n_sign_posn = 5;	/* This is a else unused value.  */
+	      continue;
+	    case '!':			/* Don't print the currency symbol.  */
+	      print_curr_symbol = 0;
+	      continue;
+	    case '-':			/* Print left justified.  */
+	      left = 1;
+	      continue;
+	    default:
+	      /* Will stop the loop.  */;
+	    }
+	  break;
+	}
+
+      if (isdigit (*fmt))
+	{
+	  /* Parse field width.  */
+	  width = to_digit (*fmt);
+
+	  while (isdigit (*++fmt))
+	    {
+	      width *= 10;
+	      width += to_digit (*fmt);
+	    }
+
+	  /* If we don't have enough room for the demanded width we
+	     can stop now and return an error.  */
+	  if (dest + width >= s + maxsize)
+	    {
+	      errno = E2BIG;
+	      va_end (ap);
+	      return -1;
+	    }
+	}
+
+      /* Recognize left precision.  */
+      if (*fmt == '#')
+	{
+	  if (!isdigit (*++fmt))
+	    {
+	      errno = EINVAL;
+	      va_end (ap);
+	      return -1;
+	    }
+	  left_prec = to_digit (*fmt);
+
+	  while (isdigit (*++fmt))
+	    {
+	      left_prec *= 10;
+	      left_prec += to_digit (*fmt);
+	    }
+	}
+
+      /* Recognize right precision.  */
+      if (*fmt == '.')
+	{
+	  if (!isdigit (*++fmt))
+	    {
+	      errno = EINVAL;
+	      va_end (ap);
+	      return -1;
+	    }
+	  right_prec = to_digit (*fmt);
+
+	  while (isdigit (*++fmt))
+	    {
+	      right_prec *= 10;
+	      right_prec += to_digit (*fmt);
+	    }
+	}
+
+      /* Handle modifier.  This is an extension.  */
+      if (*fmt == 'L')
+	{
+	  ++fmt;
+	  is_long_double = 1;
+	}
+      
+      /* Handle format specifier.  */
+      switch (*fmt++)
+	{
+	case 'i':		/* Use international currency symbol.  */
+	  currency_symbol = _NL_CURRENT (LC_MONETARY, INT_CURR_SYMBOL);
+	  if (right_prec == -1)
+	    if (*_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS) == '\177')
+	      right_prec = 2;
+	    else
+	      right_prec = *_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS);
+	  break;
+	case 'n':		/* Use national currency symbol.  */
+	  currency_symbol = _NL_CURRENT (LC_MONETARY, CURRENCY_SYMBOL);
+	  if (right_prec == -1)
+	    if (*_NL_CURRENT (LC_MONETARY, FRAC_DIGITS) == '\177')
+	      right_prec = 2;
+	    else
+	      right_prec = *_NL_CURRENT (LC_MONETARY, FRAC_DIGITS);
+	  break;
+	default:		/* Any unrecognized format is an error.  */
+	  errno = EINVAL;
+	  va_end (ap);
+	  return -1;
+	}
+
+      /* If we have to print the digits grouped determine how many
+	 extra characters this means.  */
+      if (group && left_prec != -1)
+	left_prec += __guess_grouping (left_prec,
+				       _NL_CURRENT (LC_MONETARY, MON_GROUPING),
+				       *_NL_CURRENT (LC_MONETARY,
+						     MON_THOUSANDS_SEP));
+      
+      /* Now it's time to get the value.  */
+      if (is_long_double == 1)
+	{
+	  fpnum.ldbl = va_arg (ap, long double);
+	  is_negative = fpnum.ldbl < 0;
+	  if (is_negative)
+	    fpnum.ldbl = -fpnum.ldbl;
+	}
+      else
+	{
+	  fpnum.dbl = va_arg (ap, double);
+	  is_negative = fpnum.dbl < 0;
+	  if (is_negative)
+	    fpnum.dbl = -fpnum.dbl;
+	}
+
+      /* We now know the sign of the value and can determine the format.  */
+      if (is_negative)
+	{
+	  sign_char = *_NL_CURRENT (LC_MONETARY, NEGATIVE_SIGN);
+	  /* If the locale does not specify a character for the
+	     negative sign we use a '-'.  */
+	  if (sign_char == '\0')
+	    sign_char = '-';
+	  cs_precedes = *_NL_CURRENT (LC_MONETARY, N_CS_PRECEDES);
+	  sep_by_space = *_NL_CURRENT (LC_MONETARY, N_SEP_BY_SPACE);
+	  /* If the '(' flag is not given use the sign position from
+	     the current locale.  */
+	  if (n_sign_posn == -1)
+	    sign_posn = *_NL_CURRENT (LC_MONETARY, N_SIGN_POSN);
+	  else
+	    /* This means use parentheses.  */
+	    sign_posn = 0;
+	}
+      else
+	{
+	  sign_char = *_NL_CURRENT (LC_MONETARY, POSITIVE_SIGN);
+	  /* If the locale does not specify a character for the
+	     positive sign we use a <SP>.  */
+	  if (sign_char == '\0')
+	    sign_char = ' ';
+	  cs_precedes = *_NL_CURRENT (LC_MONETARY, P_CS_PRECEDES);
+	  sep_by_space = *_NL_CURRENT (LC_MONETARY, P_SEP_BY_SPACE);
+	  if (n_sign_posn == -1)
+	    sign_posn = *_NL_CURRENT (LC_MONETARY, P_SIGN_POSN);
+	  else
+	    /* Here we don't set SIGN_POSN to 0 because we don'want to
+	       print <SP> instead of the braces and this is what the
+	       value 5 means.  */
+	    sign_posn = 5;
+	}
+
+      /* Set default values for unspecified information.  */
+      if (cs_precedes != 0)
+	cs_precedes = 1;
+      if (sep_by_space == 127)
+	sep_by_space = 0;
+      if (left_prec == -1)
+	left_prec = 0;
+	
+
+      /* Perhaps we'll someday make these things configurable so
+	 better start using symbolic names now.  */
+#define left_paren '('
+#define right_paren ')'
+
+      startp = dest;		/* Remember start so we can compute lenght.  */
+      
+      if (sign_posn == 0)
+	out_char (left_paren);
+      if (sign_posn == 5)	/* This is for positive number and ( flag.  */
+	out_char (' ');
+
+      if (cs_precedes)
+	{
+	  if (sign_posn != 0 && sign_posn != 2 && sign_posn != 4
+	      && sign_posn != 5)
+	    {
+	      out_char (sign_char);
+	      if (sep_by_space == 2)
+		out_char (' ');
+	    }
+	  
+	  if (print_curr_symbol)
+	    {
+	      out_string (currency_symbol);
+
+	      if (sign_posn == 4)
+		{
+		  if (sep_by_space == 2)
+		    out_char (' ');
+		  out_char (sign_char);
+		}
+	      else
+		if (sep_by_space == 1)
+		  out_char (' ');
+	    }
+	}
+      else
+	if (sign_posn != 0 && sign_posn != 2 && sign_posn != 3
+	    && sign_posn != 4 && sign_posn != 5)
+	  out_char (sign_char);
+
+      /* Print the number.  */
+#ifdef USE_IN_LIBIO
+      _IO_init ((_IO_FILE *) &f, 0);
+      _IO_JUMPS ((_IO_FILE *) &f) = &_IO_str_jumps;
+      _IO_str_init_static ((_IO_FILE *) &f, dest, (s + maxsize) - dest, dest);
+#else
+      memset((PTR) &f, 0, sizeof(f));
+      f.__magic = _IOMAGIC;
+      f.__mode.__write = 1;
+      /* The buffer size is one less than MAXLEN
+	 so we have space for the null terminator.  */
+      f.__bufp = f.__buffer = (char *) dest;
+      f.__bufsize = (s + maxsize) - dest;
+      f.__put_limit = f.__buffer + f.__bufsize;
+      f.__get_limit = f.__buffer;
+      /* After the buffer is full (MAXLEN characters have been written),
+	 any more characters written will go to the bit bucket.  */
+      f.__room_funcs = __default_room_functions;
+      f.__io_funcs.__write = NULL;
+      f.__seen = 1;
+#endif
+      /* We clear the last available byte so we can find out whether
+	 the numeric representation is too long.  */
+      s[maxsize - 1] = '\0';
+
+      info.prec = right_prec;
+      info.width = left_prec + (right_prec ? (right_prec + 1) : 0);
+      info.spec = 'f';
+      info.is_long_double = is_long_double;
+      info.is_short = 0;
+      info.is_long = 0;
+      info.alt = 0;
+      info.space = 0;
+      info.left = left;
+      info.showsign = 0;
+      info.group = group;
+      info.pad = pad;
+      info.extra = 1;		/* This means use values from LC_MONETARY.  */
+
+      ptr = &fpnum;
+      done = __printf_fp ((FILE *) &f, &info, &ptr);
+      if (done < 0)
+	{
+	  va_end (ap);
+	  return -1;
+	}
+
+      if (s[maxsize - 1] != '\0')
+	return -1;
+
+      dest += done;
+      
+      if (!cs_precedes)
+	{
+	  if (sign_posn == 3)
+	    {
+	      if (sep_by_space == 1)
+		out_char (' ');
+	      out_char (sign_char);
+	    }
+
+	  if (print_curr_symbol)
+	    {
+	      if (sign_posn == 3 && sep_by_space == 2)
+		out_char (' ');
+	      out_string (currency_symbol);
+	    }
+	}
+      else
+	if (sign_posn == 2)
+	  {
+	    if (sep_by_space == 2)
+	      out_char (' ');
+	    out_char (sign_char);
+	  }
+      
+      if (sign_posn == 0)
+	out_char (right_paren);
+      if (sign_posn == 5)
+	out_char (' ');		/* This is for positive number and ( flag.  */
+
+      /* Now test whether the output width is filled.  */
+      if (dest - startp < width)
+	if (left)
+	  /* We simply have to fill using spaces.  */
+	  do
+	    out_char (' ');
+	  while (dest - startp < width);
+	else
+	  {
+	    int dist = width - (dest - startp);
+	    char *cp;
+	    for (cp = dest - 1; cp >= startp; --cp)
+	      cp[dist] = cp[0];
+
+	    dest += dist;
+
+	    do
+	      startp[--dist] = ' ';
+	    while (dist > 0);
+	  }
+    }
+
+  /* Terminate the string.  */
+  out_char ('\0');
+  
+  va_end (ap);
+
+  return dest - s - 1;
+}
diff --git a/stdlib/strtol.c b/stdlib/strtol.c
index 2a2a8ea5e7..3b073ce333 100644
--- a/stdlib/strtol.c
+++ b/stdlib/strtol.c
@@ -105,6 +105,13 @@ extern int errno;
 # endif
 #else
 # define LONG long
+
+#ifndef ULONG_MAX
+# define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
+#endif
+#ifndef LONG_MAX
+# define LONG_MAX ((long int) (ULONG_MAX >> 1))
+#endif
 #endif
 
 #ifdef USE_WIDE_CHAR
@@ -128,8 +135,11 @@ extern int errno;
 #ifdef __STDC__
 # define INTERNAL(x) INTERNAL1(x)
 # define INTERNAL1(x) __##x##_internal
+# define WEAKNAME(x) WEAKNAME1(x)
+# define WEAKNAME1(x) __##x
 #else
 # define INTERNAL(x) __/**/x/**/_internal
+# define WEAKNAME(x) __/**/x
 #endif
 
 #ifdef USE_NUMBER_GROUPING
@@ -290,8 +300,10 @@ INTERNAL (strtol) (nptr, endptr, base, group)
 #if !UNSIGNED
   /* Check for a value that is within the range of
      `unsigned LONG int', but outside the range of `LONG int'.  */
-  if (i > (negative ?
-	   -(unsigned LONG int) LONG_MIN : (unsigned LONG int) LONG_MAX))
+  if (overflow == 0
+      && i > (negative
+	      ? -((unsigned LONG int) (LONG_MIN + 1)) + 1
+	      : (unsigned LONG int) LONG_MAX))
     overflow = 1;
 #endif
 
@@ -326,8 +338,13 @@ noconv:
 
 /* External user entry point.  */
 
+/* Prototype.  */
+INT WEAKNAME (strtol) __P ((const STRING_TYPE *nptr, STRING_TYPE **endptr,
+			    int base));
+
+
 INT
-strtol (nptr, endptr, base)
+WEAKNAME (strtol) (nptr, endptr, base)
      const STRING_TYPE *nptr;
      STRING_TYPE **endptr;
      int base;
@@ -335,9 +352,9 @@ strtol (nptr, endptr, base)
   return INTERNAL (strtol) (nptr, endptr, base, 0);
 }
 
-#ifdef weak_symbol
+#ifdef weak_alias
 /* We need this indirection when `strtol' is defined as a macro
    for one of the other names.  */
-#define weak1(x) weak_symbol(x)
-weak1 (strtol)
+#define weak1(x, y) weak_alias (x, y)
+weak1 (WEAKNAME (strtol), strtol)
 #endif
diff --git a/sysdeps/generic/utmpbits.h b/sysdeps/generic/utmpbits.h
new file mode 100644
index 0000000000..3189ff0fdf
--- /dev/null
+++ b/sysdeps/generic/utmpbits.h
@@ -0,0 +1,52 @@
+/* The `struct utmp' type, describing entries in the utmp file.  Generic/BSDish
+Copyright (C) 1993, 1996 Free Software Foundation, Inc.
+
+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.  */
+
+#ifndef _UTMPBITS_H
+
+#define _UTMPBITS_H	1
+#include <features.h>
+
+#include <time.h>
+
+#define	_PATH_UTMP	"/var/run/utmp"
+#define	_PATH_WTMP	"/var/log/wtmp"
+#define	_PATH_LASTLOG	"/var/log/lastlog"
+
+#define	UT_NAMESIZE	8
+#define	UT_LINESIZE	8
+#define	UT_HOSTSIZE	16
+
+__BEGIN_DECLS
+
+struct lastlog {
+	time_t	ll_time;
+	char	ll_line[UT_LINESIZE];
+	char	ll_host[UT_HOSTSIZE];
+};
+
+struct utmp {
+	char	ut_line[UT_LINESIZE];
+	char	ut_name[UT_NAMESIZE];
+	char	ut_host[UT_HOSTSIZE];
+	long	ut_time;
+};
+
+__END_DECLS
+
+#endif /* utmpbits.h */
+
diff --git a/sysdeps/gnu/utmpbits.h b/sysdeps/gnu/utmpbits.h
new file mode 100644
index 0000000000..8b939cee86
--- /dev/null
+++ b/sysdeps/gnu/utmpbits.h
@@ -0,0 +1,83 @@
+/* The `struct utmp' type, describing entries in the utmp file.  GNU version.
+Copyright (C) 1993, 1996 Free Software Foundation, Inc.
+
+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.  */
+
+#ifndef _UTMPBITS_H
+
+#define _UTMPBITS_H	1
+#include <features.h>
+
+#include <sys/time.h>
+#include <sys/types.h>
+
+#define _PATH_UTMP	"/var/run/utmp"
+#define _PATH_WTMP	"/var/log/wtmp"
+#define _PATH_LASTLOG	"/var/log/lastlog"
+
+#define UTMP_FILE	_PATH_UTMP
+#define WTMP_FILE	_PATH_WTMP
+#define UTMP_FILENAME	UTMP_FILE
+#define WTMP_FILENAME	WTMP_FILE
+
+#define UT_UNKNOWN	0	/* for ut_type field */
+
+#define RUN_LVL		1
+#define BOOT_TIME	2
+#define NEW_TIME	3
+#define OLD_TIME	4
+
+#define INIT_PROCESS	5
+#define LOGIN_PROCESS	6
+#define USER_PROCESS	7
+#define DEAD_PROCESS	8
+
+#define ut_name	ut_user
+
+#define UT_LINESIZE	32
+#define UT_NAMESIZE	32
+#define UT_HOSTSIZE	256
+
+__BEGIN_DECLS
+
+struct lastlog
+{
+  time_t ll_time;
+  char ll_line[UT_LINESIZE];
+  char ll_host[UT_HOSTSIZE];
+};
+
+struct utmp
+{
+  short int ut_type;		/* Type of login.  */
+  pid_t ut_pid;			/* Pid of login process.  */
+  char ut_line[UT_LINESIZE];	/* NUL-terminated devicename of tty.  */
+  char ut_id[4];		/* Inittab id. */
+  char ut_user[UT_NAMESIZE];	/* Username (not NUL terminated).  */
+  char ut_host[UT_HOSTSIZE];	/* Hostname for remote login.  */
+  int ut_exit;			/* Process termination/exit status.  */
+  struct timeval ut_tv;		/* Time entry was made.  */
+  long ut_session;		/* Session ID, used for windowing.  */
+  int32_t ut_addr;		/* Internet address of remote host.  */
+  char pad[32];			/* Reserved for future use.  */
+};
+
+#define ut_time	ut_tv.tv_sec	/* Backwards compatibility.  */
+
+__END_DECLS
+
+#endif /* !_UTMP_H_ */
+
diff --git a/sysdeps/mach/hurd/Implies b/sysdeps/mach/hurd/Implies
index b6e4d864d5..b6063463ce 100644
--- a/sysdeps/mach/hurd/Implies
+++ b/sysdeps/mach/hurd/Implies
@@ -1,2 +1,5 @@
+# The gnu subdirectory exists for things common to both Linux-based and
+# Hurd-based GNU systems.
+gnu
 # The Hurd provides a rough superset of the functionality of 4.4 BSD.
 unix/bsd/bsd4.4
diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c
index feaa9a2ed3..e50bdfbb8c 100644
--- a/sysdeps/posix/euidaccess.c
+++ b/sysdeps/posix/euidaccess.c
@@ -78,6 +78,16 @@ extern int errno;
 #define R_OK 4
 #endif
 
+#if !defined (S_IROTH) && defined (R_OK)
+# define S_IROTH R_OK
+#endif
+#if !defined (S_IWOTH) && defined (W_OK)
+# define S_IWOTH W_OK
+#endif
+#if !defined (S_IXOTH) && defined (X_OK)
+# define S_IXOTH X_OK
+#endif
+
 
 #ifdef _LIBC
 
diff --git a/sysdeps/unix/sysv/linux/Implies b/sysdeps/unix/sysv/linux/Implies
index 41c26f20f9..4deb1c6245 100644
--- a/sysdeps/unix/sysv/linux/Implies
+++ b/sysdeps/unix/sysv/linux/Implies
@@ -1,3 +1,7 @@
+# The gnu subdirectory exists for things common to both Linux-based and
+# Hurd-based GNU systems.
+gnu
+
 # Linux shares most of the syscalls which are also common to BSD and SVR4.
 unix/common
 
diff --git a/sysdeps/unix/sysv/linux/i386/sys/vm86.h b/sysdeps/unix/sysv/linux/i386/sys/vm86.h
index 32e0055ce8..fd3c2b34f8 100644
--- a/sysdeps/unix/sysv/linux/i386/sys/vm86.h
+++ b/sysdeps/unix/sysv/linux/i386/sys/vm86.h
@@ -22,7 +22,7 @@ Boston, MA 02111-1307, USA.  */
 #include <features.h>
 
 /* Get constants and data types from kernel header file.  */
-#include <linux/vm86.h>
+#include <asm/vm86.h>
 
 __BEGIN_DECLS
 
diff --git a/sysdeps/unix/sysv/utmp.h b/sysdeps/unix/sysv/utmp.h
deleted file mode 100644
index 4c3d33e987..0000000000
--- a/sysdeps/unix/sysv/utmp.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef _UTMP_H
-
-#define _UTMP_H	1
-
-#include <time.h>
-
-struct utmp
-  {
-#define	ut_name	ut_user
-    char ut_user[8];
-    char ut_id[4];
-    char ut_line[12];
-    short ut_pid;
-    short ut_type;
-    struct exit_status
-      {
-	short e_termination;
-	short e_exit;
-      } ut_exit;
-    time_t ut_time;
-  };
-
-#endif /* utmp.h.  */
diff --git a/sysdeps/unix/sysv/utmpbits.h b/sysdeps/unix/sysv/utmpbits.h
new file mode 100644
index 0000000000..e8d9334af1
--- /dev/null
+++ b/sysdeps/unix/sysv/utmpbits.h
@@ -0,0 +1,42 @@
+/* The `struct utmp' type, describing entries in the utmp file.  System V.
+Copyright (C) 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.  */
+
+#ifndef _UTMPBITS_H
+
+#define _UTMPBITS_H	1
+
+#include <time.h>
+
+struct utmp
+  {
+#define	ut_name	ut_user
+    char ut_user[8];
+    char ut_id[4];
+    char ut_line[12];
+    short ut_pid;
+    short ut_type;
+    struct exit_status
+      {
+	short e_termination;
+	short e_exit;
+      } ut_exit;
+    time_t ut_time;
+  };
+
+#endif /* utmpbits.h  */