Cross Reference: gethost.c
xref
: /
illumos-gate
/
usr
/
src
/
cmd
/
ipf
/
lib
/
common
/
gethost.c
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
gethost.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
include
"
ipf.h
"
int
gethost
(
name
,
hostp
)
char
*
name
;
u_32_t
*
hostp
;
{
struct
hostent
*h;
u_32_t
addr
;
if
(!
strcmp
(
name
,
"<thishost>"
))
name
=
thishost
;
h =
gethostbyname
(
name
);
if
(h !=
NULL
) {
if
((h->
h_addr
!=
NULL
) && (h->
h_length
==
sizeof
(
addr
))) {
bcopy
(h->
h_addr
, (
char
*)&
addr
,
sizeof
(
addr
));
*
hostp
=
addr
;
return
0;
}
}
return
-
1
;
}