if (hints->ai_flags & ~(AI_PASSIVE|AI_CANANONNAME|AI_NUMERICHOST))
if (hints->ai_flags & ~(AI_PASSIVE|AI_CANONNAME|AI_NUMERICHOST))
getaddrinfo (const char *name, const char *service,	     const struct addrinfo *hints, struct addrinfo **pai){  int i = 0, j = 0;  struct addrinfo *p = NULL, **end;  struct gaih *g = gaih, *pg = NULL;  struct gaih_service gaih_service, *pservice;  if (name != NULL && name[0] == '*' && name[1] == 0)    name = NULL;  if (service != NULL && service[0] == '*' && service[1] == 0)    service = NULL;  if (name == NULL && service == NULL)    return EAI_NONAME;  if (hints == NULL)    hints = &default_hints;  if (hints->ai_flags & ~(AI_PASSIVE|AI_CANANONNAME|AI_NUMERICHOST))    return EAI_BADFLAGS;  if ((hints->ai_flags & AI_CANONNAME) && name == NULL)    return EAI_BADFLAGS;  if (service && service[0])    {      char *c;      gaih_service.name = service;      gaih_service.num = strtoul (gaih_service.name, &c, 10);      if (*c)	gaih_service.num = -1;      else	/* Can't specify a numerical socket unless a protocol family was	   given. */        if (hints->ai_socktype == 0)          return EAI_SERVICE;      pservice = &gaih_service;    }  else    pservice = NULL;  if (pai)    end = &p;  else    end = NULL;  while (g->gaih)    {      if ((hints->ai_family == g->family) || (hints->ai_family == AF_UNSPEC))	{	  j++;	  if ((pg == NULL) || (pg->gaih != g->gaih))	    {	      pg = g;	      if ((i = g->gaih (name, pservice, hints, end)))		{		  if ((hints->ai_family == AF_UNSPEC) && (i & GAIH_OKIFUNSPEC))		    continue;		  if (p)		    freeaddrinfo (p);		  return (i)?-(i & GAIH_EAI):EAI_NONAME;		}	      if (end)		while(*end) end = &((*end)->ai_next);	    }	}      ++g;    }  if (j == 0)    return EAI_FAMILY;  if (p)    {      *pai = p;      return 0;    }  if (pai == NULL && i == 0)    return 0;  if (p)    freeaddrinfo (p);  return i ? -(i & GAIH_EAI) : EAI_NONAME;}