1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
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.
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
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" References consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
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)
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>
36 .TH GETPWENT 3 2010-10-21 "GNU" "Linux Programmer's Manual"
39 .\"O getpwent, setpwent, endpwent \- get password file entry
40 getpwent, setpwent, endpwent \- パスワードファイルのエントリの取得
44 .B #include <sys/types.h>
47 .B struct passwd *getpwent(void);
49 .B void setpwent(void);
51 .B void endpwent(void);
55 .\"O Feature Test Macro Requirements for glibc (see
56 .\"O .BR feature_test_macros (7)):
58 .RB ( feature_test_macros (7)
67 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
68 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
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 ,
82 .\"O is called, it returns the first entry; thereafter, it returns successive
85 関数は、パスワード・データベースから取得したエントリを
86 要素毎に分解し、各要素を格納した構造体へのポインタを返す
92 は、最初に呼び出された時は最初のエントリを返し、それ以降は
97 .\"O function rewinds to the beginning
98 .\"O of the password database.
100 関数を使うと、パスワード・データベースの先頭に戻る。
104 .\"O function is used to close the password database
105 .\"O after all processing has been performed.
107 関数は、全ての処理が終わった後にパスワード・
110 .\"O The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
111 \fIpasswd\fP 構造体は \fI<pwd.h>\fP で以下のように定義されている:
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; /* シェルプログラム */
134 .\"O For more information about the fields of this structure, see
139 .\"O .SH "RETURN VALUE"
143 .\"O function returns a pointer to a
145 .\"O structure, or NULL if
146 .\"O there are no more entries or an error occurs.
147 .\"O If an error occurs,
149 .\"O is set appropriately.
150 .\"O If one wants to check
152 .\"O after the call, it should be set to zero before the call.
157 これ以上エントリが無いか、エラーが発生した場合は NULL を返す。
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),
172 .\"O .BR getpwuid (3).
173 .\"O (Do not pass the returned pointer to
187 .\"O A signal was caught.
195 .\"O The maximum number
196 .\"O .RB ( OPEN_MAX )
197 .\"O of files was open already in the calling process.
198 呼び出し元プロセスがオープンされているファイル数が
204 .\"O The maximum number of files was open already in the system.
205 システムでオープンされているファイル数がすでに上限であった。
208 .\"O .\" not in POSIX
209 .\"O Insufficient memory to allocate
212 .\"O .\" to allocate the passwd structure, or to allocate buffers
218 .\"O Insufficient buffer space supplied.
224 .\"O local password database file
225 ローカルのパスワード・データベースファイル
226 .\"O .SH "CONFORMING TO"
228 SVr4, 4.3BSD, POSIX.1-2001.
231 .\"O field is not specified in POSIX, but is present on most implementations.
233 フィールドは POSIX では規定されていないが、