1 .\" Copyright (c) 1983 Regents of the University of California.
2 .\" All rights reserved. The Berkeley software License Agreement
3 .\" specifies the terms and conditions for redistribution.
5 .\" @(#)getservent.3n 6.3 (Berkeley) 5/19/86
7 .TH GETSERVENT 3 "May 19, 1986"
10 getservent, getservbyport, getservbyname, setservent, endservent \- get service entry
17 struct servent *getservent()
20 struct servent *getservbyname(name, proto)
24 struct servent *getservbyport(port, proto)
25 int port; char *proto;
39 each return a pointer to an object with the
41 containing the broken-out
42 fields of a line in the network services data base,
48 char *s_name; /* official name of service */
49 char **s_aliases; /* alias list */
50 int s_port; /* port service resides at */
51 char *s_proto; /* protocol to use */
58 The members of this structure are:
61 The official name of the service.
64 A zero terminated list of alternate names for the service.
67 The port number at which the service resides.
68 Port numbers are returned in network byte order.
71 The name of the protocol to use when contacting the
75 reads the next line of the file, opening the file if necessary.
78 opens and rewinds the file. If the
81 the net data base will not be closed after each call to
92 sequentially search from the beginning
93 of the file until a matching
96 or until EOF is encountered.
97 If a protocol name is also supplied (non-NULL),
98 searches must also match the protocol.
102 getprotoent(3), services(5)
105 (0) returned on EOF or error.
108 is contained in a static area
109 so it must be copied if it is
110 to be saved. Expecting port
111 numbers to fit in a 32 bit
112 quantity is probably naive.