[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2

getservent_r Subroutine

Purpose

Gets services file entry.

Library

Standard C Library (libc.a)

Syntax

#include <netdb.h>
int getservent_r(servent, serv_data)
struct servent *servent;
struct servent_data *serv_data;

Description

The getservent_r subroutine opens and reads the next line of the /etc/services file.An application program can use the getservent_r subroutine to retrieve information about network services and the protocol ports they use.

The /etc/services file remains open after a call by the getservent_r subroutine. To close the /etc/services file after each call, use the setservent_r subroutine. Otherwise, use the endservent_r subroutine to close the /etc/services file.

Parameters

servent Points to the servent structure.
serv_data Points to the serv_data structure.

Return Values

The getservent_r fails when a successful match occurs. Thegetservent subroutine overwrites static data returned on subsequent calls. The getservent_r subroutine does not.

Files

/etc/services Contains service names.

Related Information

endservent_r Subroutine, setservent_r Subroutine, getservbyport_r Subroutine, and getservbyname_r Subroutine.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]