From a5fdf99b7c4d23acbc3d3f77f6c4d4456ff6006f Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 21 Jan 2001 21:23:21 +0000 Subject: Update. 2000-12-09 H.J. Lu * nss/Makefile (routines): Add digits_dots. * nss/Versions (libc): Add __nss_hostname_digits_dots to GLIBC_2.2.2. * nss/digits_dots.c (__nss_hostname_digits_dots): Turn template into a function. * nss/nsswitch.h (__nss_hostname_digits_dots): New internal NSS function. * nss/getXXbyYY.c (H_ERRNO_VAR_P): New definition. (TYPE_VAR_P): Likewise. (FLAGS_VAR): Likewise. (AF_VAR_P): Likewise. (INTERNAL (REENTRANT_NAME)): Call __nss_hostname_digits_dots () instead of including digits_dots.c. * nss/getXXbyYY_r.c (H_ERRNO_VAR_P): New definition. (TYPE_VAR_P): Likewise. (FLAGS_VAR): Likewise. (AF_VAR_P): Likewise. (INTERNAL (REENTRANT_NAME)): Call __nss_hostname_digits_dots () instead of including digits_dots.c. --- nss/getXXbyYY_r.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'nss/getXXbyYY_r.c') diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c index b988711..71fc0c2 100644 --- a/nss/getXXbyYY_r.c +++ b/nss/getXXbyYY_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996,97,98,99,2000 Free Software Foundation, Inc. +/* Copyright (C) 1996,97,98,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -87,11 +87,23 @@ #ifdef NEED_H_ERRNO # define H_ERRNO_PARM , int *h_errnop # define H_ERRNO_VAR , h_errnop +# define H_ERRNO_VAR_P h_errnop #else # define H_ERRNO_PARM # define H_ERRNO_VAR +# define H_ERRNO_VAR_P NULL #endif +#ifndef HAVE_TYPE +# define TYPE_VAR_P NULL +# define FLAGS_VAR 0 +#endif + +#ifdef HAVE_AF +# define AF_VAR_P &af +#else +# define AF_VAR_P NULL +#endif /* Type of the lookup function we need here. */ typedef enum nss_status (*lookup_function) (ADD_PARAMS, LOOKUP_TYPE *, char *, @@ -123,19 +135,16 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer, #endif #ifdef HANDLE_DIGITS_DOTS - /* We have to test for the use of IPv6 which can only be done by - examining `_res'. */ - if ((_res.options & RES_INIT) == 0 && __res_ninit (&_res) == -1) + switch (__nss_hostname_digits_dots (name, resbuf, &buffer, NULL, + buflen, result, &status, + TYPE_VAR_P, FLAGS_VAR, AF_VAR_P, + H_ERRNO_VAR_P)) { - *h_errnop = NETDB_INTERNAL; - *result = NULL; + case -1: return errno; + case 1: + goto done; } -# define resbuf (*resbuf) -# define result *result -# include "digits_dots.c" -# undef resbuf -# undef result #endif #ifdef USE_NSCD -- cgit v1.1