1 .\" Copyright 2003 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
4 .\" Polished a bit, added a little, aeb
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>
11 .TH SETALIASENT 3 2003-09-09 "GNU" "Linux Programmer's Manual"
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 \- ¥¨¥¤¥ê¥¢¥¹¥¨¥ó¥È¥ê¤òÆɤ߹þ¤à
19 .B #include <aliases.h>
21 .B "void setaliasent(void);"
23 .B "void endaliasent(void);"
25 .B "struct aliasent *getaliasent(void);"
27 .BI "int getaliasent_r(struct aliasent *" result ","
29 .BI " char *" buffer ", size_t " buflen ", struct aliasent **" res );
31 .BI "struct aliasent *getaliasbyname(const char *" name );
33 .BI "int getaliasbyname_r(const char *" name ", struct aliasent *" result ,
35 .BI " char *" buffer ", size_t " buflen ", struct aliasent **" res );
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 ¤Ä¤Î´Ø¿ô¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¡£
51 .\"O .BR getaliasent ()
52 .\"O function returns a pointer to a structure containing
53 .\"O the group information from the aliases database.
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 ¤½¤ì°Ê¹ß¤Ï¤½¤Î¸å¤Î¥¨¥ó¥È¥ê¤òÊÖ¤¹¡£
63 .\"O .BR setaliasent ()
64 .\"O function rewinds the file pointer to the beginning of the
65 .\"O aliases database.
67 ´Ø¿ô¤Ï¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿¤ò¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÀèƬ¤Ë´¬¤Ì᤹¡£
70 .\"O .BR endaliasent ()
71 .\"O function closes the aliases database.
73 ´Ø¿ô¤Ï¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò¥¯¥í¡¼¥º¤¹¤ë¡£
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
80 .\"O Not providing enough space causes the function to fail.
82 ´Ø¿ô¤Ï¾åµ¤Î´Ø¿ô¤Î¥ê¥¨¥ó¥È¥é¥ó¥ÈÈǤǤ¢¤ë¡£
83 Í׵ᤵ¤ì¤¿¹½Â¤ÂΤÏÂè 1 °ú¤¿ô¤Ë³ÊǼ¤µ¤ì¤ë¤¬¡¢
84 ¥×¥í¥°¥é¥Þ¤Ï¾¤Î°ú¤¿ô¤âËä¤á¤Æ¤ä¤ëɬÍפ¬¤¢¤ë¡£
85 ½¼Ê¬¤ÊÎΰ褬Ϳ¤¨¤é¤ì¤Ê¤¤¤È¡¢¤³¤Î´Ø¿ô¤Ï¼ºÇÔ¤¹¤ë¡£
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" .
94 ¤Ï name °ú¤¿ô¤ò¤È¤ê¡¢¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò¸¡º÷¤¹¤ë¡£
97 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤È¤·¤ÆÊÖ¤µ¤ì¤ë¡£
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
104 .\"O Not providing enough space causes the function to fail.
105 .BR getaliasbyname_r ()
106 ¤Ï¾åµ¤Î´Ø¿ô¤Î¥ê¥¨¥ó¥È¥é¥ó¥ÈÈǤǤ¢¤ë¡£
107 Í׵ᤵ¤ì¤¿¹½Â¤ÂΤÏÂè 2 °ú¤¿ô¤Ë³ÊǼ¤µ¤ì¤ë¤¬¡¢
108 ¥×¥í¥°¥é¥Þ¤Ï¾¤Î°ú¤¿ô¤âËä¤á¤Æ¤ä¤ëɬÍפ¬¤¢¤ë¡£
109 ½¼Ê¬¤ÊÎΰ褬Ϳ¤¨¤é¤ì¤Ê¤¤¤È¡¢¤³¤Î´Ø¿ô¤Ï¼ºÇÔ¤¹¤ë¡£
112 .\"O .I "struct aliasent"
114 .\"O .IR <aliases.h> :
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; /* ¥¨¥¤¥ê¥¢¥¹Ì¾¤Î¥ê¥¹¥È */
134 .\"O .SH "RETURN VALUE"
137 .\"O .BR getaliasent_r ()
139 .\"O .BR getaliasbyname_r ()
140 .\"O return a nonzero value on error.
144 .BR getaliasbyname_r ()
145 ¤Ï¡¢¥¨¥é¡¼¤Î¾ì¹ç¤Ë 0 °Ê³°¤ÎÃͤòÊÖ¤¹¡£
148 .\"O The default alias database is the file
149 .\"O .IR /etc/aliases .
150 ¥Ç¥Õ¥©¥ë¥È¤Î¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ï¡¢¥Õ¥¡¥¤¥ë
153 .\"O This can be changed in the
154 .\"O .I /etc/nsswitch.conf
157 .I /etc/nsswitch.conf
158 ¥Õ¥¡¥¤¥ë¤ÇÊѹ¹¤Ç¤¤ë¡£
159 .\"O .SH "CONFORMING TO"
161 .\"O These routines are glibc-specific.
162 ¤³¤Î¥ë¡¼¥Á¥ó¤Ï glibc ¸ÇͤΤâ¤Î¤Ç¤¢¤ë¡£
163 .\"O The NeXT system has similar routines:
164 NeXT ¥·¥¹¥Æ¥à¤Ë¤ÏƱÍͤΥ롼¥Á¥ó¤¬¤¢¤ë¡£
171 void alias_setent(void);
172 void alias_endent(void);
173 alias_ent *alias_getent(void);
174 alias_ent *alias_getbyname(char *name);
179 .\"O The following example compiles with
180 .\"O .IR "gcc example.c -o example" .
182 .I "gcc example.c -o example"
184 .\"O It will dump all names in the alias database.
185 ¤³¤ì¤Ï¥¨¥¤¥ê¥¢¥¹¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë¤¢¤ëÁ´¤Æ¤Î̾Á°¤ò¥À¥ó¥×¤¹¤ë¡£
202 printf("Name: %s\\n", al\->alias_name);
205 perror("reading alias");
218 .\" /etc/sendmail/aliases
220 .\" newaliases, postalias