endprotoent Subroutine

Purpose

Closes the /etc/protocols file.

Library

Standard C Library (libc.a)

Syntax

void endprotoent (void)

Description

The endprotoent subroutine closes the /etc/protocols file.

Calls made to the getprotoent subroutine, getprotobyname subroutine, or getprotobynumber subroutine open the /etc/protocols file. An application program can use the endprotoent subroutine to close the /etc/protocols file.

All applications containing the endprotoent subroutine must be compiled with the _BSD macro set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.

Return Values

If a previous setprotoent subroutine has been performed and the StayOpen parameter does not equal 0, the endprotoent subroutine will not close the /etc/protocols file. Also, the setprotoent subroutine does not indicate that it closed the file. A second setprotoent subroutine has to be issued with the StayOpen parameter equal to 0 in order for a following endprotoent subroutine to succeed. If this is not done, the /etc/protocols file closes on an exit subroutine.

Examples

To close the /etc/protocols file, type:

endprotoent();

Files

Item Description
/etc/protocols Contains protocol names.