OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [common/] [v2_0/] [doc/] [manpages/] [net/] [getservent.3] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
.\"     $OpenBSD: getservent.3,v 1.11 2000/12/24 00:30:56 aaron Exp $
2
.\"
3
.\" Copyright (c) 1983, 1991, 1993
4
.\"     The Regents of the University of California.  All rights reserved.
5
.\"
6
.\" Redistribution and use in source and binary forms, with or without
7
.\" modification, are permitted provided that the following conditions
8
.\" are met:
9
.\" 1. Redistributions of source code must retain the above copyright
10
.\"    notice, this list of conditions and the following disclaimer.
11
.\" 2. Redistributions in binary form must reproduce the above copyright
12
.\"    notice, this list of conditions and the following disclaimer in the
13
.\"    documentation and/or other materials provided with the distribution.
14
.\" 3. All advertising materials mentioning features or use of this software
15
.\"    must display the following acknowledgement:
16
.\"     This product includes software developed by the University of
17
.\"     California, Berkeley and its contributors.
18
.\" 4. Neither the name of the University nor the names of its contributors
19
.\"    may be used to endorse or promote products derived from this software
20
.\"    without specific prior written permission.
21
.\"
22
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32
.\" SUCH DAMAGE.
33
.\"
34
.Dd January 12, 1994
35
.Dt GETSERVENT 3
36
.Os
37
.Sh NAME
38
.Nm getservent ,
39
.Nm getservbyport ,
40
.Nm getservbyname ,
41
.Nm setservent ,
42
.Nm endservent
43
.Nd get service entry
44
.Sh SYNOPSIS
45
.Fd #include 
46
.Ft struct servent *
47
.Fn getservent "void"
48
.Ft struct servent *
49
.Fn getservbyname "char *name" "char *proto"
50
.Ft struct servent *
51
.Fn getservbyport "int port" "char *proto"
52
.Ft void
53
.Fn setservent "int stayopen"
54
.Ft void
55
.Fn endservent "void"
56
.Sh DESCRIPTION
57
The
58
.Fn getservent ,
59
.Fn getservbyname ,
60
and
61
.Fn getservbyport
62
functions each return a pointer to an object with the following structure
63
containing the broken-out fields of a line in the network services database,
64
.Pa /etc/services .
65
.Bd -literal -offset indent
66
struct  servent {
67
        char    *s_name;        /* official name of service */
68
        char    **s_aliases;    /* alias list */
69
        int     s_port;         /* port service resides at */
70
        char    *s_proto;       /* protocol to use */
71
};
72
.Ed
73
.Pp
74
The members of this structure are:
75
.Bl -tag -width s_aliases
76
.It Fa s_name
77
The official name of the service.
78
.It Fa s_aliases
79
A zero-terminated list of alternate names for the service.
80
.It Fa s_port
81
The port number at which the service resides.
82
Port numbers are returned in network byte order.
83
.It Fa s_proto
84
The name of the protocol to use when contacting the service.
85
.El
86
.Pp
87
The
88
.Fn getservent
89
function reads the next line of the file, opening the file if necessary.
90
.Pp
91
The
92
.Fn setservent
93
function opens and rewinds the file.
94
If the
95
.Fa stayopen
96
flag is non-zero,
97
the net database will not be closed after each call to
98
.Fn getservbyname
99
or
100
.Fn getservbyport .
101
.Pp
102
The
103
.Fn endservent
104
function closes the file.
105
.Pp
106
The
107
.Fn getservbyname
108
and
109
.Fn getservbyport
110
functions sequentially search from the beginning of the file until a
111
matching protocol name or port number (specified in network byte order)
112
is found, or until
113
.Dv EOF
114
is encountered.
115
If a protocol name is also supplied (non-null),
116
searches must also match the protocol.
117
.Sh FILES
118
.Bl -tag -width /etc/services -compact
119
.It Pa /etc/services
120
.El
121
.Sh DIAGNOSTICS
122
Null pointer (0) returned on
123
.Dv EOF
124
or error.
125
.Sh SEE ALSO
126
.Xr getprotoent 3 ,
127
.Xr services 5
128
.Sh HISTORY
129
The
130
.Fn getservent ,
131
.Fn getservbyport ,
132
.Fn getservbyname ,
133
.Fn setservent ,
134
and
135
.Fn endservent
136
functions appeared in
137
.Bx 4.2 .
138
.Sh BUGS
139
These functions use static data storage; if the data is needed for future use,
140
it should be copied before any subsequent calls overwrite it.
141
Expecting port numbers to fit in a 32-bit quantity is probably naive.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.