Closes the /etc/services file.
Standard C Library (libc.a)
#include <netdb.h>
void endservent ( )
The endservent subroutine closes the /etc/services file. A call made to the getservent subroutine, getservbyname subroutine, or getservbyport subroutine opens the /etc/services file. An application program can use the endservent subroutine to close the /etc/services file.
All applications containing the endservent 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.
If a previous setservent subroutine has been performed and the StayOpen parameter does not equal 0, then the endservent subroutine will not close the /etc/services file. Also, the setservent subroutine does not indicate that it closed the file. A second setservent subroutine has to be issued with the StayOpen parameter equal to 0 in order for a following endservent subroutine to succeed. If this is not done, the /etc/services file closes on an exit subroutine.
To close the /etc/services file, type:
endservent ();
Item | Description |
---|---|
/etc/services | Contains service names. |