OSDN Git Service

acb8a5759ce733bb398fff008d2ba132a5866400
[linuxjm/LDP_man-pages.git] / draft / man3 / setaliasent.3
1 .\" Copyright 2003 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
3 .\"
4 .\" Polished a bit, added a little, aeb
5 .\"
6 .\" Japanese Version Copyright (c) 2004 Yuichi SATO
7 .\"         all rights reserved.
8 .\" Translated Sun Sep  5 20:44:27 JST 2004
9 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
10 .\"
11 .TH SETALIASENT 3 2003-09-09 "GNU" "Linux Programmer's Manual"
12 .\"O .SH NAME
13 .SH 名前
14 .\"O setaliasent, endaliasent, getaliasent, getaliasent_r,
15 .\"O getaliasbyname, getaliasbyname_r \- read an alias entry
16 setaliasent, endaliasent, getaliasent, getaliasent_r, getaliasbyname, getaliasbyname_r \- エイリアスエントリを読み込む
17 .\"O .SH SYNOPSIS
18 .SH 書式
19 .B #include <aliases.h>
20 .sp
21 .B "void setaliasent(void);"
22 .sp
23 .B "void endaliasent(void);"
24 .sp
25 .B "struct aliasent *getaliasent(void);"
26 .sp
27 .BI "int getaliasent_r(struct aliasent *" result ","
28 .br
29 .BI "        char *" buffer ", size_t " buflen ", struct aliasent **" res );
30 .sp
31 .BI "struct aliasent *getaliasbyname(const char *" name );
32 .sp
33 .BI "int getaliasbyname_r(const char *" name ", struct aliasent *" result ,
34 .br
35 .BI "        char *" buffer ", size_t " buflen ", struct aliasent **" res );
36 .\"O .SH DESCRIPTION
37 .SH 説明
38 .\"O One of the databases available with the Name Service Switch (NSS)
39 .\"O is the aliases database, that contains mail aliases.
40 .\"O (To find out which databases are supported, try  getent \-\-help .)
41 ネームサービススイッチ (Name Service Switch, NSS) で
42 利用可能なデータベースの 1 つとして、
43 メールエイリアスを保持するエイリアスデータベースがある。
44 (どのデータベースがサポートされているかを調べるには、
45 getent \-\-help を実行すること。)
46 .\"O Six functions are provided to access the aliases database.
47 エイリアスデータベースにアクセスするために、
48 6 つの関数が提供されている。
49 .PP
50 .\"O The
51 .\"O .BR getaliasent ()
52 .\"O function returns a pointer to a structure containing
53 .\"O the group information from the aliases database.
54 .BR getaliasent ()
55 関数はエイリアスデータベースから取り出した
56 グループ情報を含む構造体へのポインタを返す。
57 .\"O The first time it is called it returns the first entry;
58 .\"O thereafter, it returns successive entries.
59 1 回目に関数が呼ばれたときには、最初のエントリを返す;
60 それ以降はその後のエントリを返す。
61 .PP
62 .\"O The
63 .\"O .BR setaliasent ()
64 .\"O function rewinds the file pointer to the beginning of the
65 .\"O aliases database.
66 .BR setaliasent ()
67 関数はファイルポインタをエイリアスデータベースの先頭に巻き戻す。
68 .PP
69 .\"O The
70 .\"O .BR endaliasent ()
71 .\"O function closes the aliases database.
72 .BR endaliasent ()
73 関数はエイリアスデータベースをクローズする。
74 .PP
75 .\"O .BR getaliasent_r ()
76 .\"O is the reentrant version of the previous function.
77 .\"O The requested structure
78 .\"O is stored via the first argument but the programmer needs to fill the other
79 .\"O arguments also.
80 .\"O Not providing enough space causes the function to fail.
81 .BR getaliasent_r ()
82 関数は上記の関数のリエントラント版である。
83 要求された構造体は第 1 引き数に格納されるが、
84 プログラマは他の引き数も埋めてやる必要がある。
85 充分な領域が与えられないと、この関数は失敗する。
86 .PP
87 .\"O The function
88 .\"O .BR getaliasbyname ()
89 .\"O takes the name argument and searches the aliases database.
90 .\"O The entry is returned as a pointer to a
91 .\"O .IR "struct aliasent" .
92 関数
93 .BR getaliasbyname ()
94 は name 引き数をとり、エイリアスデータベースを検索する。
95 エントリは
96 .I "struct aliasent"
97 へのポインタとして返される。
98 .PP
99 .\"O .BR getaliasbyname_r ()
100 .\"O is the reentrant version of the previous function.
101 .\"O The requested structure
102 .\"O is stored via the second argument but the programmer needs to fill the other
103 .\"O arguments also.
104 .\"O Not providing enough space causes the function to fail.
105 .BR getaliasbyname_r ()
106 は上記の関数のリエントラント版である。
107 要求された構造体は第 2 引き数に格納されるが、
108 プログラマは他の引き数も埋めてやる必要がある。
109 充分な領域が与えられないと、この関数は失敗する。
110 .PP
111 .\"O The
112 .\"O .I "struct aliasent"
113 .\"O is defined in
114 .\"O .IR <aliases.h> :
115 .I "struct aliasent"
116
117 .I <aliases.h>
118 で定義されている。
119 .in +4n
120 .nf
121
122 struct aliasent {
123 .\"O     char    *alias_name;             /* alias name */
124 .\"O     size_t   alias_members_len;
125 .\"O     char   **alias_members;          /* alias name list */
126 .\"O     int      alias_local;
127     char    *alias_name;             /* エイリアス名 */
128     size_t   alias_members_len;
129     char   **alias_members;          /* エイリアス名のリスト */
130     int      alias_local;
131 };
132 .fi
133 .in
134 .\"O .SH "RETURN VALUE"
135 .SH 返り値
136 .\"O The functions
137 .\"O .BR getaliasent_r ()
138 .\"O and
139 .\"O .BR getaliasbyname_r ()
140 .\"O return a nonzero value on error.
141 関数
142 .BR getaliasent_r ()
143
144 .BR getaliasbyname_r ()
145 は、エラーの場合に 0 以外の値を返す。
146 .\"O .SH FILES
147 .SH ファイル
148 .\"O The default alias database is the file
149 .\"O .IR /etc/aliases .
150 デフォルトのエイリアスデータベースは、ファイル
151 .I /etc/aliases
152 である。
153 .\"O This can be changed in the
154 .\"O .I /etc/nsswitch.conf
155 .\"O file.
156 これは
157 .I /etc/nsswitch.conf
158 ファイルで変更できる。
159 .\"O .SH "CONFORMING TO"
160 .SH 準拠
161 .\"O These routines are glibc-specific.
162 このルーチンは glibc 固有のものである。
163 .\"O The NeXT system has similar routines:
164 NeXT システムには同様のルーチンがある。
165 .in +4n
166 .sp
167 .nf
168
169 #include <aliasdb.h>
170
171 void alias_setent(void);
172 void alias_endent(void);
173 alias_ent *alias_getent(void);
174 alias_ent *alias_getbyname(char *name);
175 .fi
176 .in
177 .\"O .SH EXAMPLE
178 .SH 例
179 .\"O The following example compiles with
180 .\"O .IR "gcc example.c -o example" .
181 以下の例は
182 .I "gcc example.c -o example"
183 でコンパイルできる。
184 .\"O It will dump all names in the alias database.
185 これはエイリアスデータベースにある全ての名前をダンプする。
186 .sp
187 .nf
188 #include <aliases.h>
189 #include <stdio.h>
190 #include <stdlib.h>
191 #include <errno.h>
192
193 int
194 main(void)
195 {
196     struct aliasent *al;
197     setaliasent();
198     for (;;) {
199         al = getaliasent();
200         if (al == NULL)
201             break;
202         printf("Name: %s\\n", al\->alias_name);
203     }
204     if (errno) {
205         perror("reading alias");
206         exit(EXIT_FAILURE);
207     }
208     endaliasent();
209     exit(EXIT_SUCCESS);
210 .fi
211 .\"O .SH "SEE ALSO"
212 .SH 関連項目
213 .BR getgrent (3),
214 .BR getpwent (3),
215 .BR getspent (3),
216 .BR aliases (5)
217 .\"
218 .\" /etc/sendmail/aliases
219 .\" Yellow Pages
220 .\" newaliases, postalias