0 if the call is successful. -1if a failure occurs.
A zero value closes the /etc/hosts file after each call to the file by one of the following calls: gethostbyaddr(), gethostbyname(), and gethostent().

sethostent()

Opens and rewinds the /etc/hosts file. result = sethostent (stayopen) int result, stayopen;

result

stayopen

A nonzero value leaves the /etc/services file open after a gethostbyaddr(), gethostbyname(), or gethostent() call. This allows the next gethostent() to read from the next line of the /etc/hosts file rather than from the beginning of the file.

setnetent()

Opens and rewinds the /etc/networks file.

result = setnetent (stayopen) int result, stayopen;

result

0 if the call is successful.

 

-1if a failure occurs.

stayopen

A zero value closes the /etc/networks file after each call to

 

the file by one of the following calls: getnetbyaddr(),

 

getnetbyname(), and getnetent().

 

A nonzero value leaves the /etc/services file open after a

 

getnetbyaddr(), getnetbyname(), or getnetent()

 

call. This allows the next getnetent() to read from the next

 

line of the /etc/networks file rather than from the

 

beginning of the file.

setprotoent()

Opens and rewinds the /etc/protocols file. result = setprotoent (stayopen) int result, stayopen;

result

0 if the call is successful.

 

-1if a failure occurs.

stayopen

A zero value closes the /etc/protocols file after each call

 

to the file by one of the following calls: getprotobyname(),

 

getprotobynumber(), and getprotoent().

 

A nonzero value leaves the /etc/protocols file open after

 

a getprotobyname(), getprotobynumber(), or

 

getprotoent() call. This allows the next getprotoent()

 

to read from the next line of the /etc/protocols file rather

 

than from the beginning of the file.

432 Berkeley Software Distribution Interprocess Communication