update from main archive 961201

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.
This commit is contained in:
Ulrich Drepper 1996-12-02 04:00:15 +00:00
parent a401eea9eb
commit e4cf507069
36 changed files with 585 additions and 331 deletions

View File

@ -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> Thu Nov 28 23:03:32 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/netinet/in_systm.h: New file. * sysdeps/unix/sysv/linux/netinet/in_systm.h: New file.

View File

@ -1,20 +1,20 @@
/* Copyright (C) 1989, 1991, 1993, 1996 Free Software Foundation, Inc. /* 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 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 675 Mass Ave, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Cambridge, MA 02139, USA. */ Boston, MA 02111-1307, USA. */
#include <alloca.h> #include <alloca.h>
#include <unistd.h> #include <unistd.h>
@ -39,7 +39,9 @@ initgroups (user, group)
#else #else
struct group *g; struct group grpbuf, *g;
size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
char *tmpbuf;
register size_t n; register size_t n;
size_t ngroups; size_t ngroups;
gid_t *groups; gid_t *groups;
@ -58,13 +60,14 @@ initgroups (user, group)
#endif #endif
groups = __alloca (ngroups * sizeof *groups); groups = __alloca (ngroups * sizeof *groups);
tmpbuf = __alloca (buflen);
setgrent (); setgrent ();
n = 0; n = 0;
groups[n++] = group; groups[n++] = group;
while ((g = getgrent ()) != NULL) while (__getgrent_r (&grpbuf, tmpbuf, buflen, &g) >= 0)
if (g->gr_gid != group) if (g->gr_gid != group)
{ {
register char **m; register char **m;

View File

@ -42,6 +42,7 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <alloca.h>
#include <signal.h> #include <signal.h>
#include <fcntl.h> #include <fcntl.h>
#include <netdb.h> #include <netdb.h>
@ -63,20 +64,35 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
const char *locuser, *remuser, *cmd; const char *locuser, *remuser, *cmd;
int *fd2p; int *fd2p;
{ {
struct hostent *hp; struct hostent hostbuf, *hp;
size_t hstbuflen;
char *tmphstbuf;
struct sockaddr_in sin, from; struct sockaddr_in sin, from;
fd_set reads; fd_set reads;
int32_t oldmask; int32_t oldmask;
pid_t pid; pid_t pid;
int s, lport, timo; int s, lport, timo;
char c; char c;
int herr;
pid = getpid(); pid = getpid();
hp = gethostbyname(*ahost);
if (hp == NULL) { hstbuflen = 1024;
herror(*ahost); tmphstbuf = __alloca (hstbuflen);
return (-1); 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; *ahost = hp->h_name;
oldmask = sigblock(sigmask(SIGURG)); oldmask = sigblock(sigmask(SIGURG));
for (timo = 1, lport = IPPORT_RESERVED - 1;;) { for (timo = 1, lport = IPPORT_RESERVED - 1;;) {
@ -244,12 +260,27 @@ ruserok(rhost, superuser, ruser, luser)
const char *rhost, *ruser, *luser; const char *rhost, *ruser, *luser;
int superuser; int superuser;
{ {
struct hostent *hp; struct hostent hostbuf, *hp;
size_t buflen;
char *buffer;
u_int32_t addr; u_int32_t addr;
char **ap; 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) { for (ap = hp->h_addr_list; *ap; ++ap) {
bcopy(*ap, &addr, sizeof(addr)); bcopy(*ap, &addr, sizeof(addr));
if (iruserok(addr, superuser, ruser, luser) == 0) if (iruserok(addr, superuser, ruser, luser) == 0)
@ -275,7 +306,7 @@ iruserok(raddr, superuser, ruser, luser)
{ {
register char *cp; register char *cp;
struct stat sbuf; struct stat sbuf;
struct passwd *pwd; struct passwd pwdbuf, *pwd;
FILE *hostf; FILE *hostf;
uid_t uid; uid_t uid;
int first; int first;
@ -293,10 +324,12 @@ again:
if (first == 1 && (__check_rhosts_file || superuser)) { if (first == 1 && (__check_rhosts_file || superuser)) {
char *pbuf; char *pbuf;
size_t dirlen; size_t dirlen;
size_t buflen = __sysconf (_SC_GETPW_R_SIZE_MAX);
char buffer = __alloca (buflen);
first = 0; first = 0;
if ((pwd = getpwnam(luser)) == NULL) if (getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0)
return (-1); return -1;
dirlen = strlen (pwd->pw_dir); dirlen = strlen (pwd->pw_dir);
pbuf = alloca (dirlen + sizeof "/.rhosts"); pbuf = alloca (dirlen + sizeof "/.rhosts");
@ -395,17 +428,30 @@ __icheckhost(raddr, lhost)
u_int32_t raddr; u_int32_t raddr;
register char *lhost; register char *lhost;
{ {
register struct hostent *hp; register struct hostent hostbuf, *hp;
size_t buflen;
char *buffer;
register u_int32_t laddr; register u_int32_t laddr;
register char **pp; register char **pp;
int herr;
/* Try for raw ip address first. */ /* Try for raw ip address first. */
if (isdigit(*lhost) && (int32_t)(laddr = inet_addr(lhost)) != -1) if (isdigit(*lhost) && (int32_t)(laddr = inet_addr(lhost)) != -1)
return (raddr == laddr); return (raddr == laddr);
/* Better be a hostname. */ /* Better be a hostname. */
if ((hp = gethostbyname(lhost)) == NULL) buflen = 1024;
return (0); 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. */ /* Spin through ip addresses. */
for (pp = hp->h_addr_list; *pp; ++pp) for (pp = hp->h_addr_list; *pp; ++pp)

View File

@ -40,6 +40,7 @@ static char sccsid[] = "@(#)rexec.c 8.1 (Berkeley) 6/4/93";
#include <netinet/in.h> #include <netinet/in.h>
#include <alloca.h>
#include <stdio.h> #include <stdio.h>
#include <netdb.h> #include <netdb.h>
#include <errno.h> #include <errno.h>
@ -56,16 +57,30 @@ rexec(ahost, rport, name, pass, cmd, fd2p)
int *fd2p; int *fd2p;
{ {
struct sockaddr_in sin, sin2, from; struct sockaddr_in sin, sin2, from;
struct hostent *hp; struct hostent hostbuf, *hp;
size_t hstbuflen;
char *hsttmpbuf;
u_short port; u_short port;
int s, timo = 1, s3; int s, timo = 1, s3;
char c; 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; *ahost = hp->h_name;
ruserpass(hp->h_name, &name, &pass); ruserpass(hp->h_name, &name, &pass);
retry: retry:

View File

@ -2,23 +2,23 @@
Copyright (C) 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. 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 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 C library, however. The master source lives in /gd/gnu/lib.
The GNU C Library is free software; you can redistribute it and/or 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 675 Mass Ave, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Cambridge, MA 02139, USA. */ Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
@ -106,7 +106,7 @@ _nl_find_domain (dirname, locale, domainname)
and six parts for the CEN syntax: 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 Beside the first all of them are allowed to be missing. If the
full specified locale is not found, the less specific one are full specified locale is not found, the less specific one are

View File

@ -1,23 +1,23 @@
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. /* 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 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 C library, however. The master source lives in /gd/gnu/lib.
The GNU C Library is free software; you can redistribute it and/or 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 675 Mass Ave, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Cambridge, MA 02139, USA. */ Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
@ -205,10 +205,11 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
strlen (modifier) + 1 : 0) strlen (modifier) + 1 : 0)
+ ((mask & CEN_SPECIAL) != 0 + ((mask & CEN_SPECIAL) != 0
? strlen (special) + 1 : 0) ? strlen (special) + 1 : 0)
+ ((mask & CEN_SPONSOR) != 0 + ((mask & (CEN_SPONSOR | CEN_REVISION) != 0)
? strlen (sponsor) + 1 : 0) ? (1 + ((mask & CEN_SPONSOR) != 0
+ ((mask & CEN_REVISION) != 0 ? strlen (sponsor) + 1 : 0)
? strlen (revision) + 1 : 0) + ((mask & CEN_REVISION) != 0
? strlen (revision) + 1 : 0)) : 0)
+ 1 + strlen (filename) + 1); + 1 + strlen (filename) + 1);
if (abs_filename == NULL) if (abs_filename == NULL)
@ -251,15 +252,16 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
*cp++ = '+'; *cp++ = '+';
cp = stpcpy (cp, special); cp = stpcpy (cp, special);
} }
if ((mask & CEN_SPONSOR) != 0) if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0)
{ {
*cp++ = ','; *cp++ = ',';
cp = stpcpy (cp, sponsor); if ((mask & CEN_SPONSOR) != 0)
} cp = stpcpy (cp, sponsor);
if ((mask & CEN_REVISION) != 0) if ((mask & CEN_REVISION) != 0)
{ {
*cp++ = '_'; *cp++ = '_';
cp = stpcpy (cp, revision); cp = stpcpy (cp, revision);
}
} }
*cp++ = '/'; *cp++ = '/';

1
link.h Normal file
View File

@ -0,0 +1 @@
#include <elf/link.h>

View File

@ -12,9 +12,9 @@
# Library General Public License for more details. # Library General Public License for more details.
# You should have received a copy of the GNU Library General Public # 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 # License along with the GNU C Library; see the file COPYING.LIB. If not,
# not, write to the Free Software Foundation, Inc., # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Boston, MA 02111-1307, USA.
# #
# Makefile for locales. # Makefile for locales.
@ -64,7 +64,10 @@ $(objpfx)localedef: $(localedef-modules:%=$(objpfx)%.o)
$(objpfx)locale: $(locale-modules:%=$(objpfx)%.o) $(objpfx)locale: $(locale-modules:%=$(objpfx)%.o)
$(objpfx)localedef $(objpfx)locale: $(lib-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"' \ -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
-DLOCSRCDIR='"$(i18ndir)/locales"' -DHAVE_CONFIG_H \ -DLOCSRCDIR='"$(i18ndir)/locales"' -DHAVE_CONFIG_H \
-Iprograms $(CPPFLAGS) -Iprograms $(CPPFLAGS)

View File

@ -1,21 +1,21 @@
/* Copyright (C) 1996 Free Software Foundation, Inc. /* Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
The GNU C Library is free software; you can redistribute it and/or 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <locale.h> #include <locale.h>
#include <stdlib.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: 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 Beside the first all of them are allowed to be missing. If the
full specified locale is not found, the less specific one are full specified locale is not found, the less specific one are

View File

@ -1,21 +1,21 @@
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
The GNU C Library is free software; you can redistribute it and/or 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <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 the end of the function we need another byte for the trailing
'/'. */ '/'. */
if (normal == NULL) if (normal == NULL)
asprintf (&result, "%s/%s%c", LOCALE_PATH, path, '\0'); asprintf (&result, "%s/%s%c", LOCALEDIR, path, '\0');
else 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'); normal, endp, '\0');
} }
else else

View File

@ -255,8 +255,7 @@ setlocale (int category, const char *locale)
&locale_path, &locale_path_len) != 0) &locale_path, &locale_path_len) != 0)
return NULL; return NULL;
if (__argz_append (&locale_path, &locale_path_len, if (__argz_add_sep (&locale_path, &locale_path_len, LOCALE_PATH, ':') != 0)
LOCALE_PATH, sizeof (LOCALE_PATH)) != 0)
return NULL; return NULL;
if (category == LC_ALL) if (category == LC_ALL)

View File

@ -27,7 +27,7 @@ headers := utmp.h utmpbits.h lastlog.h pty.h
routines := getutent getutent_r getutid getutline getutid_r getutline_r \ routines := getutent getutent_r getutid getutline getutid_r getutline_r \
utmp_file utmp_db utmp_file utmp_db
distribtue := utmp-private.h distribute := utmp-private.h
# Build the -lutil library with these extra functions. # Build the -lutil library with these extra functions.
extra-libs := libutil extra-libs := libutil

View File

@ -55,7 +55,7 @@ libnss_dns-routines := dns-host dns-network
libnss_db-routines := $(addprefix db-,$(filter-out hosts network key,\ libnss_db-routines := $(addprefix db-,$(filter-out hosts network key,\
$(databases))) $(databases)))
generated += $(filter-out db-netgrp.c, \ generated += $(filter-out db-alias.c db-netgrp.c, \
$(addsuffix .c,$(libnss_db-routines))) $(addsuffix .c,$(libnss_db-routines)))
distribute += db-XXX.c distribute += db-XXX.c

View File

@ -96,15 +96,22 @@ FUNCTION_NAME (ADD_PARAMS)
while (buffer != NULL while (buffer != NULL
&& INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, &resbuf, buffer, && INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, &resbuf, buffer,
buffer_size, &result H_ERRNO_VAR) != 0 buffer_size, &result H_ERRNO_VAR) != 0
#ifdef NEED_H_ERRNO
&& h_errno_tmp == NETDB_INTERNAL
#endif
&& errno == ERANGE) && errno == ERANGE)
{ {
char *new_buf; char *new_buf;
buffer_size += BUFLEN; buffer_size += BUFLEN;
new_buf = realloc (buffer, buffer_size); new_buf = realloc (buffer, buffer_size);
if (new_buf == NULL) if (new_buf == NULL)
/* We are out of memory. Free the current buffer so that the {
process gets a chance for a normal termination. */ /* We are out of memory. Free the current buffer so that the
free (buffer); process gets a chance for a normal termination. */
save = errno;
free (buffer);
__set_errno (save);
}
buffer = new_buf; buffer = new_buf;
} }

View File

@ -84,15 +84,22 @@ GETFUNC_NAME (void)
while (buffer != NULL while (buffer != NULL
&& INTERNAL (REENTRANT_GETNAME) (&resbuf, buffer, buffer_size, &result && INTERNAL (REENTRANT_GETNAME) (&resbuf, buffer, buffer_size, &result
H_ERRNO_VAR) != 0 H_ERRNO_VAR) != 0
#ifdef NEED_H_ERRNO
&& h_errno == NETDB_INTERNAL
#endif
&& errno == ERANGE) && errno == ERANGE)
{ {
char *new_buf; char *new_buf;
buffer_size += BUFLEN; buffer_size += BUFLEN;
new_buf = realloc (buffer, buffer_size); new_buf = realloc (buffer, buffer_size);
if (new_buf == NULL) if (new_buf == NULL)
/* We are out of memory. Free the current buffer so that the {
process gets a chance for a normal termination. */ /* We are out of memory. Free the current buffer so that the
free (buffer); process gets a chance for a normal termination. */
save = errno;
free (buffer);
__set_errno (save);
}
buffer = new_buf; buffer = new_buf;
} }

View File

@ -149,6 +149,7 @@ internal_getent (struct STRUCTURE *result,
if (buflen < (int) sizeof *data + 1) if (buflen < (int) sizeof *data + 1)
{ {
__set_errno (ERANGE); __set_errno (ERANGE);
HERRNO_SET (NETDB_INTERNAL);
return NSS_STATUS_TRYAGAIN; return NSS_STATUS_TRYAGAIN;
} }

View File

@ -22,13 +22,13 @@
#include <errno.h> #include <errno.h>
#include <netdb.h> #include <netdb.h>
#include <libc-lock.h> #include <libc-lock.h>
#include <link.h> /* We need some help from ld.so. */
#include <search.h> #include <search.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "nsswitch.h" #include "nsswitch.h"
#include "../elf/link.h" /* We need some help from ld.so. */
/* Prototypes for the local functions. */ /* Prototypes for the local functions. */
static void *nss_lookup_function (service_user *ni, const char *fct_name); static void *nss_lookup_function (service_user *ni, const char *fct_name);

View File

@ -231,7 +231,14 @@ main (int argc, char *argv[])
if (argc > 2) if (argc > 2)
usage (); usage ();
value = sysconf (c->call_name); 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); exit (0);
case CONFSTR: case CONFSTR:

View File

@ -56,7 +56,7 @@ Cambridge, MA 02139, USA. */
#include <stddef.h> #include <stddef.h>
#endif #endif
#ifdef HAVE_UNISTD_H #if defined HAVE_UNISTD_H || defined _LIBC
#include <unistd.h> #include <unistd.h>
#ifndef POSIX #ifndef POSIX
#ifdef _POSIX_VERSION #ifdef _POSIX_VERSION
@ -467,11 +467,40 @@ glob (pattern, flags, errfunc, pglob)
if (dirname == NULL || dirname[0] == '\0') if (dirname == NULL || dirname[0] == '\0')
{ {
extern char *getlogin __P ((void)); extern char *getlogin __P ((void));
char *name = getlogin (); extern int getlogin_r __P ((char *, size_t));
if (name != NULL) 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); struct passwd *p = getpwnam (name);
if (p != NULL) success = p != NULL;
#endif
if (success)
dirname = p->pw_dir; dirname = p->pw_dir;
} }
} }
@ -491,9 +520,17 @@ glob (pattern, flags, errfunc, pglob)
dirname = "c:/users/default"; /* poor default */ dirname = "c:/users/default"; /* poor default */
#else #else
/* Look up specific user's home directory. */ /* 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); struct passwd *p = getpwnam (dirname + 1);
if (p != NULL) if (p != NULL)
dirname = p->pw_dir; dirname = p->pw_dir;
#endif
#endif /* WIN32 */ #endif /* WIN32 */
#endif #endif
} }

View File

@ -1 +1 @@
#include <stdio/printf.h> #include <stdio-common/printf.h>

View File

@ -1,23 +1,25 @@
/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc. /* 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 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 675 Mass Ave, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Cambridge, MA 02139, USA. */ Boston, MA 02111-1307, USA. */
#include <alloca.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include <pwd.h> #include <pwd.h>
@ -30,9 +32,11 @@ int __getpw __P ((__uid_t uid, char *buf));
int int
__getpw (uid, buf) __getpw (uid, buf)
__uid_t uid; __uid_t uid;
register char *buf; char *buf;
{ {
register struct passwd *p; size_t buflen;
char *tmpbuf;
struct passwd resbuf, *p;
if (buf == NULL) if (buf == NULL)
{ {
@ -40,8 +44,10 @@ __getpw (uid, buf)
return -1; return -1;
} }
p = getpwuid (uid); buflen = __sysconf (_SC_GETPW_R_SIZE_MAX);
if (p == NULL) tmpbuf = alloca (buflen);
if (getpwuid_r (uid, &resbuf, tmpbuf, buflen, &p) < 0)
return -1; return -1;
if (sprintf (buf, "%s:%s:%u:%u:%s:%s:%s", p->pw_name, p->pw_passwd, if (sprintf (buf, "%s:%s:%u:%u:%s:%s:%s", p->pw_name, p->pw_passwd,

View File

@ -53,5 +53,5 @@ l64a (n)
n >>= 6; n >>= 6;
} }
return &result[n + 1]; return &result[cnt + 1];
} }

View File

@ -27,10 +27,10 @@ Boston, MA 02111-1307, USA. */
# include "../libio/libioP.h" # include "../libio/libioP.h"
# include "../libio/strfile.h" # include "../libio/strfile.h"
#endif #endif
#include <printf.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "../stdio-common/printf.h"
#include "../locale/localeinfo.h" #include "../locale/localeinfo.h"

View File

@ -35,7 +35,8 @@ routines := strcat strchr strcmp strcoll strcpy strcspn \
memccpy memcpy wordcopy strsep \ memccpy memcpy wordcopy strsep \
swab strfry memfrob memmem \ swab strfry memfrob memmem \
$(addprefix argz-,append count create ctsep next \ $(addprefix argz-,append count create ctsep next \
delete extract insert stringify) \ delete extract insert stringify \
addsep) \
envz basename envz basename
tests := tester testcopy test-ffs tst-strlen stratcliff tests := tester testcopy test-ffs tst-strlen stratcliff

59
string/argz-addsep.c Normal file
View File

@ -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)

View File

@ -1,21 +1,21 @@
/* Copyright (C) 1996 Free Software Foundation, Inc. /* Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
The GNU C Library is free software; you can redistribute it and/or 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <argz.h> #include <argz.h>
#include <errno.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; size_t nlen = strlen (string) + 1;
if (nlen != 0) if (nlen > 1)
{ {
const char *rp; const char *rp;
char *wp; char *wp;
*argz = (char *) malloc (nlen); *argz = (char *) malloc (nlen);
if (*argz == NULL) if (*argz == NULL)
return ENOMEM; return ENOMEM;
@ -50,10 +50,19 @@ __argz_create_sep (const char *string, int delim, char **argz, size_t *len)
else else
*wp++ = *rp; *wp++ = *rp;
while (*rp++ != '\0'); 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; return 0;
} }

View 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, extern error_t argz_add __P ((char **__argz, size_t *__argz_len,
__const char *__str)); __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. */ /* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there. */
extern void __argz_delete __P ((char **__argz, size_t *__argz_len, extern void __argz_delete __P ((char **__argz, size_t *__argz_len,
char *__entry)); char *__entry));

View File

@ -74,7 +74,7 @@ STRCOLL (s1, s2)
u_int32_t w1, w2; u_int32_t w1, w2;
/* Here we have to check for IGNORE entries. If these are /* 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]) while ((w1 = s1run->data[pass].value[s1idx])
== (u_int32_t) IGNORE_CHAR) == (u_int32_t) IGNORE_CHAR)
{ {

View File

@ -6,11 +6,11 @@
* may copy or modify Sun RPC without charge, but are not authorized * 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 * to license or distribute it to anyone else except as part of a product or
* program developed by the user. * program developed by the user.
* *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * 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 * Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction, * part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement. * modification or enhancement.
@ -18,11 +18,11 @@
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF. * OR ANY PART THEREOF.
* *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue * In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if * or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages. * Sun has been advised of the possibility of such damages.
* *
* Sun Microsystems, Inc. * Sun Microsystems, Inc.
* 2550 Garcia Avenue * 2550 Garcia Avenue
* Mountain View, California 94043 * 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. * Copyright (C) 1987, Sun Microsystems, Inc.
*/ */
#include <alloca.h>
#include <errno.h>
#include <rpc/rpc.h> #include <rpc/rpc.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/errno.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 * 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. * change using the rpc equivalent of ioctl()'s.
*/ */
CLIENT * CLIENT *
@ -50,36 +52,64 @@ clnt_create(hostname, prog, vers, proto)
unsigned vers; unsigned vers;
char *proto; char *proto;
{ {
struct hostent *h; struct hostent hostbuf, *h;
struct protoent *p; size_t hstbuflen;
char *hsttmpbuf;
struct protoent protobuf, *p;
size_t prtbuflen;
char *prttmpbuf;
struct sockaddr_in sin; struct sockaddr_in sin;
int sock; int sock;
struct timeval tv; struct timeval tv;
CLIENT *client; 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) { if (h->h_addrtype != AF_INET) {
/* /*
* Only support INET for now * Only support INET for now
*/ */
rpc_createerr.cf_stat = RPC_SYSTEMERROR; rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = EAFNOSUPPORT; rpc_createerr.cf_error.re_errno = EAFNOSUPPORT;
return (NULL); return (NULL);
} }
sin.sin_family = h->h_addrtype; sin.sin_family = h->h_addrtype;
sin.sin_port = 0; sin.sin_port = 0;
bzero(sin.sin_zero, sizeof(sin.sin_zero)); bzero(sin.sin_zero, sizeof(sin.sin_zero));
bcopy(h->h_addr, (char*)&sin.sin_addr, h->h_length); bcopy(h->h_addr, (char*)&sin.sin_addr, h->h_length);
p = getprotobyname(proto);
if (p == NULL) { prtbuflen = 1024;
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; prttmpbuf = __alloca (prtbuflen);
rpc_createerr.cf_error.re_errno = EPFNOSUPPORT; while (__getprotobyname_r (proto, &protobuf, prttmpbuf, prtbuflen, &p)
return (NULL); < 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; sock = RPC_ANYSOCK;
switch (p->p_proto) { switch (p->p_proto) {
case IPPROTO_UDP: case IPPROTO_UDP:
@ -103,7 +133,7 @@ clnt_create(hostname, prog, vers, proto)
break; break;
default: default:
rpc_createerr.cf_stat = RPC_SYSTEMERROR; rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = EPFNOSUPPORT; rpc_createerr.cf_error.re_errno = EPFNOSUPPORT;
return (NULL); return (NULL);
} }
return (client); return (client);

View 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. * Copyright (C) 1984, Sun Microsystems, Inc.
*/ */
#include <alloca.h>
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <rpc/rpc.h> #include <rpc/rpc.h>
#include <sys/socket.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; register struct callrpc_private *crp = callrpc_private;
struct sockaddr_in server_addr; struct sockaddr_in server_addr;
enum clnt_stat clnt_stat; enum clnt_stat clnt_stat;
struct hostent *hp; struct hostent hostbuf, *hp;
struct timeval timeout, tottimeout; struct timeval timeout, tottimeout;
if (crp == 0) { if (crp == 0) {
@ -77,6 +79,10 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
&& strcmp(crp->oldhost, host) == 0) { && strcmp(crp->oldhost, host) == 0) {
/* reuse old client */ /* reuse old client */
} else { } else {
size_t buflen;
char *buffer;
int herr;
crp->valid = 0; crp->valid = 0;
if (crp->socket != RPC_ANYSOCK) if (crp->socket != RPC_ANYSOCK)
{ {
@ -87,8 +93,20 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
clnt_destroy(crp->client); clnt_destroy(crp->client);
crp->client = NULL; 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_usec = 0;
timeout.tv_sec = 5; timeout.tv_sec = 5;
bcopy(hp->h_addr, (char *)&server_addr.sin_addr, hp->h_length); bcopy(hp->h_addr, (char *)&server_addr.sin_addr, hp->h_length);

View 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 * 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 * to license or distribute it to anyone else except as part of a product or
* program developed by the user. * program developed by the user.
* *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * 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 * Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction, * part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement. * modification or enhancement.
* *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF. * OR ANY PART THEREOF.
* *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue * In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if * or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages. * Sun has been advised of the possibility of such damages.
* *
* Sun Microsystems, Inc. * Sun Microsystems, Inc.
* 2550 Garcia Avenue * 2550 Garcia Avenue
* Mountain View, California 94043 * 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. * Copyright (c) 1985 by Sun Microsystems, Inc.
*/ */
#include <alloca.h>
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <rpc/rpc.h> #include <rpc/rpc.h>
#include <netdb.h> #include <netdb.h>
#include <sys/socket.h> #include <sys/socket.h>
int
getrpcport(host, prognum, versnum, proto) getrpcport(host, prognum, versnum, proto)
char *host; char *host;
{ {
struct sockaddr_in addr; 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); bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length);
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_port = 0; addr.sin_port = 0;

View File

@ -21,7 +21,6 @@ sys/mount.h
sys/mtio.h sys/mtio.h
sys/procfs.h sys/procfs.h
sys/quota.h sys/quota.h
sys/serial.h
sys/socketcall.h sys/socketcall.h
sys/soundcard.h sys/soundcard.h
sys/sysctl.h sys/sysctl.h

View File

@ -10,8 +10,7 @@ sysdep_routines += sysctl clone llseek
sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \ 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/module.h sys/io.h sys/klog.h sys/kdaemon.h \
sys/user.h syscall-list.h sys/sysmacros.h sys/procfs.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/debugreg.h sys/kd.h sys/soundcard.h sys/vt.h
sys/serial.h
# Generate the list of SYS_* macros for the system calls (__NR_* macros). # Generate the list of SYS_* macros for the system calls (__NR_* macros).
$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/syscall.h $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/syscall.h

View File

@ -1,20 +1,21 @@
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or 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 modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public 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 License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <alloca.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
@ -58,9 +59,12 @@ long int
gethostid () gethostid ()
{ {
char hostname[MAXHOSTNAMELEN + 1]; char hostname[MAXHOSTNAMELEN + 1];
struct hostent *hp; size_t buflen;
unsigned long id; char *buffer;
struct hostent hostbuf, *hp;
unsigned long int id;
struct in_addr in; struct in_addr in;
int herr;
int fd; int fd;
/* First try to get the ID from a former invocation of sethostid. */ /* First try to get the ID from a former invocation of sethostid. */
@ -81,10 +85,20 @@ gethostid ()
/* This also fails. Return and arbitrary value. */ /* This also fails. Return and arbitrary value. */
return 0; return 0;
buflen = 1024;
buffer = __alloca (buflen);
/* To get the IP address we need to know the host name. */ /* To get the IP address we need to know the host name. */
hp = gethostbyname (hostname); while (__gethostbyname_r (hostname, &hostbuf, buffer, buflen, &hp, &herr)
if (hp == NULL) < 0)
return 0; if (herr != NETDB_INTERNAL || errno != ERANGE)
return 0;
else
{
/* Enlarge buffer. */
buflen *= 2;
buffer = __alloca (buflen);
}
in.s_addr = 0; in.s_addr = 0;
memcpy (&in, hp->h_addr, memcpy (&in, hp->h_addr,

View File

@ -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 */

View File

@ -99,7 +99,7 @@ $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
mv $@.new $@ mv $@.new $@
.PHONY: echo-zonenames .PHONY: echo-zonenames
echo-zonenames: zonenames echo-zonenames:
@echo 'Known zones: $(zonenames)' @echo 'Known zones: $(zonenames)'