OSDN Git Service

(split) LDP: draft snapshot generated from latest ja.po files.
[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 .\"*******************************************************************
33 .\"
34 .\" This file was generated with po4a. Translate the source file.
35 .\"
36 .\"*******************************************************************
37 .TH GETSERVENT 3 2008\-08\-19 GNU "Linux Programmer's Manual"
38 .SH 名前
39 getservent, getservbyname, getservbyport, setservent, endservent \-
40 サービスのエントリを取得する
41 .SH 書式
42 .nf
43 \fB#include <netdb.h>\fP
44 .sp
45 \fBstruct servent *getservent(void);\fP
46 .sp
47 \fBstruct servent *getservbyname(const char *\fP\fIname\fP\fB, const char *\fP\fIproto\fP\fB);\fP
48 .sp
49 \fBstruct servent *getservbyport(int \fP\fIport\fP\fB, const char *\fP\fIproto\fP\fB);\fP
50 .sp
51 \fBvoid setservent(int \fP\fIstayopen\fP\fB);\fP
52 .sp
53 \fBvoid endservent(void);\fP
54 .fi
55 .SH 説明
56 \fBgetservent\fP()  関数はサービスのデータベース (\fBservices\fP(5)  参照) から次のエントリを読み込み、 そのエントリを
57 \fIservent\fP 構造体の要素別のフィールドに格納し、 その構造体を返す。 必要であれば、データベースへの接続がオープンされる。
58 .PP
59 \fBgetservbyname\fP()  関数は、 プロトコル \fIproto\fP を用いるサービスの名前 \fIname\fP
60 にマッチするエントリをデータベースから探し、 そのエントリを収めた \fIservent\fP 構造体を返す。 \fIproto\fP が NULL
61 の場合は、任意のプロトコルにマッチする。 必要であれば、データベースへの接続がオープンされる。
62 .PP
63 \fBgetservbyport\fP()  関数は、 プロトコル \fIproto\fP を用いるサービスのポート番号 \fIport\fP
64 にマッチするエントリをデータベースから探し、 そのエントリの内容を収めた \fIservent\fP 構造体を返す (ポート番号 \fIport\fP
65 はネットワーク・バイトオーダで指定する)。 \fIproto\fP が NULL の場合は任意のプロトコルにマッチする。
66 必要であれば、データベースへの接続がオープンされる。
67 .PP
68 \fBsetservent\fP()  関数はデータベースへの接続をオープンし、 次の読み込みエントリを先頭のエントリに設定する。 \fIstayopen\fP が
69 0 でない場合、 一つ一つの \fBgetserv*\fP()  関数の呼び出し間でデータベースへの接続をクローズしない。
70 .PP
71 \fBendservent\fP()  関数はデータベースへの接続をクローズする。
72 .PP
73 \fIservent\fP 構造体は \fI<netdb.h>\fP で以下のように定義されている。
74 .sp
75 .in +4n
76 .nf
77 struct servent {
78     char  *s_name;       /* official service name */
79     char **s_aliases;    /* alias list */
80     int    s_port;       /* port number */
81     char  *s_proto;      /* protocol to use */
82 }
83 .fi
84 .in
85 .PP
86 \fIservent\fP 構造体のメンバーは以下の通り。
87 .TP 
88 \fIs_name\fP
89 サービスの正式名 (official name)。
90 .TP 
91 \fIs_aliases\fP
92 サービスの別名のリスト。 リストは NULL で終端される。
93 .TP 
94 \fIs_port\fP
95 サービスのポート番号。ネットワークバイトオーダで指定される。
96 .TP 
97 \fIs_proto\fP
98 このサービスと共に用いるプロトコルの名前。
99 .SH 返り値
100 \fBgetservent\fP(), \fBgetservbyname\fP(), \fBgetservbyport\fP()  関数は、 静的に割り当てられた
101 \fIservent\fP 構造体へのポインタを返す。 エラーが起こったり、ファイルの末尾に達した場合は NULL ポインタを返す。
102 .SH ファイル
103 .TP 
104 \fI/etc/services\fP
105 サービスのデータベースファイル
106 .SH 準拠
107 4.3BSD, POSIX.1\-2001.
108 .SH 関連項目
109 \fBgetnetent\fP(3), \fBgetprotoent\fP(3), \fBgetservent_r\fP(3), \fBservices\fP(5)