Lines Matching refs:hed
68 _sethosthtent(int f, struct hostent_data *hed) in _sethosthtent() argument
70 if (!hed->hostf) in _sethosthtent()
71 hed->hostf = fopen(_PATH_HOSTS, "re"); in _sethosthtent()
73 rewind(hed->hostf); in _sethosthtent()
74 hed->stayopen = f; in _sethosthtent()
78 _endhosthtent(struct hostent_data *hed) in _endhosthtent() argument
80 if (hed->hostf && !hed->stayopen) { in _endhosthtent()
81 (void) fclose(hed->hostf); in _endhosthtent()
82 hed->hostf = NULL; in _endhosthtent()
87 gethostent_p(struct hostent *he, struct hostent_data *hed, int mapped, in gethostent_p() argument
95 if (!hed->hostf && !(hed->hostf = fopen(_PATH_HOSTS, "re"))) { in gethostent_p()
100 if (!(p = fgets(hostbuf, sizeof hostbuf, hed->hostf))) { in gethostent_p()
112 if (inet_pton(AF_INET6, p, hed->host_addr) > 0) { in gethostent_p()
115 } else if (inet_pton(AF_INET, p, hed->host_addr) > 0) { in gethostent_p()
117 _map_v4v6_address((char *)hed->host_addr, in gethostent_p()
118 (char *)hed->host_addr); in gethostent_p()
128 hed->h_addr_ptrs[0] = (char *)hed->host_addr; in gethostent_p()
129 hed->h_addr_ptrs[1] = NULL; in gethostent_p()
130 he->h_addr_list = hed->h_addr_ptrs; in gethostent_p()
135 bp = hed->hostbuf; in gethostent_p()
136 ep = hed->hostbuf + sizeof hed->hostbuf; in gethostent_p()
138 q = he->h_aliases = hed->host_aliases; in gethostent_p()
154 if (q >= &hed->host_aliases[_MAXALIASES - 1]) in gethostent_p()
175 struct hostent_data *hed; in gethostent_r() local
185 if ((hed = __hostent_data_init()) == NULL) { in gethostent_r()
190 if (gethostent_p(&he, hed, statp->options & RES_USE_INET6, statp) != 0) in gethostent_r()
225 struct hostent_data *hed; in _ht_gethostbyname() local
241 if ((hed = __hostent_data_init()) == NULL) { in _ht_gethostbyname()
247 _sethosthtent(0, hed); in _ht_gethostbyname()
248 while ((error = gethostent_p(&he, hed, 0, statp)) == 0) { in _ht_gethostbyname()
264 _endhosthtent(hed); in _ht_gethostbyname()
290 struct hostent_data *hed; in _ht_gethostbyaddr() local
306 if ((hed = __hostent_data_init()) == NULL) { in _ht_gethostbyaddr()
312 _sethosthtent(0, hed); in _ht_gethostbyaddr()
313 while ((error = gethostent_p(&he, hed, 0, statp)) == 0) in _ht_gethostbyaddr()
323 _endhosthtent(hed); in _ht_gethostbyaddr()