OSDN Git Service

dce59e25624eb85a3939846a4a25c4aa8f935294
[linuxjm/LDP_man-pages.git] / draft / man3 / getpwent.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 .\"
28 .\" Modified Sat Jul 24 19:22:14 1993 by Rik Faith (faith@cs.unc.edu)
29 .\" Modified Mon May 27 21:37:47 1996 by Martin Schulze (joey@linux.de)
30 .\"
31 .\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka
32 .\"     all rights reserved.
33 .\" Translated 1997-12-18, HIROFUMI Nishizuka <nishi@rpts.cl.nec.co.jp>
34 .\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
35 .\"
36 .TH GETPWENT 3  2010-10-21 "GNU" "Linux Programmer's Manual"
37 .\"O .SH NAME
38 .SH 名前
39 .\"O getpwent, setpwent, endpwent \- get password file entry
40 getpwent, setpwent, endpwent \- パスワードファイルのエントリの取得
41 .\"O .SH SYNOPSIS
42 .SH 書式
43 .nf
44 .B #include <sys/types.h>
45 .B #include <pwd.h>
46 .sp
47 .B struct passwd *getpwent(void);
48 .sp
49 .B void setpwent(void);
50 .sp
51 .B void endpwent(void);
52 .fi
53 .sp
54 .in -4n
55 .\"O Feature Test Macro Requirements for glibc (see
56 .\"O .BR feature_test_macros (7)):
57 glibc 向けの機能検査マクロの要件
58 .RB ( feature_test_macros (7)
59 参照):
60 .in
61 .sp
62 .ad l
63 .BR getpwent (),
64 .BR setpwent (),
65 .BR endpwent ():
66 .RS 4
67 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
68 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
69 .RE
70 .ad b
71 .\"O .SH DESCRIPTION
72 .SH 説明
73 .\"O The
74 .\"O .BR getpwent ()
75 .\"O function returns a pointer to a structure containing
76 .\"O the broken-out fields of a record from the password database
77 .\"O (e.g., the local password file
78 .\"O .IR /etc/passwd ,
79 .\"O NIS, and LDAP).
80 .\"O The first time
81 .\"O .BR getpwent ()
82 .\"O is called, it returns the first entry; thereafter, it returns successive
83 .\"O entries.
84 .BR getpwent ()
85 関数は、パスワード・データベースから取得したエントリを
86 要素毎に分解し、各要素を格納した構造体へのポインタを返す
87 (パスワード・データベースの例:
88 ローカルのパスワードファイル
89 .IR /etc/passwd ,
90 NIS, LDAP)。
91 .BR getpwent ()
92 は、最初に呼び出された時は最初のエントリを返し、それ以降は
93 呼び出される毎に次のエントリを返す。
94 .PP
95 .\"O The
96 .\"O .BR setpwent ()
97 .\"O function rewinds to the beginning
98 .\"O of the password database.
99 .BR setpwent ()
100 関数を使うと、パスワード・データベースの先頭に戻る。
101 .PP
102 .\"O The
103 .\"O .BR endpwent ()
104 .\"O function is used to close the password database
105 .\"O after all processing has been performed.
106 .BR endpwent ()
107 関数は、全ての処理が終わった後にパスワード・
108 データベースをクローズする。
109 .PP
110 .\"O The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
111 \fIpasswd\fP 構造体は \fI<pwd.h>\fP で以下のように定義されている:
112 .sp
113 .in +4n
114 .nf
115 struct passwd {
116 .\"O     char   *pw_name;       /* username */
117 .\"O     char   *pw_passwd;     /* user password */
118 .\"O     uid_t   pw_uid;        /* user ID */
119 .\"O     gid_t   pw_gid;        /* group ID */
120 .\"O     char   *pw_gecos;      /* user information */
121 .\"O     char   *pw_dir;        /* home directory */
122 .\"O     char   *pw_shell;      /* shell program */
123 .\"O     char    *pw_name;      /* ユーザ名 */
124     char   *pw_passwd;     /* ユーザのパスワード */
125     uid_t   pw_uid;        /* ユーザ ID */
126     gid_t   pw_gid;        /* グループ ID */
127     char   *pw_gecos;      /* ユーザ情報 */
128     char   *pw_dir;        /* ホームディレクトリ */
129     char   *pw_shell;      /* シェルプログラム */
130 };
131 .fi
132 .in
133 .PP
134 .\"O For more information about the fields of this structure, see
135 .\"O .BR passwd (5).
136 この構造体のフィールドの詳細は
137 .BR passwd (5)
138 を参照のこと。
139 .\"O .SH "RETURN VALUE"
140 .SH 返り値
141 .\"O The
142 .\"O .BR getpwent ()
143 .\"O function returns a pointer to a
144 .\"O .I passwd
145 .\"O structure, or NULL if
146 .\"O there are no more entries or an error occurs.
147 .\"O If an error occurs,
148 .\"O .I errno
149 .\"O is set appropriately.
150 .\"O If one wants to check
151 .\"O .I errno
152 .\"O after the call, it should be set to zero before the call.
153 .BR getpwent ()
154 関数は
155 .I passwd
156 構造体へのポインタを返す。
157 これ以上エントリが無いか、エラーが発生した場合は NULL を返す。
158 エラーが発生すると、
159 .I errno
160 が適切に設定される。
161 この関数の呼び出し後に
162 .I errno
163 をチェックしたい場合は、呼び出し前に
164 .I errno
165 を 0 に設定しておかないといけない。
166
167 .\"O The return value may point to a static area, and may be overwritten
168 .\"O by subsequent calls to
169 .\"O .BR getpwent (),
170 .\"O .BR getpwnam (3),
171 .\"O or
172 .\"O .BR getpwuid (3).
173 .\"O (Do not pass the returned pointer to
174 .\"O .BR free (3).)
175 返り値は静的な領域を指しており、その後の
176 .BR getpwent (),
177 .BR getpwnam (3),
178 .BR getpwuid (3)
179 の呼び出しで上書きされるかもしれない。
180 (返されたポインタを
181 .BR free (3)
182 に渡さないこと。)
183 .\"O .SH ERRORS
184 .SH エラー
185 .TP
186 .B EINTR
187 .\"O A signal was caught.
188 シグナルが捕捉された。
189 .TP
190 .B EIO
191 .\"O I/O error.
192 入出力エラー。
193 .TP
194 .B EMFILE
195 .\"O The maximum number
196 .\"O .RB ( OPEN_MAX )
197 .\"O of files was open already in the calling process.
198 呼び出し元プロセスがオープンされているファイル数が
199 すでに上限
200 .RB ( OPEN_MAX )
201 であった。
202 .TP
203 .B ENFILE
204 .\"O The maximum number of files was open already in the system.
205 システムでオープンされているファイル数がすでに上限であった。
206 .TP
207 .B ENOMEM
208 .\"O .\" not in POSIX
209 .\"O Insufficient memory to allocate
210 .\"O .I passwd
211 .\"O structure.
212 .\"O .\" to allocate the passwd structure, or to allocate buffers
213 .\" POSIX にはない。
214 .I passwd
215 構造体に割り当てるメモリが十分なかった。
216 .TP
217 .B ERANGE
218 .\"O Insufficient buffer space supplied.
219 十分なバッファ空間がない。
220 .\"O .SH FILES
221 .SH ファイル
222 .TP
223 .I /etc/passwd
224 .\"O local password database file
225 ローカルのパスワード・データベースファイル
226 .\"O .SH "CONFORMING TO"
227 .SH 準拠
228 SVr4, 4.3BSD, POSIX.1-2001.
229 .\"O The
230 .\"O .I pw_gecos
231 .\"O field is not specified in POSIX, but is present on most implementations.
232 .I pw_gecos
233 フィールドは POSIX では規定されていないが、
234 ほとんどの実装に存在する。
235 .\"O .SH "SEE ALSO"
236 .SH 関連項目
237 .BR fgetpwent (3),
238 .BR getpw (3),
239 .BR getpwent_r (3),
240 .BR getpwnam (3),
241 .BR getpwuid (3),
242 .BR putpwent (3),
243 .BR passwd (5)