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 2009-03-30 "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)):
57 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
58 .RB ( feature_test_macros (7)
66 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE > = 500
72 .\"O function returns a pointer to a structure containing
73 .\"O the broken-out fields of a record from the password database
74 .\"O (e.g., the local password file
75 .\"O .IR /etc/passwd ,
77 .\"O The first time it
78 .\"O is called it returns the first entry; thereafter, it returns successive
81 ´Ø¿ô¤Ï¡¢¥Ñ¥¹¥ï¡¼¥É¡¦¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¼èÆÀ¤·¤¿¥¨¥ó¥È¥ê¤ò
82 Í×ÁÇËè¤Ëʬ²ò¤·¡¢³ÆÍ×ÁǤò³ÊǼ¤·¤¿¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤òÊÖ¤¹
83 (¥Ñ¥¹¥ï¡¼¥É¡¦¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÎã:
84 ¥í¡¼¥«¥ë¤Î¥Ñ¥¹¥ï¡¼¥É¥Õ¥¡¥¤¥ë
87 ºÇ½é¤Ë¸Æ¤Ó½Ð¤µ¤ì¤¿»þ¤ÏºÇ½é¤Î¥¨¥ó¥È¥ê¤òÊÖ¤·¡¢¤½¤ì°Ê¹ß¤Ï
88 ¸Æ¤Ó½Ð¤µ¤ì¤ëËè¤Ë¼¡¤Î¥¨¥ó¥È¥ê¤òÊÖ¤¹¡£
92 .\"O function rewinds to the beginning
93 .\"O of the password database.
95 ´Ø¿ô¤ò»È¤¦¤È¡¢¥Ñ¥¹¥ï¡¼¥É¡¦¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÀèƬ¤ËÌá¤ë¡£
99 .\"O function is used to close the password database
100 .\"O after all processing has been performed.
102 ´Ø¿ô¤Ï¡¢Á´¤Æ¤Î½èÍý¤¬½ª¤ï¤Ã¤¿¸å¤Ë¥Ñ¥¹¥ï¡¼¥É¡¦
103 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò¥¯¥í¡¼¥º¤¹¤ë¡£
105 .\"O The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
106 \fIpasswd\fP ¹½Â¤ÂÎ¤Ï \fI<pwd.h>\fP ¤Ç°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë:
111 .\"O char *pw_name; /* username */
112 .\"O char *pw_passwd; /* user password */
113 .\"O uid_t pw_uid; /* user ID */
114 .\"O gid_t pw_gid; /* group ID */
115 .\"O char *pw_gecos; /* real name */
116 .\"O char *pw_dir; /* home directory */
117 .\"O char *pw_shell; /* shell program */
118 .\"O char *pw_name; /* ¥æ¡¼¥¶Ì¾ */
119 char *pw_passwd; /* ¥æ¡¼¥¶¤Î¥Ñ¥¹¥ï¡¼¥É */
120 uid_t pw_uid; /* ¥æ¡¼¥¶ ID */
121 gid_t pw_gid; /* ¥°¥ë¡¼¥× ID */
122 char *pw_gecos; /* ¼Â̾ */
123 char *pw_dir; /* ¥Û¡¼¥à¥Ç¥£¥ì¥¯¥È¥ê */
124 char *pw_shell; /* ¥·¥§¥ë¥×¥í¥°¥é¥à */
128 .\"O .SH "RETURN VALUE"
132 .\"O function returns a pointer to a
134 .\"O structure, or NULL if
135 .\"O there are no more entries or an error occurs.
136 .\"O If an error occurs,
138 .\"O is set appropriately.
139 .\"O If one wants to check
141 .\"O after the call, it should be set to zero before the call.
145 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤òÊÖ¤¹¡£
146 ¤³¤ì°Ê¾å¥¨¥ó¥È¥ê¤¬Ìµ¤¤¤«¡¢¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ï NULL ¤òÊÖ¤¹¡£
150 ¤³¤Î´Ø¿ô¤Î¸Æ¤Ó½Ð¤·¸å¤Ë
152 ¤ò¥Á¥§¥Ã¥¯¤·¤¿¤¤¾ì¹ç¤Ï¡¢¸Æ¤Ó½Ð¤·Á°¤Ë
154 ¤ò 0 ¤ËÀßÄꤷ¤Æ¤ª¤«¤Ê¤¤¤È¤¤¤±¤Ê¤¤¡£
156 .\"O The return value may point to a static area, and may be overwritten
157 .\"O by subsequent calls to
158 .\"O .BR getpwent (),
159 .\"O .BR getpwnam (3),
161 .\"O .BR getpwuid (3).
162 .\"O (Do not pass the returned pointer to
164 ÊÖ¤êÃͤÏÀÅŪ¤ÊÎΰè¤ò»Ø¤·¤Æ¤ª¤ê¡¢¤½¤Î¸å¤Î
168 ¤Î¸Æ¤Ó½Ð¤·¤Ç¾å½ñ¤¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
176 .\"O A signal was caught.
177 ¥·¥°¥Ê¥ë¤¬Ê᪤µ¤ì¤¿¡£
184 .\"O The maximum number
185 .\"O .RB ( OPEN_MAX )
186 .\"O of files was open already in the calling process.
187 ¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤¬¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¿ô¤¬
193 .\"O The maximum number of files was open already in the system.
194 ¥·¥¹¥Æ¥à¤Ç¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¿ô¤¬¤¹¤Ç¤Ë¾å¸Â¤Ç¤¢¤Ã¤¿¡£
197 .\"O .\" not in POSIX
198 .\"O Insufficient memory to allocate
201 .\"O .\" to allocate the passwd structure, or to allocate buffers
204 ¹½Â¤ÂΤ˳ä¤êÅö¤Æ¤ë¥á¥â¥ê¤¬½½Ê¬¤Ê¤«¤Ã¤¿¡£
207 .\"O Insufficient buffer space supplied.
208 ½½Ê¬¤Ê¥Ð¥Ã¥Õ¥¡¶õ´Ö¤¬¤Ê¤¤¡£
213 .\"O local password database file
214 ¥í¡¼¥«¥ë¤Î¥Ñ¥¹¥ï¡¼¥É¡¦¥Ç¡¼¥¿¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë
215 .\"O .SH "CONFORMING TO"
217 SVr4, 4.3BSD, POSIX.1-2001.