source: trunk/minix/man/man3/getservent.3@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 2.3 KB
Line 
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.
4.\"
5.\" @(#)getservent.3n 6.3 (Berkeley) 5/19/86
6.\"
7.TH GETSERVENT 3 "May 19, 1986"
8.UC 5
9.SH NAME
10getservent, getservbyport, getservbyname, setservent, endservent \- get service entry
11.SH SYNOPSIS
12.nf
13.ft B
14#include <netdb.h>
15.PP
16.ft B
17struct servent *getservent()
18.PP
19.ft B
20struct servent *getservbyname(name, proto)
21char *name, *proto;
22.PP
23.ft B
24struct servent *getservbyport(port, proto)
25int port; char *proto;
26.PP
27.ft B
28setservent(stayopen)
29int stayopen
30.PP
31.ft B
32endservent()
33.fi
34.SH DESCRIPTION
35.IR Getservent ,
36.IR getservbyname ,
37and
38.I getservbyport
39each return a pointer to an object with the
40following structure
41containing the broken-out
42fields of a line in the network services data base,
43.IR /etc/services .
44.RS
45.PP
46.nf
47struct servent {
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 */
52};
53.ft R
54.ad
55.fi
56.RE
57.PP
58The members of this structure are:
59.TP \w's_aliases'u+2n
60s_name
61The official name of the service.
62.TP \w's_aliases'u+2n
63s_aliases
64A zero terminated list of alternate names for the service.
65.TP \w's_aliases'u+2n
66s_port
67The port number at which the service resides.
68Port numbers are returned in network byte order.
69.TP \w's_aliases'u+2n
70s_proto
71The name of the protocol to use when contacting the
72service.
73.PP
74.I Getservent
75reads the next line of the file, opening the file if necessary.
76.PP
77.I Setservent
78opens and rewinds the file. If the
79.I stayopen
80flag is non-zero,
81the net data base will not be closed after each call to
82.I getservbyname
83or
84.IR getservbyport .
85.PP
86.I Endservent
87closes the file.
88.PP
89.I Getservbyname
90and
91.I getservbyport
92sequentially search from the beginning
93of the file until a matching
94protocol name or
95port number is found,
96or until EOF is encountered.
97If a protocol name is also supplied (non-NULL),
98searches must also match the protocol.
99.SH FILES
100/etc/services
101.SH "SEE ALSO"
102getprotoent(3), services(5)
103.SH DIAGNOSTICS
104Null pointer
105(0) returned on EOF or error.
106.SH BUGS
107All information
108is contained in a static area
109so it must be copied if it is
110to be saved. Expecting port
111numbers to fit in a 32 bit
112quantity is probably naive.
Note: See TracBrowser for help on using the repository browser.