Penguin
Blame: getservent(3)
EditPageHistoryDiffInfoLikePages
Annotated edit history of getservent(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 GETSERVENT
2 !!!GETSERVENT
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 FILES
8 CONFORMING TO
9 SEE ALSO
10 ----
11 !!NAME
12
13
14 getservent, getservbyname, getservbyport, setservent, endservent - get service entry
15 !!SYNOPSIS
16
17
18 __#include
19 __''name''__, const char *__''proto''__);
20 struct servent *getservbyport(int__ ''port''__, const char *__''proto''__);
21 void setservent(int__ ''stayopen''__);
22 void endservent(void);
23 __
24 !!DESCRIPTION
25
26
27 The __getservent()__ function reads the next line from
28 the file ''/etc/services'' and returns a structure
29 ''servent'' containing the broken out fields from the
30 line. The ''/etc/services'' file is opened if
31 necessary.
32
33
34 The __getservbyname()__ function returns a ''servent''
35 structure for the line from ''/etc/services'' that
36 matches the service ''name'' using protocol ''proto''.
37 If ''proto'' is NULL, any protocol will be
38 matched.
39
40
41 The __getservbyport()__ function returns a ''servent''
42 structure for the line that matches the port ''port''
43 given in network byte order using protocol ''proto''. If
44 ''proto'' is NULL, any protocol will be
45 matched.
46
47
48 The __setservent()__ function opens and rewinds the
49 ''/etc/services'' file. If ''stayopen'' is true (1),
50 then the file will not be closed between calls to
51 __getservbyname()__ and
52 __getservbyport()__.
53
54
55 The __endservent()__ function closes
56 ''/etc/services''.
57
58
59 The ''servent'' structure is defined in
60 '''' as follows:
61
62
63 struct servent {
64 char *s_name; /* official service name */
65 char **s_aliases; /* alias list */
66 int s_port; /* port number */
67 char *s_proto; /* protocol to use */
68 }
69
70
71 The members of the ''servent'' structure
72 are:
73
74
75 ''s_name''
76
77
78 The official name of the service.
79
80
81 ''s_aliases''
82
83
84 A zero terminated list of alternative names for the
85 service.
86
87
88 ''s_port''
89
90
91 The port number for the service given in network byte
92 order.
93
94
95 ''s_proto''
96
97
98 The name of the protocol to use with this
99 service.
100 !!RETURN VALUE
101
102
103 The __getservent()__, __getservbyname()__ and
104 __getservbyport()__ functions return the ''servent''
105 structure, or a NULL pointer if an error occurs or the end
106 of the file is reached.
107 !!FILES
108
109
110 ''/etc/services''
111
112
113 services database file
114 !!CONFORMING TO
115
116
117 BSD 4.3
118 !!SEE ALSO
119
120
121 getprotoent(3), getnetent(3),
122 services(5)
123 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.