summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-12-02 04:00:15 +0000
committerUlrich Drepper <drepper@redhat.com>1996-12-02 04:00:15 +0000
commite4cf5070694529a8779d5e1581567bcfb9307da0 (patch)
treea0ea63fe9d81e75431c6c37340810c850e53c736
parenta401eea9eb827caa393c3206fa6f3939ea067e94 (diff)
downloadglibc-e4cf5070694529a8779d5e1581567bcfb9307da0.tar.gz
glibc-e4cf5070694529a8779d5e1581567bcfb9307da0.tar.xz
glibc-e4cf5070694529a8779d5e1581567bcfb9307da0.zip
update from main archive 961201 cvs/libc-961202
Mon Dec  2 03:59:38 1996  Ulrich Drepper  <drepper@cygnus.com>

	* grp/initgroups.c: Update and reformat copyright.
	Use __getgrent_r instead of getgrent.

	* inet/rcmd.c: Update and reformat copyright.
	Use __gethostbyname_r instead of gethostbyname.
	* inet/rexec.c: Likewise.

	* intl/finddomain.c: Correct comment about CEN sponsor and revision.
	* locale/findlocale.c: Likewise.
	* intl/l10nflist.c: Correct handling of CEN sponsor and revision.
	* locale/Makefile (CPPFLAGS): Add definition of LOCALEDIR.
	* locale/setlocale.c (setlocale): Correctly split value of
	LOCALE_PATH.
	* locale/programs/localedef.c: Use LOCALEDIR not LOCALE_PATH to
	find output directory.

	* nss/getXXbyYY.c [NEED_H_ERRNO]: Before enlarging buffer test
	h_errno_tmp variable.
	Save error value from being changed during `free' call.
	* nss/getXXent.c: Likewise.

	* nss/nss_files/files-XXX.c: Set h_errno variable to NETDB_INTERNAL
	before returning ERANGE error.

	* posix/glob.c: Use getlogin_r and getpwnam_r function when available
	or in GNU libc.

	* pwd/getpw.c: Use getpwuid_r instead of getpwuid.

	* sunrpc/clnt_gen.c: Use gethostbyname_r and getprotobyname_r.
	* sunrpc/clnt_simp.c: Likewise.
	* sunrpc/getrpcport.c: Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c: Likewise.

	* posix/getconf.c: Treat _SC_UNIT_MAX and _SC_ULONG_MAX separately
	since the value might be outsode the range of the `long int'.
	Print string `undefined' when a value is undefined.

	* stdlib/l64a.c: Return correct pointer.
	Patch by NIIBE Yutaka <gniibe@mri.co.jp>.

	* string/Makefile (routines): Add argz-addsep.
	* string/argz-addsep.c: New file.
	* string/argz.h: Add prototypes for argz_add_sep.

	* string/argz-ctsep.c: Prevent memory leak.

	* string/strcoll.c: Correct typo in comment.

Sat Nov 30 02:53:59 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/sys/serial.h: Removed again.  The file is
	not general enough to be part of the libc.
	* sysdeps/unix/sysv/linux/Dist: Remove sys/serial.h.
	* sysdeps/unix/sysv/linux/Makefile: Don't install sys/serial.h.

Thu Nov 28 20:04:41 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* login/Makefile: Fix typo.

	* nss/Makefile (generated): Filter out db-alias.c.

Thu Nov 28 14:44:01 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* time/Makefile (echo-zonenames): Don't depend on non-existing
	target `zonenames'.

Thu Nov 28 12:34:05 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* link.h: New file.
	* nss/nsswitch.c: Use it.

	* printf.h: Fix file name.
	* stdlib/strfmon.c: Use it.
-rw-r--r--ChangeLog77
-rw-r--r--grp/initgroups.c33
-rw-r--r--inet/rcmd.c76
-rw-r--r--inet/rexec.c27
-rw-r--r--intl/finddomain.c30
-rw-r--r--intl/l10nflist.c54
-rw-r--r--link.h1
-rw-r--r--locale/Makefile11
-rw-r--r--locale/findlocale.c30
-rw-r--r--locale/programs/localedef.c32
-rw-r--r--locale/setlocale.c3
-rw-r--r--login/Makefile2
-rw-r--r--nss/Makefile2
-rw-r--r--nss/getXXbyYY.c13
-rw-r--r--nss/getXXent.c13
-rw-r--r--nss/nss_files/files-XXX.c1
-rw-r--r--nss/nsswitch.c2
-rw-r--r--posix/getconf.c9
-rw-r--r--posix/glob.c45
-rw-r--r--printf.h2
-rw-r--r--pwd/getpw.c40
-rw-r--r--stdlib/l64a.c2
-rw-r--r--stdlib/strfmon.c2
-rw-r--r--string/Makefile3
-rw-r--r--string/argz-addsep.c59
-rw-r--r--string/argz-ctsep.c47
-rw-r--r--string/argz.h7
-rw-r--r--string/strcoll.c2
-rw-r--r--sunrpc/clnt_gen.c70
-rw-r--r--sunrpc/clnt_simp.c24
-rw-r--r--sunrpc/getrpcport.c33
-rw-r--r--sysdeps/unix/sysv/linux/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/Makefile3
-rw-r--r--sysdeps/unix/sysv/linux/gethostid.c54
-rw-r--r--sysdeps/unix/sysv/linux/sys/serial.h110
-rw-r--r--time/Makefile2
36 files changed, 588 insertions, 334 deletions
diff --git a/ChangeLog b/ChangeLog
index 4958fa02a6..f521814da2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,80 @@
+Mon Dec  2 03:59:38 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* grp/initgroups.c: Update and reformat copyright.
+	Use __getgrent_r instead of getgrent.
+
+	* inet/rcmd.c: Update and reformat copyright.
+	Use __gethostbyname_r instead of gethostbyname.
+	* inet/rexec.c: Likewise.
+
+	* intl/finddomain.c: Correct comment about CEN sponsor and revision.
+	* locale/findlocale.c: Likewise.
+	* intl/l10nflist.c: Correct handling of CEN sponsor and revision.
+	* locale/Makefile (CPPFLAGS): Add definition of LOCALEDIR.
+	* locale/setlocale.c (setlocale): Correctly split value of
+	LOCALE_PATH.
+	* locale/programs/localedef.c: Use LOCALEDIR not LOCALE_PATH to
+	find output directory.
+
+	* nss/getXXbyYY.c [NEED_H_ERRNO]: Before enlarging buffer test
+	h_errno_tmp variable.
+	Save error value from being changed during `free' call.
+	* nss/getXXent.c: Likewise.
+
+	* nss/nss_files/files-XXX.c: Set h_errno variable to NETDB_INTERNAL
+	before returning ERANGE error.
+
+	* posix/glob.c: Use getlogin_r and getpwnam_r function when available
+	or in GNU libc.
+
+	* pwd/getpw.c: Use getpwuid_r instead of getpwuid.
+
+	* sunrpc/clnt_gen.c: Use gethostbyname_r and getprotobyname_r.
+	* sunrpc/clnt_simp.c: Likewise.
+	* sunrpc/getrpcport.c: Likewise.
+	* sysdeps/unix/sysv/linux/gethostid.c: Likewise.
+
+	* posix/getconf.c: Treat _SC_UNIT_MAX and _SC_ULONG_MAX separately
+	since the value might be outsode the range of the `long int'.
+	Print string `undefined' when a value is undefined.
+
+	* stdlib/l64a.c: Return correct pointer.
+	Patch by NIIBE Yutaka <gniibe@mri.co.jp>.
+
+	* string/Makefile (routines): Add argz-addsep.
+	* string/argz-addsep.c: New file.
+	* string/argz.h: Add prototypes for argz_add_sep.
+
+	* string/argz-ctsep.c: Prevent memory leak.
+
+	* string/strcoll.c: Correct typo in comment.
+
+Sat Nov 30 02:53:59 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/unix/sysv/linux/sys/serial.h: Removed again.  The file is
+	not general enough to be part of the libc.
+	* sysdeps/unix/sysv/linux/Dist: Remove sys/serial.h.
+	* sysdeps/unix/sysv/linux/Makefile: Don't install sys/serial.h.
+
+Thu Nov 28 20:04:41 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* login/Makefile: Fix typo.
+
+	* nss/Makefile (generated): Filter out db-alias.c.
+
+Thu Nov 28 14:44:01 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* time/Makefile (echo-zonenames): Don't depend on non-existing
+	target `zonenames'.
+
+Thu Nov 28 12:34:05 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* link.h: New file.
+	* nss/nsswitch.c: Use it.
+
+	* printf.h: Fix file name.
+	* stdlib/strfmon.c: Use it.
+
 Thu Nov 28 23:03:32 1996  Ulrich Drepper  <drepper@cygnus.com>
 
 	* sysdeps/unix/sysv/linux/netinet/in_systm.h: New file.
diff --git a/grp/initgroups.c b/grp/initgroups.c
index 35af575ac7..a659f0d3ae 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -1,20 +1,20 @@
 /* Copyright (C) 1989, 1991, 1993, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <alloca.h>
 #include <unistd.h>
@@ -39,7 +39,9 @@ initgroups (user, group)
 
 #else
 
-  struct group *g;
+  struct group grpbuf, *g;
+  size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
+  char *tmpbuf;
   register size_t n;
   size_t ngroups;
   gid_t *groups;
@@ -58,13 +60,14 @@ initgroups (user, group)
 #endif
 
   groups = __alloca (ngroups * sizeof *groups);
+  tmpbuf = __alloca (buflen);
 
   setgrent ();
 
   n = 0;
   groups[n++] = group;
 
-  while ((g = getgrent ()) != NULL)
+  while (__getgrent_r (&grpbuf, tmpbuf, buflen, &g) >= 0)
     if (g->gr_gid != group)
       {
 	register char **m;
diff --git a/inet/rcmd.c b/inet/rcmd.c
index 3fc8adc742..2631523a22 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)rcmd.c	8.3 (Berkeley) 3/26/94";
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+#include <alloca.h>
 #include <signal.h>
 #include <fcntl.h>
 #include <netdb.h>
@@ -63,20 +64,35 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
 	const char *locuser, *remuser, *cmd;
 	int *fd2p;
 {
-	struct hostent *hp;
+	struct hostent hostbuf, *hp;
+	size_t hstbuflen;
+	char *tmphstbuf;
 	struct sockaddr_in sin, from;
 	fd_set reads;
 	int32_t oldmask;
 	pid_t pid;
 	int s, lport, timo;
 	char c;
+	int herr;
 
 	pid = getpid();
-	hp = gethostbyname(*ahost);
-	if (hp == NULL) {
-		herror(*ahost);
-		return (-1);
-	}
+
+	hstbuflen = 1024;
+	tmphstbuf = __alloca (hstbuflen);
+	while (__gethostbyname_r (*ahost, &hostbuf, tmphstbuf, hstbuflen,
+				  &hp, &herr) < 0)
+	  if (herr != NETDB_INTERNAL || errno != ERANGE)
+	    {
+	      herror(*ahost);
+	      return -1;
+	    }
+	  else
+	    {
+	      /* Enlarge the buffer.  */
+	      hstbuflen *= 2;
+	      tmphstbuf = __alloca (hstbuflen);
+	    }
+
 	*ahost = hp->h_name;
 	oldmask = sigblock(sigmask(SIGURG));
 	for (timo = 1, lport = IPPORT_RESERVED - 1;;) {
@@ -244,12 +260,27 @@ ruserok(rhost, superuser, ruser, luser)
 	const char *rhost, *ruser, *luser;
 	int superuser;
 {
-	struct hostent *hp;
+	struct hostent hostbuf, *hp;
+	size_t buflen;
+	char *buffer;
 	u_int32_t addr;
 	char **ap;
+	int herr;
+
+	buflen = 1024;
+	buffer = __alloca (buflen);
+
+	while (__gethostbyname_r (rhost, &hostbuf, buffer, buflen, &hp, &herr)
+	       < 0)
+	  if (herr != NETDB_INTERNAL || errno != ERANGE)
+	    return -1;
+	  else
+	    {
+	      /* Enlarge the buffer.  */
+	      buflen *= 2;
+	      buffer = __alloca (buflen);
+	    }
 
-	if ((hp = gethostbyname(rhost)) == NULL)
-		return (-1);
 	for (ap = hp->h_addr_list; *ap; ++ap) {
 		bcopy(*ap, &addr, sizeof(addr));
 		if (iruserok(addr, superuser, ruser, luser) == 0)
@@ -275,7 +306,7 @@ iruserok(raddr, superuser, ruser, luser)
 {
 	register char *cp;
 	struct stat sbuf;
-	struct passwd *pwd;
+	struct passwd pwdbuf, *pwd;
 	FILE *hostf;
 	uid_t uid;
 	int first;
@@ -293,10 +324,12 @@ again:
 	if (first == 1 && (__check_rhosts_file || superuser)) {
 		char *pbuf;
 		size_t dirlen;
+		size_t buflen = __sysconf (_SC_GETPW_R_SIZE_MAX);
+		char buffer = __alloca (buflen);
 
 		first = 0;
-		if ((pwd = getpwnam(luser)) == NULL)
-			return (-1);
+		if (getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0)
+			return -1;
 
 		dirlen = strlen (pwd->pw_dir);
 		pbuf = alloca (dirlen + sizeof "/.rhosts");
@@ -395,17 +428,30 @@ __icheckhost(raddr, lhost)
 	u_int32_t raddr;
 	register char *lhost;
 {
-	register struct hostent *hp;
+	register struct hostent hostbuf, *hp;
+	size_t buflen;
+	char *buffer;
 	register u_int32_t laddr;
 	register char **pp;
+	int herr;
 
 	/* Try for raw ip address first. */
 	if (isdigit(*lhost) && (int32_t)(laddr = inet_addr(lhost)) != -1)
 		return (raddr == laddr);
 
 	/* Better be a hostname. */
-	if ((hp = gethostbyname(lhost)) == NULL)
-		return (0);
+	buflen = 1024;
+	buffer = __alloca (buflen);
+	while (__gethostbyname_r (lhost, &hostbuf, buffer, buflen, &hp, &herr)
+	       < 0)
+	  if (herr != NETDB_INTERNAL || errno != ERANGE)
+	    return 0;
+	  else
+	    {
+	      /* Enlarge the buffer.  */
+	      buflen *= 2;
+	      buflen = __alloca (buflen);
+	    }
 
 	/* Spin through ip addresses. */
 	for (pp = hp->h_addr_list; *pp; ++pp)
diff --git a/inet/rexec.c b/inet/rexec.c
index f4772475fd..d91949de3c 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -40,6 +40,7 @@ static char sccsid[] = "@(#)rexec.c	8.1 (Berkeley) 6/4/93";
 
 #include <netinet/in.h>
 
+#include <alloca.h>
 #include <stdio.h>
 #include <netdb.h>
 #include <errno.h>
@@ -56,16 +57,30 @@ rexec(ahost, rport, name, pass, cmd, fd2p)
 	int *fd2p;
 {
 	struct sockaddr_in sin, sin2, from;
-	struct hostent *hp;
+	struct hostent hostbuf, *hp;
+	size_t hstbuflen;
+	char *hsttmpbuf;
 	u_short port;
 	int s, timo = 1, s3;
 	char c;
+	int herr;
+
+	hstbuflen = 1024;
+	hsttmpbuf = __alloca (hstbuflen);
+	while (__gethostbyname_r (*ahost, &hostbuf, hsttmpbuf, hstbuflen,
+				  &hp, &herr) < 0)
+	  if (herr != NETDB_INTERNAL || errno != ERANGE)
+	    {
+	      herror(*ahost);
+	      return -1;
+	    }
+	  else
+	    {
+	      /* Enlarge the buffer.  */
+	      hstbuflen *= 2;
+	      hsttmpbuf = __alloca (hstbuflen);
+	    }
 
-	hp = gethostbyname(*ahost);
-	if (hp == 0) {
-		herror(*ahost);
-		return (-1);
-	}
 	*ahost = hp->h_name;
 	ruserpass(hp->h_name, &name, &pass);
 retry:
diff --git a/intl/finddomain.c b/intl/finddomain.c
index 47bd0ab9f7..a2977d10c5 100644
--- a/intl/finddomain.c
+++ b/intl/finddomain.c
@@ -2,23 +2,23 @@
    Copyright (C) 1995, 1996 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
-This file is part of the GNU C Library.  Its master source is NOT part of
-the C library, however.  The master source lives in /gd/gnu/lib.
+   This file is part of the GNU C Library.  Its master source is NOT part of
+   the C library, however.  The master source lives in /gd/gnu/lib.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -106,7 +106,7 @@ _nl_find_domain (dirname, locale, domainname)
 
      and six parts for the CEN syntax:
 
-	language[_territory][+audience][+special][,sponsor][_revision]
+	language[_territory][+audience][+special][,[sponsor][_revision]]
 
      Beside the first all of them are allowed to be missing.  If the
      full specified locale is not found, the less specific one are
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index 4608fe81f7..9a586ec521 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -1,23 +1,23 @@
 /* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
-This file is part of the GNU C Library.  Its master source is NOT part of
-the C library, however.  The master source lives in /gd/gnu/lib.
+   This file is part of the GNU C Library.  Its master source is NOT part of
+   the C library, however.  The master source lives in /gd/gnu/lib.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -205,10 +205,11 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
 				     strlen (modifier) + 1 : 0)
 				  + ((mask & CEN_SPECIAL) != 0
 				     ? strlen (special) + 1 : 0)
-				  + ((mask & CEN_SPONSOR) != 0
-				     ? strlen (sponsor) + 1 : 0)
-				  + ((mask & CEN_REVISION) != 0
-				     ? strlen (revision) + 1 : 0)
+				  + ((mask & (CEN_SPONSOR | CEN_REVISION) != 0)
+				     ? (1 + ((mask & CEN_SPONSOR) != 0
+					     ? strlen (sponsor) + 1 : 0)
+					+ ((mask & CEN_REVISION) != 0
+					   ? strlen (revision) + 1 : 0)) : 0)
 				  + 1 + strlen (filename) + 1);
 
   if (abs_filename == NULL)
@@ -251,15 +252,16 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
       *cp++ = '+';
       cp = stpcpy (cp, special);
     }
-  if ((mask & CEN_SPONSOR) != 0)
+  if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0)
     {
       *cp++ = ',';
-      cp = stpcpy (cp, sponsor);
-    }
-  if ((mask & CEN_REVISION) != 0)
-    {
-      *cp++ = '_';
-      cp = stpcpy (cp, revision);
+      if ((mask & CEN_SPONSOR) != 0)
+	cp = stpcpy (cp, sponsor);
+      if ((mask & CEN_REVISION) != 0)
+	{
+	  *cp++ = '_';
+	  cp = stpcpy (cp, revision);
+	}
     }
 
   *cp++ = '/';
diff --git a/link.h b/link.h
new file mode 100644
index 0000000000..0999f0bbfc
--- /dev/null
+++ b/link.h
@@ -0,0 +1 @@
+#include <elf/link.h>
diff --git a/locale/Makefile b/locale/Makefile
index cedcd7043c..dd29c35019 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -12,9 +12,9 @@
 # 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.
+# 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.
 
 #
 #	Makefile for locales.
@@ -64,7 +64,10 @@ $(objpfx)localedef: $(localedef-modules:%=$(objpfx)%.o)
 $(objpfx)locale: $(locale-modules:%=$(objpfx)%.o)
 $(objpfx)localedef $(objpfx)locale: $(lib-modules:%=$(objpfx)%.o)
 
-CPPFLAGS := -DLOCALE_PATH='"$(localedir)"' \
+localepath = "$(localeddir)"
+
+CPPFLAGS := -DLOCALE_PATH='$(localepath)' \
+	    -DLOCALEDIR='"$(localedir)"' \
 	    -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
 	    -DLOCSRCDIR='"$(i18ndir)/locales"' -DHAVE_CONFIG_H \
 	    -Iprograms $(CPPFLAGS)
diff --git a/locale/findlocale.c b/locale/findlocale.c
index 2bcc11193f..d73ba4a395 100644
--- a/locale/findlocale.c
+++ b/locale/findlocale.c
@@ -1,21 +1,21 @@
 /* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 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 free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <locale.h>
 #include <stdlib.h>
@@ -99,7 +99,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
 
      and six parts for the CEN syntax:
 
-	language[_territory][+audience][+special][,sponsor][_revision]
+	language[_territory][+audience][+special][,[sponsor][_revision]]
 
      Beside the first all of them are allowed to be missing.  If the
      full specified locale is not found, the less specific one are
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index 1db26e5427..997126b625 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -1,21 +1,21 @@
 /* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -463,9 +463,9 @@ construct_output_path (char *path)
 	 the end of the function we need another byte for the trailing
 	 '/'.  */
       if (normal == NULL)
-	asprintf (&result, "%s/%s%c", LOCALE_PATH, path, '\0');
+	asprintf (&result, "%s/%s%c", LOCALEDIR, path, '\0');
       else
-	asprintf (&result, "%s/%.*s%s%s%c", LOCALE_PATH, startp - path, path,
+	asprintf (&result, "%s/%.*s%s%s%c", LOCALEDIR, startp - path, path,
 		  normal, endp, '\0');
     }
   else
diff --git a/locale/setlocale.c b/locale/setlocale.c
index ceec1a69a6..094664216e 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -255,8 +255,7 @@ setlocale (int category, const char *locale)
 			   &locale_path, &locale_path_len) != 0)
       return NULL;
 
-  if (__argz_append (&locale_path, &locale_path_len,
-		     LOCALE_PATH, sizeof (LOCALE_PATH)) != 0)
+  if (__argz_add_sep (&locale_path, &locale_path_len, LOCALE_PATH, ':') != 0)
     return NULL;
 
   if (category == LC_ALL)
diff --git a/login/Makefile b/login/Makefile
index da47089b5a..65982661b6 100644
--- a/login/Makefile
+++ b/login/Makefile
@@ -27,7 +27,7 @@ headers	:= utmp.h utmpbits.h lastlog.h pty.h
 routines := getutent getutent_r getutid getutline getutid_r getutline_r \
 	    utmp_file utmp_db
 
-distribtue := utmp-private.h
+distribute := utmp-private.h
 
 # Build the -lutil library with these extra functions.
 extra-libs      := libutil
diff --git a/nss/Makefile b/nss/Makefile
index 9193cf2214..ff3e039d6e 100644
--- a/nss/Makefile
+++ b/nss/Makefile
@@ -55,7 +55,7 @@ libnss_dns-routines	:= dns-host dns-network
 
 libnss_db-routines	:= $(addprefix db-,$(filter-out hosts network key,\
 							$(databases)))
-generated		+= $(filter-out db-netgrp.c, \
+generated		+= $(filter-out db-alias.c db-netgrp.c, \
 					$(addsuffix .c,$(libnss_db-routines)))
 distribute		+= db-XXX.c
 
diff --git a/nss/getXXbyYY.c b/nss/getXXbyYY.c
index 8449a38973..529864a088 100644
--- a/nss/getXXbyYY.c
+++ b/nss/getXXbyYY.c
@@ -96,15 +96,22 @@ FUNCTION_NAME (ADD_PARAMS)
   while (buffer != NULL
 	 && INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, &resbuf, buffer,
 				       buffer_size, &result H_ERRNO_VAR) != 0
+#ifdef NEED_H_ERRNO
+	 && h_errno_tmp == NETDB_INTERNAL
+#endif
 	 && errno == ERANGE)
     {
       char *new_buf;
       buffer_size += BUFLEN;
       new_buf = realloc (buffer, buffer_size);
       if (new_buf == NULL)
-	/* We are out of memory.  Free the current buffer so that the
-	   process gets a chance for a normal termination.  */
-	free (buffer);
+	{
+	  /* We are out of memory.  Free the current buffer so that the
+	     process gets a chance for a normal termination.  */
+	  save = errno;
+	  free (buffer);
+	  __set_errno (save);
+	}
       buffer = new_buf;
     }
 
diff --git a/nss/getXXent.c b/nss/getXXent.c
index 2d6d1c32e6..f180171150 100644
--- a/nss/getXXent.c
+++ b/nss/getXXent.c
@@ -84,15 +84,22 @@ GETFUNC_NAME (void)
   while (buffer != NULL
 	 && INTERNAL (REENTRANT_GETNAME) (&resbuf, buffer, buffer_size, &result
 					  H_ERRNO_VAR) != 0
+#ifdef NEED_H_ERRNO
+	 && h_errno == NETDB_INTERNAL
+#endif
 	 && errno == ERANGE)
     {
       char *new_buf;
       buffer_size += BUFLEN;
       new_buf = realloc (buffer, buffer_size);
       if (new_buf == NULL)
-	/* We are out of memory.  Free the current buffer so that the
-	   process gets a chance for a normal termination.  */
-	free (buffer);
+	{
+	  /* We are out of memory.  Free the current buffer so that the
+	     process gets a chance for a normal termination.  */
+	  save = errno;
+	  free (buffer);
+	  __set_errno (save);
+	}
       buffer = new_buf;
     }
 
diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
index 014e2729a4..2f99420f30 100644
--- a/nss/nss_files/files-XXX.c
+++ b/nss/nss_files/files-XXX.c
@@ -149,6 +149,7 @@ internal_getent (struct STRUCTURE *result,
   if (buflen < (int) sizeof *data + 1)
     {
       __set_errno (ERANGE);
+      HERRNO_SET (NETDB_INTERNAL);
       return NSS_STATUS_TRYAGAIN;
     }
 
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index af74493c3f..ac743c752c 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -22,13 +22,13 @@
 #include <errno.h>
 #include <netdb.h>
 #include <libc-lock.h>
+#include <link.h>	/* We need some help from ld.so.  */
 #include <search.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include "nsswitch.h"
-#include "../elf/link.h"	/* We need some help from ld.so.  */
 
 /* Prototypes for the local functions.  */
 static void *nss_lookup_function (service_user *ni, const char *fct_name);
diff --git a/posix/getconf.c b/posix/getconf.c
index f4f47650b7..5b67a281df 100644
--- a/posix/getconf.c
+++ b/posix/getconf.c
@@ -231,7 +231,14 @@ main (int argc, char *argv[])
 	    if (argc > 2)
 	      usage ();
 	    value = sysconf (c->call_name);
-	    printf ("%ld\n", value);
+	    if (value == -1l)
+	      if (c->call_name == _SC_UINT_MAX
+		  || c->call_name == _SC_ULONG_MAX)
+		printf ("%lu\n", value);
+	      else
+		puts (_("undefined"));
+	    else
+	      printf ("%ld\n", value);
 	    exit (0);
 
 	  case CONFSTR:
diff --git a/posix/glob.c b/posix/glob.c
index b8820cee94..0fa15611bd 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -56,7 +56,7 @@ Cambridge, MA 02139, USA.  */
 #include <stddef.h>
 #endif
 
-#ifdef	HAVE_UNISTD_H
+#if defined HAVE_UNISTD_H || defined _LIBC
 #include <unistd.h>
 #ifndef POSIX
 #ifdef	_POSIX_VERSION
@@ -467,11 +467,40 @@ glob (pattern, flags, errfunc, pglob)
 	  if (dirname == NULL || dirname[0] == '\0')
 	    {
 	      extern char *getlogin __P ((void));
-	      char *name = getlogin ();
-	      if (name != NULL)
+	      extern int getlogin_r __P ((char *, size_t));
+	      int success;
+
+#if defined HAVE_GETLOGIN_R || defined _LIBC
+	      size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1;
+	      char *name;
+
+	      if (buflen == 0)
+		/* `sysconf' does not support _SC_LOGIN_NAME_MAX.  Try
+		   a moderate value.  */
+		buflen = 16;
+	      name = __alloca (buflen);
+
+	      success = getlogin_r (name, buflen) >= 0;
+#else
+	      char *name;
+	      success = (name = getlogin ()) != NULL;
+#endif
+	      if (success)
 		{
+#if defined HAVE_GETPWNAM_R || defined _LIBC
+		  size_t pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX);
+		  char *pwtmpbuf;
+		  struct passwd pwbuf, *p;
+
+		  pwtmpbuf = __alloca (pwbuflen);
+
+		  success = (__getpwnam_r (name, &pwbuf, pwtmpbuf,
+					   pwbuflen, &p) >= 0);
+#else
 		  struct passwd *p = getpwnam (name);
-		  if (p != NULL)
+		  success = p != NULL;
+#endif
+		  if (success)
 		    dirname = p->pw_dir;
 		}
 	    }
@@ -491,9 +520,17 @@ glob (pattern, flags, errfunc, pglob)
             dirname = "c:/users/default"; /* poor default */
 #else
 	  /* Look up specific user's home directory.  */
+#if defined HAVE_GETPWNAM_R || defined _LIBC
+	  size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
+	  char *pwtmpbuf = __alloca (buflen);
+	  struct passwd pwbuf, *p;
+	  if (__getpwnam_r (dirname + 1, &pwbuf, pwtmpbuf, buflen, &p) >= 0)
+	    dirname = p->pw_dir;
+#else
 	  struct passwd *p = getpwnam (dirname + 1);
 	  if (p != NULL)
 	    dirname = p->pw_dir;
+#endif
 #endif /* WIN32 */
 #endif
 	}
diff --git a/printf.h b/printf.h
index 8996ff4b17..777e958fb9 100644
--- a/printf.h
+++ b/printf.h
@@ -1 +1 @@
-#include <stdio/printf.h>
+#include <stdio-common/printf.h>
diff --git a/pwd/getpw.c b/pwd/getpw.c
index 402fafd7f0..9c2e4afd0a 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -1,23 +1,25 @@
 /* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
+#include <alloca.h>
 #include <errno.h>
 #include <stdio.h>
+#include <unistd.h>
 #include <pwd.h>
 
 
@@ -30,9 +32,11 @@ int __getpw __P ((__uid_t uid, char *buf));
 int
 __getpw (uid, buf)
      __uid_t uid;
-     register char *buf;
+     char *buf;
 {
-  register struct passwd *p;
+  size_t buflen;
+  char *tmpbuf;
+  struct passwd resbuf, *p;
 
   if (buf == NULL)
     {
@@ -40,8 +44,10 @@ __getpw (uid, buf)
       return -1;
     }
 
-  p = getpwuid (uid);
-  if (p == NULL)
+  buflen = __sysconf (_SC_GETPW_R_SIZE_MAX);
+  tmpbuf = alloca (buflen);
+
+  if (getpwuid_r (uid, &resbuf, tmpbuf, buflen, &p) < 0)
     return -1;
 
   if (sprintf (buf, "%s:%s:%u:%u:%s:%s:%s", p->pw_name, p->pw_passwd,
diff --git a/stdlib/l64a.c b/stdlib/l64a.c
index 1559b5b43a..ba7a910c96 100644
--- a/stdlib/l64a.c
+++ b/stdlib/l64a.c
@@ -53,5 +53,5 @@ l64a (n)
       n >>= 6;
     }
 
-  return &result[n + 1];
+  return &result[cnt + 1];
 }
diff --git a/stdlib/strfmon.c b/stdlib/strfmon.c
index 99408c7484..85f8898136 100644
--- a/stdlib/strfmon.c
+++ b/stdlib/strfmon.c
@@ -27,10 +27,10 @@ Boston, MA 02111-1307, USA.  */
 # include "../libio/libioP.h"
 # include "../libio/strfile.h"
 #endif
+#include <printf.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
-#include "../stdio-common/printf.h"
 #include "../locale/localeinfo.h"
 
 
diff --git a/string/Makefile b/string/Makefile
index d817d1504b..e91bd4deea 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -35,7 +35,8 @@ routines	:= strcat strchr strcmp strcoll strcpy strcspn		\
 		   memccpy memcpy wordcopy strsep			\
 		   swab strfry memfrob memmem				\
 		   $(addprefix argz-,append count create ctsep next	\
-			             delete extract insert stringify)	\
+			             delete extract insert stringify	\
+				     addsep)				\
 		   envz basename
 
 tests		:= tester testcopy test-ffs tst-strlen stratcliff
diff --git a/string/argz-addsep.c b/string/argz-addsep.c
new file mode 100644
index 0000000000..7405e9ad1a
--- /dev/null
+++ b/string/argz-addsep.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 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 <argz.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+error_t
+__argz_add_sep (char **argz, size_t *argz_len, const char *string, int delim)
+{
+  size_t nlen = strlen (string) + 1;
+
+  if (nlen > 1)
+    {
+      const char *rp;
+      char *wp;
+
+      *argz = (char *) realloc (*argz, *argz_len + nlen);
+      if (*argz == NULL)
+	return ENOMEM;
+
+      wp = *argz + *argz_len;
+      rp = string;
+      do
+	if (*rp == delim)
+	  {
+	    if (wp > *argz && wp[-1] != '\0')
+	      *wp++ = '\0';
+	    else
+	      --nlen;
+	  }
+	else
+	  *wp++ = *rp;
+      while (*rp++ != '\0');
+
+      *argz_len += nlen;
+    }
+
+  return 0;
+}
+weak_alias (__argz_create_sep, argz_create_sep)
diff --git a/string/argz-ctsep.c b/string/argz-ctsep.c
index 9560591cb3..461b9beb87 100644
--- a/string/argz-ctsep.c
+++ b/string/argz-ctsep.c
@@ -1,21 +1,21 @@
 /* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 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 free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <argz.h>
 #include <errno.h>
@@ -28,11 +28,11 @@ __argz_create_sep (const char *string, int delim, char **argz, size_t *len)
 {
   size_t nlen = strlen (string) + 1;
 
-  if (nlen != 0)
+  if (nlen > 1)
     {
       const char *rp;
       char *wp;
-      
+
       *argz = (char *) malloc (nlen);
       if (*argz == NULL)
 	return ENOMEM;
@@ -50,10 +50,19 @@ __argz_create_sep (const char *string, int delim, char **argz, size_t *len)
 	else
 	  *wp++ = *rp;
       while (*rp++ != '\0');
+
+      if (nlen == 0)
+	{
+	  free (*argz);
+	  *argz = NULL;
+	  *len = 0;
+	}
+    }
+  else
+    {
+      *argz = NULL;
+      *len = 0;
     }
-  if (nlen == 0)
-    *argz = NULL;
-  *len = nlen;
 
   return 0;
 }
diff --git a/string/argz.h b/string/argz.h
index 2cfb5b7be3..255e1d345d 100644
--- a/string/argz.h
+++ b/string/argz.h
@@ -71,6 +71,13 @@ extern error_t __argz_add __P ((char **__argz, size_t *__argz_len,
 extern error_t argz_add __P ((char **__argz, size_t *__argz_len,
 			      __const char *__str));
 
+/* Append SEP separated list in STRING to the argz vector in ARGZ &
+   ARGZ_LEN.  */
+extern error_t __argz_add_sep __P ((char **__argz, size_t *__argz_len,
+				    __const char *__string, int __delim));
+extern error_t argz_add_sep __P ((char **__argz, size_t *__argz_len,
+				  __const char *__string, int __delim));
+
 /* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there.  */
 extern void __argz_delete __P ((char **__argz, size_t *__argz_len,
 				char *__entry));
diff --git a/string/strcoll.c b/string/strcoll.c
index 7061a38026..fa1025e0d7 100644
--- a/string/strcoll.c
+++ b/string/strcoll.c
@@ -74,7 +74,7 @@ STRCOLL (s1, s2)
 	  u_int32_t w1, w2;
 
 	  /* Here we have to check for IGNORE entries.  If these are
-	     found we count them and go on witht he next value.  */
+	     found we count them and go on with the next value.  */
 	  while ((w1 = s1run->data[pass].value[s1idx])
 		 == (u_int32_t) IGNORE_CHAR)
 	    {
diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c
index e54e77828b..d7b949caa6 100644
--- a/sunrpc/clnt_gen.c
+++ b/sunrpc/clnt_gen.c
@@ -6,11 +6,11 @@
  * may copy or modify Sun RPC without charge, but are not authorized
  * to license or distribute it to anyone else except as part of a product or
  * program developed by the user.
- * 
+ *
  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- * 
+ *
  * Sun RPC is provided with no support and without any obligation on the
  * part of Sun Microsystems, Inc. to assist in its use, correction,
  * modification or enhancement.
@@ -18,11 +18,11 @@
  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  * OR ANY PART THEREOF.
- * 
+ *
  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  * or profits or other special, indirect and consequential damages, even if
  * Sun has been advised of the possibility of such damages.
- * 
+ *
  * Sun Microsystems, Inc.
  * 2550 Garcia Avenue
  * Mountain View, California  94043
@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)clnt_generic.c 1.4 87/08/11 (C) 1987 SMI";
 /*
  * Copyright (C) 1987, Sun Microsystems, Inc.
  */
+#include <alloca.h>
+#include <errno.h>
 #include <rpc/rpc.h>
 #include <sys/socket.h>
 #include <sys/errno.h>
@@ -40,7 +42,7 @@ static char sccsid[] = "@(#)clnt_generic.c 1.4 87/08/11 (C) 1987 SMI";
 
 /*
  * Generic client creation: takes (hostname, program-number, protocol) and
- * returns client handle. Default options are set, which the user can 
+ * returns client handle. Default options are set, which the user can
  * change using the rpc equivalent of ioctl()'s.
  */
 CLIENT *
@@ -50,36 +52,64 @@ clnt_create(hostname, prog, vers, proto)
 	unsigned vers;
 	char *proto;
 {
-	struct hostent *h;
-	struct protoent *p;
+	struct hostent hostbuf, *h;
+	size_t hstbuflen;
+	char *hsttmpbuf;
+	struct protoent protobuf, *p;
+	size_t prtbuflen;
+	char *prttmpbuf;
 	struct sockaddr_in sin;
 	int sock;
 	struct timeval tv;
 	CLIENT *client;
+	int herr;
+
+	hstbuflen = 1024;
+	hsttmpbuf = __alloca (hstbuflen);
+	while (__gethostbyname_r (hostname, &hostbuf, hsttmpbuf, hstbuflen,
+				  &h, &herr) < 0)
+	  if (herr != NETDB_INTERNAL || errno != ERANGE)
+	    {
+	      rpc_createerr.cf_stat = RPC_UNKNOWNHOST;
+	      return NULL;
+	    }
+	  else
+	    {
+	      /* Enlarge the buffer.  */
+	      hstbuflen *= 2;
+	      hsttmpbuf = __alloca (hstbuflen);
+	    }
 
-	h = gethostbyname(hostname);
-	if (h == NULL) {
-		rpc_createerr.cf_stat = RPC_UNKNOWNHOST;
-		return (NULL);
-	}
 	if (h->h_addrtype != AF_INET) {
 		/*
 		 * Only support INET for now
 		 */
 		rpc_createerr.cf_stat = RPC_SYSTEMERROR;
-		rpc_createerr.cf_error.re_errno = EAFNOSUPPORT; 
+		rpc_createerr.cf_error.re_errno = EAFNOSUPPORT;
 		return (NULL);
 	}
 	sin.sin_family = h->h_addrtype;
 	sin.sin_port = 0;
 	bzero(sin.sin_zero, sizeof(sin.sin_zero));
 	bcopy(h->h_addr, (char*)&sin.sin_addr, h->h_length);
-	p = getprotobyname(proto);
-	if (p == NULL) {
-		rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
-		rpc_createerr.cf_error.re_errno = EPFNOSUPPORT; 
-		return (NULL);
-	}
+
+	prtbuflen = 1024;
+	prttmpbuf = __alloca (prtbuflen);
+	while (__getprotobyname_r (proto, &protobuf, prttmpbuf, prtbuflen, &p)
+	       < 0)
+	  if (errno != ERANGE)
+	    {
+	      rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
+	      rpc_createerr.cf_error.re_errno = EPFNOSUPPORT;
+	      return NULL;
+	    }
+	  else
+	    {
+	      /* Enlarge the buffer.  */
+	      prtbuflen *= 2;
+	      prttmpbuf = __alloca (prtbuflen);
+	    }
+
 	sock = RPC_ANYSOCK;
 	switch (p->p_proto) {
 	case IPPROTO_UDP:
@@ -103,7 +133,7 @@ clnt_create(hostname, prog, vers, proto)
 		break;
 	default:
 		rpc_createerr.cf_stat = RPC_SYSTEMERROR;
-		rpc_createerr.cf_error.re_errno = EPFNOSUPPORT; 
+		rpc_createerr.cf_error.re_errno = EPFNOSUPPORT;
 		return (NULL);
 	}
 	return (client);
diff --git a/sunrpc/clnt_simp.c b/sunrpc/clnt_simp.c
index e289b3400d..dd2ae75f1e 100644
--- a/sunrpc/clnt_simp.c
+++ b/sunrpc/clnt_simp.c
@@ -38,6 +38,8 @@ static char sccsid[] = "@(#)clnt_simple.c 1.35 87/08/11 Copyr 1984 Sun Micro";
  * Copyright (C) 1984, Sun Microsystems, Inc.
  */
 
+#include <alloca.h>
+#include <errno.h>
 #include <stdio.h>
 #include <rpc/rpc.h>
 #include <sys/socket.h>
@@ -59,7 +61,7 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
 	register struct callrpc_private *crp = callrpc_private;
 	struct sockaddr_in server_addr;
 	enum clnt_stat clnt_stat;
-	struct hostent *hp;
+	struct hostent hostbuf, *hp;
 	struct timeval timeout, tottimeout;
 
 	if (crp == 0) {
@@ -77,6 +79,10 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
 		&& strcmp(crp->oldhost, host) == 0) {
 		/* reuse old client */
 	} else {
+		size_t buflen;
+		char *buffer;
+		int herr;
+
 		crp->valid = 0;
 		if (crp->socket != RPC_ANYSOCK)
 		  {
@@ -87,8 +93,20 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
 			clnt_destroy(crp->client);
 			crp->client = NULL;
 		}
-		if ((hp = gethostbyname(host)) == NULL)
-			return ((int) RPC_UNKNOWNHOST);
+
+		buflen = 1024;
+		buffer = __alloca (buflen);
+		while (__gethostbyname_r (host, &hostbuf, buffer, buflen,
+					  &hp, &herr) < 0)
+		  if (herr != NETDB_INTERNAL || errno != ERANGE)
+		    return (int) RPC_UNKNOWNHOST;
+		  else
+		    {
+		      /* Enlarge the buffer.  */
+		      buflen *= 2;
+		      buffer = __alloca (buflen);
+		    }
+
 		timeout.tv_usec = 0;
 		timeout.tv_sec = 5;
 		bcopy(hp->h_addr, (char *)&server_addr.sin_addr, hp->h_length);
diff --git a/sunrpc/getrpcport.c b/sunrpc/getrpcport.c
index 9b13bac6b0..3e94dbbf7b 100644
--- a/sunrpc/getrpcport.c
+++ b/sunrpc/getrpcport.c
@@ -9,23 +9,23 @@ static  char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI";
  * may copy or modify Sun RPC without charge, but are not authorized
  * to license or distribute it to anyone else except as part of a product or
  * program developed by the user.
- * 
+ *
  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- * 
+ *
  * Sun RPC is provided with no support and without any obligation on the
  * part of Sun Microsystems, Inc. to assist in its use, correction,
  * modification or enhancement.
- * 
+ *
  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  * OR ANY PART THEREOF.
- * 
+ *
  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  * or profits or other special, indirect and consequential damages, even if
  * Sun has been advised of the possibility of such damages.
- * 
+ *
  * Sun Microsystems, Inc.
  * 2550 Garcia Avenue
  * Mountain View, California  94043
@@ -35,19 +35,36 @@ static  char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI";
  * Copyright (c) 1985 by Sun Microsystems, Inc.
  */
 
+#include <alloca.h>
+#include <errno.h>
 #include <stdio.h>
 #include <rpc/rpc.h>
 #include <netdb.h>
 #include <sys/socket.h>
 
+int
 getrpcport(host, prognum, versnum, proto)
 	char *host;
 {
 	struct sockaddr_in addr;
-	struct hostent *hp;
+	struct hostent hostbuf, *hp;
+	size_t buflen;
+	char *buffer;
+	int herr;
+
+	buflen = 1024;
+	buffer = __alloca (buflen);
+	while (__gethostbyname_r (host, &hostbuf, buffer, buflen, &hp, &herr)
+	       < 0)
+	  if (herr != NETDB_INTERNAL || errno != ERANGE)
+	    return 0;
+	  else
+	    {
+	      /* Enlarge the buffer.  */
+	      buflen *= 2;
+	      buffer = __alloca (buflen);
+	    }
 
-	if ((hp = gethostbyname(host)) == NULL)
-		return (0);
 	bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length);
 	addr.sin_family = AF_INET;
 	addr.sin_port =  0;
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
index 3f7d1235e5..0adc370632 100644
--- a/sysdeps/unix/sysv/linux/Dist
+++ b/sysdeps/unix/sysv/linux/Dist
@@ -21,7 +21,6 @@ sys/mount.h
 sys/mtio.h
 sys/procfs.h
 sys/quota.h
-sys/serial.h
 sys/socketcall.h
 sys/soundcard.h
 sys/sysctl.h
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 9e6bd65bd1..c7cf1f9570 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -10,8 +10,7 @@ sysdep_routines += sysctl clone llseek
 sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \
 		  sys/module.h sys/io.h sys/klog.h sys/kdaemon.h \
 		  sys/user.h syscall-list.h sys/sysmacros.h sys/procfs.h \
-		  sys/debugreg.h sys/kd.h sys/soundcard.h sys/vt.h \
-		  sys/serial.h
+		  sys/debugreg.h sys/kd.h sys/soundcard.h sys/vt.h
 
 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
 $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/syscall.h
diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c
index ca2669d3e6..b313ab3409 100644
--- a/sysdeps/unix/sysv/linux/gethostid.c
+++ b/sysdeps/unix/sysv/linux/gethostid.c
@@ -1,20 +1,21 @@
 /* Copyright (C) 1995, 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.  */
-
+   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 <fcntl.h>
 #include <unistd.h>
@@ -58,9 +59,12 @@ long int
 gethostid ()
 {
   char hostname[MAXHOSTNAMELEN + 1];
-  struct hostent *hp;
-  unsigned long id;
+  size_t buflen;
+  char *buffer;
+  struct hostent hostbuf, *hp;
+  unsigned long int id;
   struct in_addr in;
+  int herr;
   int fd;
 
   /* First try to get the ID from a former invocation of sethostid.  */
@@ -81,10 +85,20 @@ gethostid ()
     /* This also fails.  Return and arbitrary value.  */
     return 0;
 
+  buflen = 1024;
+  buffer = __alloca (buflen);
+
   /* To get the IP address we need to know the host name.  */
-  hp = gethostbyname (hostname);
-  if (hp == NULL)
-    return 0;
+  while (__gethostbyname_r (hostname, &hostbuf, buffer, buflen, &hp, &herr)
+	 < 0)
+    if (herr != NETDB_INTERNAL || errno != ERANGE)
+      return 0;
+    else
+      {
+	/* Enlarge buffer.  */
+	buflen *= 2;
+	buffer = __alloca (buflen);
+      }
 
   in.s_addr = 0;
   memcpy (&in, hp->h_addr,
diff --git a/sysdeps/unix/sysv/linux/sys/serial.h b/sysdeps/unix/sysv/linux/sys/serial.h
deleted file mode 100644
index 1844ef6032..0000000000
--- a/sysdeps/unix/sysv/linux/sys/serial.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* 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 _SYS_SERIAL_H
-#define _SYS_SERIAL_H	1
-/* Defines for PC AT serial port.  */
-
-/* Serial port addresses and IRQs.  */
-#define PORT_0		0x03F8
-#define PORT_1		0x02F8
-#define IRQ_0		0x04
-#define IRQ_1		0x03
-
-/* Definitions for INS8250 / 16550 chips.  */
-
-/* Defined as offsets from the port address (data port).  */
-#define DAT	0	/* Receive/transmit data.  */
-#define ICR	1	/* Interrupt control register.  */
-#define ISR	2	/* Interrupt status register.  */
-#define LCR	3	/* Line control register.  */
-#define MCR	4	/* Modem control register.  */
-#define LSR	5	/* Line status register.  */
-#define MSR	6	/* Modem status register.  */
-#define DLL	0	/* Divisor latch (lsb).  */
-#define DLH	1	/* Divisor latch (msb).  */
-
-
-/* ICR.  */
-#define RIEN	0x01	/* Enable receiver interrupt.  */
-#define TIEN	0x02	/* Enable transmitter interrupt.  */
-#define SIEN	0x04	/* Enable receiver line status interrupt.  */
-#define MIEN	0x08	/* Enable modem status interrupt.  */
-
-
-/* ISR */
-#define FFTMOUT	0x0c	/* Fifo rcvr timeout.  */
-#define RSTATUS	0x06	/* Change in receiver line status.  */
-#define RxRDY	0x04	/* Receiver data available.  */
-#define TxRDY	0x02	/* Transmitter holding register empty.  */
-#define MSTATUS	0x00	/* Change in modem status.  */
-
-
-/* LCR 3
-   Number of data bits per received/transmitted character.  */
-#define RXLEN	0x03
-#define STOP1	0x00
-#define STOP2	0x04
-#define PAREN	0x08
-#define PAREVN	0x10
-#define PARMARK	0x20
-#define SNDBRK	0x40
-#define DLAB	0x80
-
-/* Baud rate definitions.  */
-#define ASY9600	12
-
-/* Definitions for character length (data bits) in RXLEN field.  */
-#define BITS5	0x00
-#define BITS6	0x01
-#define BITS7	0x02
-#define BITS8	0x03
-
-/* MCR.  */
-#define DTR	0x01	/* Bring up DTR.  */
-#define RTS	0x02	/* Bring up RTS.  */
-#define OUT1	0x04
-#define OUT2	0x08
-#define LOOP	0x10	/* Put chip into loopback state.  */
-
-
-/* LSR */
-#define RCA	0x01	/* Receive char available.  */
-#define OVRRUN	0x02	/* Receive overrun.  */
-#define PARERR	0x04	/* Parity error.  */
-#define FRMERR	0x08	/* Framing/CRC error.  */
-#define BRKDET	0x10	/* Break detected (null char + frame error).  */
-#define XHRE	0x20	/* Transmit holding register empty.  */
-#define XSRE	0x40	/* Transmit shift register empty.  */
-
-
-/* MSR */
-#define DCTS	0x01	/* CTS has changed state.  */
-#define DDSR	0x02	/* DSR has changed state.  */
-#define DRI	0x04	/* RI has changed state.  */
-#define DDCD	0x08    /* DCD has changed state.  */
-#define CTS	0x10	/* State of CTS.  */
-#define DSR	0x20	/* State of DSR.  */
-#define RI      0x40    /* State of RI.  */
-#define DCD     0x80    /* State of DCD.  */
-
-
-#define DELTAS(x)	((x) & (DCTS | DDSR | DRI | DDCD))
-#define STATES(x)	((x) (CTS | DSR | RI | DCD))
-
-#endif /* sys/serial.h */
diff --git a/time/Makefile b/time/Makefile
index 252b335c9e..966d9f2790 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -99,7 +99,7 @@ $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
 	mv $@.new $@
 
 .PHONY: echo-zonenames
-echo-zonenames: zonenames
+echo-zonenames:
 	@echo 'Known zones: $(zonenames)'