aboutsummaryrefslogtreecommitdiff
path: root/inet
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-06-25 08:56:57 +0000
committerRoland McGrath <roland@gnu.org>1996-06-25 08:56:57 +0000
commit5f0e6fc702296840d2daa39f83f6cb1e40073d58 (patch)
tree6e6c29e50f713eac4c87b54a6e5730fa0dedb65a /inet
parent7f8116797fdb967571c00ec1d5b19d9d06813445 (diff)
downloadglibc-5f0e6fc702296840d2daa39f83f6cb1e40073d58.zip
glibc-5f0e6fc702296840d2daa39f83f6cb1e40073d58.tar.gz
glibc-5f0e6fc702296840d2daa39f83f6cb1e40073d58.tar.bz2
Tue Jun 25 02:59:11 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>cvs/libc-960625
* malloc/malloc.h: Declare malloc_object_allocated_size, malloc_walk. * malloc/Makefile (dist-routines): Add malloc-size, malloc-walk. * malloc/malloc-size.c: New file. * malloc/malloc-walk.c: New file. * malloc/malloc-find.c (malloc_find_object_address): Return null if PTR is outside the heap. * elf/dl-load.c (_dl_map_object): If the requested name matches the soname of a loaded object, use that object. Mon Jun 24 19:57:01 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * Makefile (subdirs): Add nss. * inet/Makefile (routines): Add getrpcent, getrpcbyname, getrpcbynumber, getrpcent_r, getrpcbyname_r, getrpcbynumber_r. * inet/getrpcbynumber_r.c: New file. * inet/getrpcbynumber.c: New file. * inet/getrpcbyname.c: New file. * inet/getrpcbyname_r.c: New file. * inet/getrpcent_r.c: New file. * inet/getrpcent.c: New file. * nss/rpc-lookup.c: New file. * nss/nss_files/files-rpc.c: New file. * nss/Makefile (routines): Add rpc-lookup. (libnss_files-routines): Add files-rpc. * sunrpc/Makefile (routines): Remove getrpcent. * sunrpc/getrpcent.c: File removed. * nss/getXXent_r.c (REENTRANT_GETNAME): Clear NO_MORE when NIP is non-null on entry. * Makeconfig (rpath-link): Add $(nssobjdir). (nssobjdir): New variable. * Makerules: Move shared library building before objects rules, so versions are known before extra-lib.mk gets included. * extra-lib.mk (lib-noranlib): Depend on the shared object too. * pwd/getpwuid.c: Rewritten using nss. * pwd/getpwnam.c: Likewise. * pwd/getpwent.c: Likewise. * grp/getgrnam.c: Likewise. * grp/getgrgid.c: Likewise. * grp/getgrent.c: Likewise. * pwd/Makefile (routines): Add getpwent_r, getpwnam_r, getpwuid_r. * pwd/getpwent_r.c: New file. * pwd/getpwnam_r.c: New file. * pwd/getpwuid_r.c: New file. * grp/Makefile (routines): Add getgrent_r, getgrgid_r, getgrnam_r. * grp/getgrnam_r.c: New file. * grp/getgrgid_r.c: New file. * grp/getgrent_r.c: New file. * grp/Makefile (routines): Remove grpopen, grpread. * pwd/Makefile (routines): Remove pwdopen, pwdread. * grp/grpopen.c, grp/grpread.c, pwd/pwdopen.c, pwd/pwdread.c: Removed. * pwd/fgetpwent.c: Rewritten using files-parse.c. * grp/fgetgrent.c: Likewise. * nss/Makefile (routines): Add grp-lookup and pwd-lookup. * nss/pwd-lookup.c, nss/grp-lookup.c: New files. * nss/nss_files/files-grp.c: New file. * nss/nss_files/files-pwd.c: New file. * nss/Makefile (subdir-dirs): New variable; use it in vpath. * nss/nss_files/files-parse.c: New file. * nss/nss_files/files-XXX.c: New file. * nss/nss_files/files-hosts.c, nss/nss_files/files-proto.c, nss/nss_files/files-service.c, nss/nss_files/files-network.c: Rewritten using them. * nss/Makefile (libnss_files-routines): Remove files-host. Add files-hosts, files-grp, files-pwd. * nss/nss_dns/dns-network.c: Don't include <pthread.h>. Mon Jun 24 22:39:12 1996 Richard Henderson <rth@tamu.edu> * sysdeps/alpha/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE): A .plt entry now loads the .rela.plt offset directly rather than making us calculate it. Sun Jun 23 15:24:05 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * time/Makefile ($(installed-localtime-file) rule): Do $(make-target-directory) first. * resolv.h: Fix wrapper for resolv/resolv.h. * configure.in (ld --no-whole-archive check): Use AC_TRY_COMMAND. Compile dummy file and pass -nostdlib -nostartfiles so as not to require installed libraries. * shlib-versions (*-*-*): Set libresolv=2, libnss_files=1, libnss_dns=1. Sun Jun 23 19:42:05 1996 Ulrich Drepper <drepper@cygnus.com> * resolv/netdb.h (_PATH_NSSWITCH_CONF): New macro. * inet/herrno.c: New file. * resolv/res_init.c: Remove res_hconf calls. * nss/Makefile, nss/XXX-lookup.c, nss/file-lookup.c, nss/getXXbyYY.c, nss/getXXbyYY_r.c, nss/getXXent.c, nss/getXXent_r.c, nss/host-lookup.c, nss/network-lookup.c, nss/nsswitch.c, nss/nsswitch.h, nss/proto-lookup.c, nss/service-lookup.c: New files. Implementation of name service switch, following the approach in Solaris. Interface specification and general structure inspired by Peter Eriksson <pen@lysator.liu.se>. * nss/nss_files/files-host.c, nss/nss_files/files-network.c, nss/nss_files/files-proto.c, nss/nss_files/files-service.c: Implementation of libnss_files.so module for file based databases in NSS service. * nss/nss_dns/dns-host.c, nss/nss_dns/dns-network.c: Implementation if libnss_dns.so module for DNS name lookup in NSS service. * inet/getproto.c, inet/getprtent.c, inet/getprtname.c, inet/getservent.c, inet/getsrvbynm.c, inet/getsrvbypt.c: Changed to serve as interface to NSS. * inet/gethstbyad.c, inet/gethstbyad_r.c, inet/gethstbynm.c, inet/gethstbynm2.c, inet/gethstbynm2_r.c, inet/gethstbynm_r.c, inet/gethstent.c, inet/gethstent_r.c, inet/getnetbynm.c, inet/getnetbynm_r.c, inet/getnetbypt.c, inet/getnetbypt_r.c, inet/getnetent.c, inet/getnetent_r.c, inet/getproto_r.c, inet/getprtent_r.c, inet/getprtname_r.c, inet/getservent_r.c, inet/getsrvbynm_r.c, inet/getsrvbypt_r.c: New files. Implement interfaces to NSS, including reentrant functions. * resolv/getnetbyaddr.c, resolv/getnetbyname.c, resolv/getnetent.c, resolv/sethostent.c: Removed: Obsoleted by NSS. * resolv/mapv4v6addr.h, resolv/mapv4v6hostent.h: Extracted from gethnamaddr.c. These private functions are now used in more than one file. * resolv/inet_pton.c, resolv/gethnamaddr.c: Updated to bind-4.9.4-T5B. Sat Jun 22 16:49:47 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * rpm/Makefile ($(config)): Make sure the word list in the for loop is syntactically non-empty.
Diffstat (limited to 'inet')
-rw-r--r--inet/Makefile15
-rw-r--r--inet/gethstbyad.c31
-rw-r--r--inet/gethstbyad_r.c31
-rw-r--r--inet/gethstbynm.c31
-rw-r--r--inet/gethstbynm2.c31
-rw-r--r--inet/gethstbynm2_r.c30
-rw-r--r--inet/gethstbynm_r.c31
-rw-r--r--inet/gethstent.c27
-rw-r--r--inet/gethstent_r.c32
-rw-r--r--inet/getnetbynm.c30
-rw-r--r--inet/getnetbynm_r.c30
-rw-r--r--inet/getnetbypt.c30
-rw-r--r--inet/getnetbypt_r.c30
-rw-r--r--inet/getnetent.c26
-rw-r--r--inet/getnetent_r.c31
-rw-r--r--inet/getproto.c73
-rw-r--r--inet/getproto_r.c29
-rw-r--r--inet/getprtent.c131
-rw-r--r--inet/getprtent_r.c30
-rw-r--r--inet/getprtname.c80
-rw-r--r--inet/getprtname_r.c29
-rw-r--r--inet/getrpcbyname.c30
-rw-r--r--inet/getrpcbyname_r.c29
-rw-r--r--inet/getrpcbynumber.c29
-rw-r--r--inet/getrpcbynumber_r.c29
-rw-r--r--inet/getrpcent.c26
-rw-r--r--inet/getrpcent_r.c26
-rw-r--r--inet/getservent.c133
-rw-r--r--inet/getservent_r.c30
-rw-r--r--inet/getsrvbynm.c83
-rw-r--r--inet/getsrvbynm_r.c29
-rw-r--r--inet/getsrvbypt.c78
-rw-r--r--inet/getsrvbypt_r.c29
-rw-r--r--inet/herrno.c22
34 files changed, 933 insertions, 448 deletions
diff --git a/inet/Makefile b/inet/Makefile
index 9389a22..da300c7 100644
--- a/inet/Makefile
+++ b/inet/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96 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
@@ -25,9 +25,16 @@ headers := netinet/in.h $(wildcard arpa/*.h protocols/*.h)
routines := ntohl ntohs htonl htons \
inet_lnaof inet_mkadr \
- inet_netof inet_ntoa inet_net \
- getproto getprtent getprtname \
- getsrvbynm getsrvbypt getservent \
+ inet_netof inet_ntoa inet_net herrno \
+ gethstbyad gethstbyad_r gethstbynm gethstbynm2 gethstbynm2_r \
+ gethstbynm_r gethstent gethstent_r \
+ getnetbypt getnetbypt_r getnetbynm getnetent getnetent_r \
+ getnetbynm_r \
+ getproto getproto_r getprtent getprtent_r getprtname getprtname_r \
+ getsrvbynm getsrvbynm_r getsrvbypt getsrvbypt_r getservent \
+ getservent_r \
+ getrpcent getrpcbyname getrpcbynumber \
+ getrpcent_r getrpcbyname_r getrpcbynumber_r \
rcmd rexec ruserpass
# No warnings about losing BSD code.
diff --git a/inet/gethstbyad.c b/inet/gethstbyad.c
new file mode 100644
index 0000000..abc2eab
--- /dev/null
+++ b/inet/gethstbyad.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct hostent
+#define FUNCTION_NAME gethostbyaddr
+#define DATABASE_NAME hosts
+#define ADD_PARAMS const char *addr, int len, int type
+#define ADD_VARIABLES addr, len, type
+#define BUFLEN 1024
+#define NEED_H_ERRNO 1
+
+#include "../nss/getXXbyYY.c"
diff --git a/inet/gethstbyad_r.c b/inet/gethstbyad_r.c
new file mode 100644
index 0000000..7dce440
--- /dev/null
+++ b/inet/gethstbyad_r.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct hostent
+#define FUNCTION_NAME gethostbyaddr
+#define DATABASE_NAME hosts
+#define ADD_PARAMS const char *addr, int len, int type
+#define ADD_VARIABLES addr, len, type
+#define NEED_H_ERRNO 1
+#define NEED__RES 1
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/inet/gethstbynm.c b/inet/gethstbynm.c
new file mode 100644
index 0000000..0717810
--- /dev/null
+++ b/inet/gethstbynm.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct hostent
+#define FUNCTION_NAME gethostbyname
+#define DATABASE_NAME hosts
+#define ADD_PARAMS const char *name
+#define ADD_VARIABLES name
+#define BUFLEN 1024
+#define NEED_H_ERRNO 1
+
+#include "../nss/getXXbyYY.c"
diff --git a/inet/gethstbynm2.c b/inet/gethstbynm2.c
new file mode 100644
index 0000000..42a01d4
--- /dev/null
+++ b/inet/gethstbynm2.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct hostent
+#define FUNCTION_NAME gethostbyname2
+#define DATABASE_NAME hosts
+#define ADD_PARAMS const char *name, int af
+#define ADD_VARIABLES name, af
+#define BUFLEN 1024
+#define NEED_H_ERRNO 1
+
+#include "../nss/getXXbyYY.c"
diff --git a/inet/gethstbynm2_r.c b/inet/gethstbynm2_r.c
new file mode 100644
index 0000000..a2aee54
--- /dev/null
+++ b/inet/gethstbynm2_r.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct hostent
+#define FUNCTION_NAME gethostbyname2
+#define DATABASE_NAME hosts
+#define ADD_PARAMS const char *name, int af
+#define ADD_VARIABLES name, af
+#define NEED_H_ERRNO 1
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/inet/gethstbynm_r.c b/inet/gethstbynm_r.c
new file mode 100644
index 0000000..6bd2920
--- /dev/null
+++ b/inet/gethstbynm_r.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct hostent
+#define FUNCTION_NAME gethostbyname
+#define DATABASE_NAME hosts
+#define ADD_PARAMS const char *name
+#define ADD_VARIABLES name
+#define NEED_H_ERRNO 1
+#define NEED__RES 1
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/inet/gethstent.c b/inet/gethstent.c
new file mode 100644
index 0000000..5c72936
--- /dev/null
+++ b/inet/gethstent.c
@@ -0,0 +1,27 @@
+/* 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. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct hostent
+#define GETFUNC_NAME gethostent
+#define BUFLEN 1024
+#define NEED_H_ERRNO 1
+
+#include "../nss/getXXent.c"
diff --git a/inet/gethstent_r.c b/inet/gethstent_r.c
new file mode 100644
index 0000000..f07601d
--- /dev/null
+++ b/inet/gethstent_r.c
@@ -0,0 +1,32 @@
+/* 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. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct hostent
+#define SETFUNC_NAME sethostent
+#define GETFUNC_NAME gethostent
+#define ENDFUNC_NAME endhostent
+#define DATABASE_NAME hosts
+#define STAYOPEN int stayopen
+#define STAYOPEN_VAR stayopen
+#define NEED_H_ERRNO 1
+#define NEED__RES 1
+
+#include "../nss/getXXent_r.c"
diff --git a/inet/getnetbynm.c b/inet/getnetbynm.c
new file mode 100644
index 0000000..db1c7b0
--- /dev/null
+++ b/inet/getnetbynm.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct netent
+#define FUNCTION_NAME getnetbyname
+#define DATABASE_NAME networks
+#define ADD_PARAMS const char *name
+#define ADD_VARIABLES name
+#define BUFLEN 1024
+
+#include "../nss/getXXbyYY.c"
diff --git a/inet/getnetbynm_r.c b/inet/getnetbynm_r.c
new file mode 100644
index 0000000..ba395d6
--- /dev/null
+++ b/inet/getnetbynm_r.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct netent
+#define FUNCTION_NAME getnetbyname
+#define DATABASE_NAME networks
+#define ADD_PARAMS const char *name
+#define ADD_VARIABLES name
+#define NEED__RES 1
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/inet/getnetbypt.c b/inet/getnetbypt.c
new file mode 100644
index 0000000..960ac0a
--- /dev/null
+++ b/inet/getnetbypt.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct netent
+#define FUNCTION_NAME getnetbyport
+#define DATABASE_NAME networks
+#define ADD_PARAMS unsigned long int net, int type
+#define ADD_VARIABLES net, type
+#define BUFLEN 1024
+
+#include "../nss/getXXbyYY.c"
diff --git a/inet/getnetbypt_r.c b/inet/getnetbypt_r.c
new file mode 100644
index 0000000..a39f26f
--- /dev/null
+++ b/inet/getnetbypt_r.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct netent
+#define FUNCTION_NAME getnetbyport
+#define DATABASE_NAME networks
+#define ADD_PARAMS unsigned long int net, int type
+#define ADD_VARIABLES net, type
+#define NEED__RES 1
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/inet/getnetent.c b/inet/getnetent.c
new file mode 100644
index 0000000..207a70e
--- /dev/null
+++ b/inet/getnetent.c
@@ -0,0 +1,26 @@
+/* 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. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct netent
+#define GETFUNC_NAME getnetent
+#define BUFLEN 1024
+
+#include "../nss/getXXent.c"
diff --git a/inet/getnetent_r.c b/inet/getnetent_r.c
new file mode 100644
index 0000000..333bb4b
--- /dev/null
+++ b/inet/getnetent_r.c
@@ -0,0 +1,31 @@
+/* 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. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct netent
+#define SETFUNC_NAME setnetent
+#define GETFUNC_NAME getnetent
+#define ENDFUNC_NAME endnetent
+#define DATABASE_NAME networks
+#define STAYOPEN int stayopen
+#define STAYOPEN_VAR stayopen
+#define NEED__RES 1
+
+#include "../nss/getXXent_r.c"
diff --git a/inet/getproto.c b/inet/getproto.c
index 92f562b..11452c1 100644
--- a/inet/getproto.c
+++ b/inet/getproto.c
@@ -1,55 +1,30 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getproto.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
+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 <netdb.h>
-extern int _proto_stayopen;
-struct protoent *
-getprotobynumber(proto)
- register int proto;
-{
- register struct protoent *p;
+#define LOOKUP_TYPE struct protoent
+#define FUNCTION_NAME getprotobynumber
+#define DATABASE_NAME protocols
+#define ADD_PARAMS int proto
+#define ADD_VARIABLES proto
+#define BUFLEN 1024
- setprotoent(_proto_stayopen);
- while (p = getprotoent())
- if (p->p_proto == proto)
- break;
- if (!_proto_stayopen)
- endprotoent();
- return (p);
-}
+#include "../nss/getXXbyYY.c"
diff --git a/inet/getproto_r.c b/inet/getproto_r.c
new file mode 100644
index 0000000..c915280
--- /dev/null
+++ b/inet/getproto_r.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct protoent
+#define FUNCTION_NAME getprotobynumber
+#define DATABASE_NAME protocols
+#define ADD_PARAMS int proto
+#define ADD_VARIABLES proto
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/inet/getprtent.c b/inet/getprtent.c
index c10ae33..8b55a4d 100644
--- a/inet/getprtent.c
+++ b/inet/getprtent.c
@@ -1,119 +1,26 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getprotoent.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
+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.
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define MAXALIASES 35
+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.
-static FILE *protof = NULL;
-static char line[BUFSIZ+1];
-static struct protoent proto;
-static char *proto_aliases[MAXALIASES];
-int _proto_stayopen;
+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. */
-void
-setprotoent(f)
- int f;
-{
- if (protof == NULL)
- protof = fopen(_PATH_PROTOCOLS, "r" );
- else
- rewind(protof);
- _proto_stayopen |= f;
-}
+#include <netdb.h>
-void
-endprotoent()
-{
- if (protof) {
- fclose(protof);
- protof = NULL;
- }
- _proto_stayopen = 0;
-}
-struct protoent *
-getprotoent()
-{
- char *p;
- register char *cp, **q;
+#define LOOKUP_TYPE struct protoent
+#define GETFUNC_NAME getprotoent
+#define BUFLEN 1024
- if (protof == NULL && (protof = fopen(_PATH_PROTOCOLS, "r" )) == NULL)
- return (NULL);
-again:
- if ((p = fgets(line, BUFSIZ, protof)) == NULL)
- return (NULL);
- if (*p == '#')
- goto again;
- cp = strpbrk(p, "#\n");
- if (cp == NULL)
- goto again;
- *cp = '\0';
- proto.p_name = p;
- cp = strpbrk(p, " \t");
- if (cp == NULL)
- goto again;
- *cp++ = '\0';
- while (*cp == ' ' || *cp == '\t')
- cp++;
- p = strpbrk(cp, " \t");
- if (p != NULL)
- *p++ = '\0';
- proto.p_proto = atoi(cp);
- q = proto.p_aliases = proto_aliases;
- if (p != NULL) {
- cp = p;
- while (cp && *cp) {
- if (*cp == ' ' || *cp == '\t') {
- cp++;
- continue;
- }
- if (q < &proto_aliases[MAXALIASES - 1])
- *q++ = cp;
- cp = strpbrk(cp, " \t");
- if (cp != NULL)
- *cp++ = '\0';
- }
- }
- *q = NULL;
- return (&proto);
-}
+#include "../nss/getXXent.c"
diff --git a/inet/getprtent_r.c b/inet/getprtent_r.c
new file mode 100644
index 0000000..47a2f9e
--- /dev/null
+++ b/inet/getprtent_r.c
@@ -0,0 +1,30 @@
+/* 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. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct protoent
+#define SETFUNC_NAME setprotoent
+#define GETFUNC_NAME getprotoent
+#define ENDFUNC_NAME endprotoent
+#define DATABASE_NAME protocols
+#define STAYOPEN int stayopen
+#define STAYOPEN_VAR stayopen
+
+#include "../nss/getXXent_r.c"
diff --git a/inet/getprtname.c b/inet/getprtname.c
index 3ee6754..f291513 100644
--- a/inet/getprtname.c
+++ b/inet/getprtname.c
@@ -1,62 +1,30 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getprotoname.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
+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 <netdb.h>
-#include <string.h>
-extern int _proto_stayopen;
-struct protoent *
-getprotobyname(name)
- register const char *name;
-{
- register struct protoent *p;
- register char **cp;
+#define LOOKUP_TYPE struct protoent
+#define FUNCTION_NAME getprotobyname
+#define DATABASE_NAME protocols
+#define ADD_PARAMS const char *name
+#define ADD_VARIABLES name
+#define BUFLEN 1024
- setprotoent(_proto_stayopen);
- while (p = getprotoent()) {
- if (strcmp(p->p_name, name) == 0)
- break;
- for (cp = p->p_aliases; *cp != 0; cp++)
- if (strcmp(*cp, name) == 0)
- goto found;
- }
-found:
- if (!_proto_stayopen)
- endprotoent();
- return (p);
-}
+#include "../nss/getXXbyYY.c"
diff --git a/inet/getprtname_r.c b/inet/getprtname_r.c
new file mode 100644
index 0000000..8de7410
--- /dev/null
+++ b/inet/getprtname_r.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct protoent
+#define FUNCTION_NAME getprotobyname
+#define DATABASE_NAME protocols
+#define ADD_PARAMS const char *name
+#define ADD_VARIABLES name
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/inet/getrpcbyname.c b/inet/getrpcbyname.c
new file mode 100644
index 0000000..be14f71
--- /dev/null
+++ b/inet/getrpcbyname.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <rpc/netdb.h>
+
+
+#define LOOKUP_TYPE struct rpcent
+#define FUNCTION_NAME getrpcbyname
+#define DATABASE_NAME rpc
+#define ADD_PARAMS const char *name
+#define ADD_VARIABLES name
+#define BUFLEN 1024
+
+#include "../nss/getXXbyYY.c"
diff --git a/inet/getrpcbyname_r.c b/inet/getrpcbyname_r.c
new file mode 100644
index 0000000..c8b5eba
--- /dev/null
+++ b/inet/getrpcbyname_r.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <rpc/netdb.h>
+
+
+#define LOOKUP_TYPE struct rpcent
+#define FUNCTION_NAME getrpcbyname
+#define DATABASE_NAME rpc
+#define ADD_PARAMS const char *name
+#define ADD_VARIABLES name
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/inet/getrpcbynumber.c b/inet/getrpcbynumber.c
new file mode 100644
index 0000000..4b02156
--- /dev/null
+++ b/inet/getrpcbynumber.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <rpc/netdb.h>
+
+
+#define LOOKUP_TYPE struct rpcent
+#define FUNCTION_NAME getrpcbynumber
+#define DATABASE_NAME rpc
+#define ADD_PARAMS int number
+#define ADD_VARIABLES number
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/inet/getrpcbynumber_r.c b/inet/getrpcbynumber_r.c
new file mode 100644
index 0000000..4b02156
--- /dev/null
+++ b/inet/getrpcbynumber_r.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <rpc/netdb.h>
+
+
+#define LOOKUP_TYPE struct rpcent
+#define FUNCTION_NAME getrpcbynumber
+#define DATABASE_NAME rpc
+#define ADD_PARAMS int number
+#define ADD_VARIABLES number
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/inet/getrpcent.c b/inet/getrpcent.c
new file mode 100644
index 0000000..5b2274a
--- /dev/null
+++ b/inet/getrpcent.c
@@ -0,0 +1,26 @@
+/* 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. */
+
+#include <rpc/netdb.h>
+
+
+#define LOOKUP_TYPE struct rpcent
+#define GETFUNC_NAME rpcent
+#define BUFLEN 1024
+
+#include "../nss/getXXent.c"
diff --git a/inet/getrpcent_r.c b/inet/getrpcent_r.c
new file mode 100644
index 0000000..4c9639f
--- /dev/null
+++ b/inet/getrpcent_r.c
@@ -0,0 +1,26 @@
+/* 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. */
+
+#include <rpc/netdb.h>
+
+
+#define LOOKUP_TYPE struct rpcent
+#define GETFUNC_NAME rpcent
+#define BUFLEN 1024
+
+#include "../nss/getXXent_r.c"
diff --git a/inet/getservent.c b/inet/getservent.c
index 6bee5d3..bb51a68 100644
--- a/inet/getservent.c
+++ b/inet/getservent.c
@@ -1,121 +1,26 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
+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.
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define MAXALIASES 35
+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.
-static FILE *servf = NULL;
-static char line[BUFSIZ+1];
-static struct servent serv;
-static char *serv_aliases[MAXALIASES];
-int _serv_stayopen;
+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. */
-void
-setservent(f)
- int f;
-{
- if (servf == NULL)
- servf = fopen(_PATH_SERVICES, "r" );
- else
- rewind(servf);
- _serv_stayopen |= f;
-}
+#include <netdb.h>
-void
-endservent()
-{
- if (servf) {
- fclose(servf);
- servf = NULL;
- }
- _serv_stayopen = 0;
-}
-struct servent *
-getservent()
-{
- char *p;
- register char *cp, **q;
+#define LOOKUP_TYPE struct servent
+#define GETFUNC_NAME getservent
+#define BUFLEN 1024
- if (servf == NULL && (servf = fopen(_PATH_SERVICES, "r" )) == NULL)
- return (NULL);
-again:
- if ((p = fgets(line, BUFSIZ, servf)) == NULL)
- return (NULL);
- if (*p == '#')
- goto again;
- cp = strpbrk(p, "#\n");
- if (cp == NULL)
- goto again;
- *cp = '\0';
- serv.s_name = p;
- p = strpbrk(p, " \t");
- if (p == NULL)
- goto again;
- *p++ = '\0';
- while (*p == ' ' || *p == '\t')
- p++;
- cp = strpbrk(p, ",/");
- if (cp == NULL)
- goto again;
- *cp++ = '\0';
- serv.s_port = htons((u_short)atoi(p));
- serv.s_proto = cp;
- q = serv.s_aliases = serv_aliases;
- cp = strpbrk(cp, " \t");
- if (cp != NULL)
- *cp++ = '\0';
- while (cp && *cp) {
- if (*cp == ' ' || *cp == '\t') {
- cp++;
- continue;
- }
- if (q < &serv_aliases[MAXALIASES - 1])
- *q++ = cp;
- cp = strpbrk(cp, " \t");
- if (cp != NULL)
- *cp++ = '\0';
- }
- *q = NULL;
- return (&serv);
-}
+#include "../nss/getXXent.c"
diff --git a/inet/getservent_r.c b/inet/getservent_r.c
new file mode 100644
index 0000000..676e3c9
--- /dev/null
+++ b/inet/getservent_r.c
@@ -0,0 +1,30 @@
+/* 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. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct servent
+#define SETFUNC_NAME setservent
+#define GETFUNC_NAME getservent
+#define ENDFUNC_NAME endservent
+#define DATABASE_NAME services
+#define STAYOPEN int stayopen
+#define STAYOPEN_VAR stayopen
+
+#include "../nss/getXXent_r.c"
diff --git a/inet/getsrvbynm.c b/inet/getsrvbynm.c
index 77bf813..863d292 100644
--- a/inet/getsrvbynm.c
+++ b/inet/getsrvbynm.c
@@ -1,65 +1,30 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getservbyname.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
+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 <netdb.h>
-#include <string.h>
-extern int _serv_stayopen;
-struct servent *
-getservbyname(name, proto)
- const char *name, *proto;
-{
- register struct servent *p;
- register char **cp;
+#define LOOKUP_TYPE struct servent
+#define FUNCTION_NAME getservbyname
+#define DATABASE_NAME services
+#define ADD_PARAMS const char *name, const char *proto
+#define ADD_VARIABLES name, proto
+#define BUFLEN 1024
- setservent(_serv_stayopen);
- while (p = getservent()) {
- if (strcmp(name, p->s_name) == 0)
- goto gotname;
- for (cp = p->s_aliases; *cp; cp++)
- if (strcmp(name, *cp) == 0)
- goto gotname;
- continue;
-gotname:
- if (proto == 0 || strcmp(p->s_proto, proto) == 0)
- break;
- }
- if (!_serv_stayopen)
- endservent();
- return (p);
-}
+#include "../nss/getXXbyYY.c"
diff --git a/inet/getsrvbynm_r.c b/inet/getsrvbynm_r.c
new file mode 100644
index 0000000..352c646
--- /dev/null
+++ b/inet/getsrvbynm_r.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct servent
+#define FUNCTION_NAME getservbyname
+#define DATABASE_NAME services
+#define ADD_PARAMS const char *name, const char *proto
+#define ADD_VARIABLES name, proto
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/inet/getsrvbypt.c b/inet/getsrvbypt.c
index 0acb31b..c7f3508 100644
--- a/inet/getsrvbypt.c
+++ b/inet/getsrvbypt.c
@@ -1,60 +1,30 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getservbyport.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
+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 <netdb.h>
-#include <string.h>
-extern int _serv_stayopen;
-struct servent *
-getservbyport(port, proto)
- int port;
- const char *proto;
-{
- register struct servent *p;
+#define LOOKUP_TYPE struct servent
+#define FUNCTION_NAME getservbyport
+#define DATABASE_NAME services
+#define ADD_PARAMS int port, const char *proto
+#define ADD_VARIABLES port, proto
+#define BUFLEN 1024
- setservent(_serv_stayopen);
- while (p = getservent()) {
- if (p->s_port != port)
- continue;
- if (proto == 0 || strcmp(p->s_proto, proto) == 0)
- break;
- }
- if (!_serv_stayopen)
- endservent();
- return (p);
-}
+#include "../nss/getXXbyYY.c"
diff --git a/inet/getsrvbypt_r.c b/inet/getsrvbypt_r.c
new file mode 100644
index 0000000..58851ef
--- /dev/null
+++ b/inet/getsrvbypt_r.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <netdb.h>
+
+
+#define LOOKUP_TYPE struct servent
+#define FUNCTION_NAME getservbyport
+#define DATABASE_NAME services
+#define ADD_PARAMS int port, const char *proto
+#define ADD_VARIABLES port, proto
+
+#include "../nss/getXXbyYY_r.c"
diff --git a/inet/herrno.c b/inet/herrno.c
new file mode 100644
index 0000000..7e413ad
--- /dev/null
+++ b/inet/herrno.c
@@ -0,0 +1,22 @@
+/* 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. */
+
+/* We need to have the error status variable of the resolver
+ accessible in the libc. */
+int h_errno;
+