/* gethostent.c 4.5 83/01/02 */
static char HOSTDB
[] = "/etc/hosts";
static FILE *hostf
= NULL
;
static char line
[BUFSIZ
+1];
static char hostaddr
[MAXADDRSIZE
];
static struct hostent host
;
static char *host_aliases
[MAXALIASES
];
hostf
= fopen(HOSTDB
, "r" );
if (hostf
&& !stayopen
) {
if (hostf
== NULL
&& (hostf
= fopen(HOSTDB
, "r" )) == NULL
)
if ((p
= fgets(line
, BUFSIZ
, hostf
)) == NULL
)
/* THIS STUFF IS INTERNET SPECIFIC */
*((u_long
*)host
.h_addr
) = inet_addr(p
);
host
.h_length
= sizeof (u_long
);
host
.h_addrtype
= AF_INET
;
while (*cp
== ' ' || *cp
== '\t')
q
= host
.h_aliases
= host_aliases
;
if (*cp
== ' ' || *cp
== '\t') {
if (q
< &host_aliases
[MAXALIASES
- 1])
for (mp
= match
; *mp
; mp
++)