OSDN Git Service

(split) LDP v3.30, v3.31 の定型的な変更内容を反映。
[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