]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
update from main archive 961201 cvs/libc-961202
authorUlrich Drepper <drepper@redhat.com>
Mon, 2 Dec 1996 04:00:15 +0000 (04:00 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 2 Dec 1996 04:00:15 +0000 (04:00 +0000)
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.

36 files changed:
ChangeLog
grp/initgroups.c
inet/rcmd.c
inet/rexec.c
intl/finddomain.c
intl/l10nflist.c
link.h [new file with mode: 0644]
locale/Makefile
locale/findlocale.c
locale/programs/localedef.c
locale/setlocale.c
login/Makefile
nss/Makefile
nss/getXXbyYY.c
nss/getXXent.c
nss/nss_files/files-XXX.c
nss/nsswitch.c
posix/getconf.c
posix/glob.c
printf.h
pwd/getpw.c
stdlib/l64a.c
stdlib/strfmon.c
string/Makefile
string/argz-addsep.c [new file with mode: 0644]
string/argz-ctsep.c
string/argz.h
string/strcoll.c
sunrpc/clnt_gen.c
sunrpc/clnt_simp.c
sunrpc/getrpcport.c
sysdeps/unix/sysv/linux/Dist
sysdeps/unix/sysv/linux/Makefile
sysdeps/unix/sysv/linux/gethostid.c
sysdeps/unix/sysv/linux/sys/serial.h [deleted file]
time/Makefile

index 4958fa02a6dd2edcf11b8aedcea5b71154f87e95..f521814da2a9c4d7977e0893ffa49a9f0ec19b6a 100644 (file)
--- 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.
index 35af575ac722818039c82f64cba1ffb49e2094ad..a659f0d3ae478409672594371476485476577d5b 100644 (file)
@@ -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;
index 3fc8adc742913d97d6399de14d4041c2dd597f24..2631523a227a1dadb90f2f67d603870cf19d3950 100644 (file)
@@ -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)
index f4772475fd44ee208e19b6aec1f2a622c27c1391..d91949de3c0ce346e19d1d654b509e27f79457a2 100644 (file)
@@ -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:
index 47bd0ab9f7e07476bbbaf513b619fe61f9475e46..a2977d10c585a30bb37af5eae9a80c74c1215333 100644 (file)
@@ -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
index 4608fe81f799c0c16e979b18dcdead4cadb259d7..9a586ec521689a2900643fbe38796428e086e026 100644 (file)
@@ -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 (file)
index 0000000..0999f0b
--- /dev/null
+++ b/link.h
@@ -0,0 +1 @@
+#include <elf/link.h>
index cedcd7043ce0cb6294feba2ebd2e0c24ed3e8088..dd29c350197ba1751725e1678e8f2567dd09d1ab 100644 (file)
@@ -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)
index 2bcc11193ff7d16da6062e6bf7d9b6c1ba9a3e34..d73ba4a3956b6bbba5dff09fe8022e6c0f69dd66 100644 (file)
@@ -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
index 1db26e5427204bc2274dd062f6a2bd79c0aeb30d..997126b625ebb294f6e57f8b2edaa448286e83e6 100644 (file)
@@ -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
index ceec1a69a622cfd9be25cbc7e47139a9dee3c722..094664216ef028c181af02803ef32ae4fd3e1d9c 100644 (file)
@@ -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)
index da47089b5a713f95ae0cfdf463b642192cbab497..65982661b656bcb7557b24d3a06fabb02be9f6eb 100644 (file)
@@ -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
index 9193cf221423518fddf7ba2577053509fe19d602..ff3e039d6e1c418e24d921fbf50ea1c11981c180 100644 (file)
@@ -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
 
index 8449a389733b3c7094b9ff615cb699d0fdebd601..529864a088d025821ff9e0560e1098c2c3647c03 100644 (file)
@@ -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;
     }
 
index 2d6d1c32e61d8a84ac854799aae274b94c15ec7e..f180171150f29c96200911f0fceee6cf9af17bd9 100644 (file)
@@ -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;
     }
 
index 014e2729a4573997d5d513c5c8b98abbe8da2687..2f99420f3037a9f8aa299d9945160d9942feb9fd 100644 (file)
@@ -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;
     }
 
index af74493c3f1b271201e17423f8fe7066875f6861..ac743c752c40dfaaab7f1bed87002a96abdb7a6b 100644 (file)
 #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);
index f4f47650b78c55b95939768608cd438377a494b8..5b67a281df4896013e895d7c3498c943f7aad8f0 100644 (file)
@@ -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:
index b8820cee94630adfc53db9ed7c33c4f1b5de225d..0fa15611bd361d7d26b2c7a518cacdee15605e50 100644 (file)
@@ -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
        }
index 8996ff4b17c1ef5815398797cced24e06cfdd99e..777e958fb94f66fda74299892c6d33208d34397a 100644 (file)
--- a/printf.h
+++ b/printf.h
@@ -1 +1 @@
-#include <stdio/printf.h>
+#include <stdio-common/printf.h>
index 402fafd7f04ceb9aa3730e13f001543d5a5325b9..9c2e4afd0a184584b65fa4ceee4c7afce49e9ff7 100644 (file)
@@ -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,
index 1559b5b43af64867210ffe10e96f53d4cdfe4213..ba7a910c9642468a95e284d2d51a9ea20838f47d 100644 (file)
@@ -53,5 +53,5 @@ l64a (n)
       n >>= 6;
     }
 
-  return &result[n + 1];
+  return &result[cnt + 1];
 }
index 99408c74845e652918e7c2adeaacf1e1dda7cad1..85f8898136f7f46d924437efcd5fdaa228cefa03 100644 (file)
@@ -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"
 
 
index d817d1504b67a99d252a98d2d1ca7466a94d91f1..e91bd4deea86d101506b26ce8a94e3c5eea53b82 100644 (file)
@@ -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 (file)
index 0000000..7405e9a
--- /dev/null
@@ -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)
index 9560591cb31de24be90ba5f809f5c1fb10c38dd3..461b9beb877f23e9904a5ec70e616510e9d11ee1 100644 (file)
@@ -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;
 }
index 2cfb5b7be3a7742a64bb2710291f9e5a73655126..255e1d345de2665074838cdc06b5b5ae6718503e 100644 (file)
@@ -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));
index 7061a3802688db0028a134362256e093ba0847f7..fa1025e0d7652e4e604a6abc902a4fdc2fcb1fab 100644 (file)
@@ -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 withhe 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)
            {
index e54e77828b2abff8011dd6f4ceab605db8e4a976..d7b949caa69a936ca85f75bc9046a08089494946 100644 (file)
@@ -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.
  * 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);
index e289b3400da72536e189742922a6e062c67fd7ff..dd2ae75f1efc4cca85b5be6e7df21d04fa79b4db 100644 (file)
@@ -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);
index 9b13bac6b010eba3099295f9a407708122119aca..3e94dbbf7b64b078e8667341af8318ff77ae72a7 100644 (file)
@@ -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;
index 3f7d1235e5d86fc6f42b0107fb44113b05c3300c..0adc370632c16b2fd0eb7f2e2c09fbe2f8567f42 100644 (file)
@@ -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
index 9e6bd65bd18ebbefcb3477dfc2f5a6dd67afa2b1..c7cf1f95705cf095c2707943cd1583aa5d5da6a9 100644 (file)
@@ -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
index ca2669d3e6767ec9e8ff367e0d0601e539a2d944..b313ab3409a4c4d96c9d12c3e544e1ecab5d1281 100644 (file)
@@ -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 (file)
index 1844ef6..0000000
+++ /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 */
index 252b335c9e0e1bc4657e23b88936cf0780457698..966d9f2790379429872fcc7a92e69b2b8f104eeb 100644 (file)
@@ -99,7 +99,7 @@ $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
        mv $@.new $@
 
 .PHONY: echo-zonenames
-echo-zonenames: zonenames
+echo-zonenames:
        @echo 'Known zones: $(zonenames)'