OSDN Git Service

7ae2050db720bc9585a513bd7d2c21bef45b720a
[linuxjm/LDP_man-pages.git] / draft / man3 / getservent.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified Sat Jul 24 19:19:11 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified Wed Oct 18 20:23:54 1995 by Martin Schulze <joey@infodrom.north.de>
29 .\" Modified Mon Apr 22 01:50:54 1996 by Martin Schulze <joey@infodrom.north.de>
30 .\" 2001-07-25 added a clause about NULL proto (Martin Michlmayr or David N. Welton)
31 .\"
32 .\" Japanese Version Copyright (c) 1998 NAKANO Takeo all rights reserved.
33 .\" Translated Fri Mar 15 1998 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
34 .\" Updated Thu 16 Aug 2001 by NAKANO Takeo
35 .\" Updated 2008-09-19, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
36 .\"
37 .TH GETSERVENT 3  2008-08-19 "GNU" "Linux Programmer's Manual"
38 .\"O .SH NAME
39 .\"O getservent, getservbyname, getservbyport, setservent, endservent \-
40 .\"O get service entry
41 .SH 名前
42 getservent, getservbyname, getservbyport, setservent, endservent \- サービスのエントリを取得する
43 .\"O .SH SYNOPSIS
44 .SH 書式
45 .nf
46 .B #include <netdb.h>
47 .sp
48 .B struct servent *getservent(void);
49 .sp
50 .BI "struct servent *getservbyname(const char *" name ", const char *" proto );
51 .sp
52 .BI "struct servent *getservbyport(int " port ", const char *" proto );
53 .sp
54 .BI "void setservent(int " stayopen );
55 .sp
56 .B void endservent(void);
57 .fi
58 .\"O .SH DESCRIPTION
59 .SH 説明
60 .\"O The
61 .\"O .BR getservent ()
62 .\"O function reads the next entry from the services database (see
63 .\"O .BR services (5))
64 .\"O and returns a \fIservent\fP structure containing
65 .\"O the broken-out fields from the entry.
66 .\"O A connection is opened to the database if necessary.
67 .BR getservent ()
68 関数はサービスのデータベース
69 .RB ( services (5)
70 参照) から次のエントリを読み込み、
71 そのエントリを \fIservent\fP 構造体の要素別のフィールドに格納し、
72 その構造体を返す。
73 必要であれば、データベースへの接続がオープンされる。
74 .PP
75 .\"O The
76 .\"O .BR getservbyname ()
77 .\"O function returns a \fIservent\fP structure
78 .\"O for the entry from the database
79 .\"O that matches the service \fIname\fP using protocol \fIproto\fP.
80 .\"O If \fIproto\fP is NULL, any protocol will be matched.
81 .\"O A connection is opened to the database if necessary.
82 .BR getservbyname ()
83 関数は、
84 プロトコル \fIproto\fP を用いるサービスの名前 \fIname\fP
85 にマッチするエントリをデータベースから探し、
86 そのエントリを収めた \fIservent\fP 構造体を返す。
87 \fIproto\fP が NULL の場合は、任意のプロトコルにマッチする。
88 必要であれば、データベースへの接続がオープンされる。
89 .PP
90 .\"O The
91 .\"O .BR getservbyport ()
92 .\"O function returns a \fIservent\fP structure
93 .\"O for the entry from the database
94 .\"O that matches the port \fIport\fP (given in network byte order)
95 .\"O using protocol \fIproto\fP.
96 .\"O If \fIproto\fP is NULL, any protocol will be matched.
97 .\"O A connection is opened to the database if necessary.
98 .BR getservbyport ()
99 関数は、
100 プロトコル \fIproto\fP を用いるサービスのポート番号 \fIport\fP
101 にマッチするエントリをデータベースから探し、
102 そのエントリの内容を収めた \fIservent\fP 構造体を返す
103 (ポート番号 \fIport\fP はネットワーク・バイトオーダで指定する)。
104 \fIproto\fP が NULL の場合は任意のプロトコルにマッチする。
105 必要であれば、データベースへの接続がオープンされる。
106 .PP
107 .\"O The
108 .\"O .BR setservent ()
109 .\"O function opens a connection to the database,
110 .\"O and sets the next entry to the first entry.
111 .\"O If \fIstayopen\fP is nonzero,
112 .\"O then the connection to the database
113 .\"O will not be closed between calls to one of the
114 .\"O .BR getserv* ()
115 .\"O functions.
116 .BR setservent ()
117 関数はデータベースへの接続をオープンし、
118 次の読み込みエントリを先頭のエントリに設定する。
119 \fIstayopen\fP が 0 でない場合、
120 一つ一つの
121 .BR getserv* ()
122 関数の呼び出し間でデータベースへの接続をクローズしない。
123 .PP
124 .\"O The
125 .\"O .BR endservent ()
126 .\"O function closes the connection to the database.
127 .BR endservent ()
128 関数はデータベースへの接続をクローズする。
129 .PP
130 .\"O The \fIservent\fP structure is defined in \fI<netdb.h>\fP as follows:
131 \fIservent\fP 構造体は \fI<netdb.h>\fP で以下のように定義されている。
132 .sp
133 .in +4n
134 .nf
135 struct servent {
136     char  *s_name;       /* official service name */
137     char **s_aliases;    /* alias list */
138     int    s_port;       /* port number */
139     char  *s_proto;      /* protocol to use */
140 }
141 .fi
142 .in
143 .PP
144 .\"O The members of the \fIservent\fP structure are:
145 \fIservent\fP 構造体のメンバーは以下の通り。
146 .RS
147 .TP 12
148 .I s_name
149 .\"O The official name of the service.
150 サービスの正式名 (official name)。
151 .TP
152 .I s_aliases
153 .\"O A NULL-terminated list of alternative names for the service.
154 サービスの別名のリスト。
155 リストは NULL で終端される。
156 .TP
157 .I s_port
158 .\"O The port number for the service given in network byte order.
159 サービスのポート番号。ネットワークバイトオーダで指定される。
160 .TP
161 .I s_proto
162 .\"O The name of the protocol to use with this service.
163 このサービスと共に用いるプロトコルの名前。
164 .RE
165 .\"O .SH "RETURN VALUE"
166 .SH 返り値
167 .\"O The
168 .\"O .BR getservent (),
169 .\"O .BR getservbyname ()
170 .\"O and
171 .\"O .BR getservbyport ()
172 .\"O functions return a pointer to a
173 .\"O statically allocated \fIservent\fP structure, or a NULL pointer if an
174 .\"O error occurs or the end of the file is reached.
175 .BR getservent (),
176 .BR getservbyname (),
177 .BR getservbyport ()
178 関数は、
179 静的に割り当てられた \fIservent\fP 構造体へのポインタを返す。
180 エラーが起こったり、ファイルの末尾に達した場合は NULL ポインタを返す。
181 .\"O .SH FILES
182 .SH ファイル
183 .TP
184 .I /etc/services
185 .\"O services database file
186 サービスのデータベースファイル
187 .\"O .SH "CONFORMING TO"
188 .SH 準拠
189 4.3BSD, POSIX.1-2001.
190 .\"O .SH "SEE ALSO"
191 .SH 関連項目
192 .BR getnetent (3),
193 .BR getprotoent (3),
194 .BR getservent_r (3),
195 .BR services (5)