GETPWENT(3) UNIX Programmer's Manual GETPWENT(3) NAME getpwent, getpwuid, getpwnam, setpwent, endpwent - get pass- word file entry SYNOPSIS #include struct passwd *getpwent(); struct passwd *getpwuid(uid) int uid; struct passwd *getpwnam(name) char *name; int setpwent(); int endpwent(); DESCRIPTION _G_e_t_p_w_e_n_t, _g_e_t_p_w_u_i_d and _g_e_t_p_w_n_a_m each return a pointer to an object with the following structure containing the broken- out fields of a line in the password file. struct passwd { /* see getpwent(3) */ char *pw_name; char *pw_passwd; int pw_uid; int pw_gid; int pw_quota; char *pw_comment; char *pw_gecos; char *pw_dir; char *pw_shell; }; The fields _p_w__q_u_o_t_a and _p_w__c_o_m_m_e_n_t are unused; the others have meanings described in _p_a_s_s_w_d(5). _G_e_t_p_w_e_n_t reads the next line (opening the file if neces- sary); _s_e_t_p_w_e_n_t rewinds the file; _e_n_d_p_w_e_n_t closes it. _G_e_t_p_w_u_i_d and _g_e_t_p_w_n_a_m search from the beginning until a matching _u_i_d or _n_a_m_e is found (or until EOF is encountered). FILES /etc/passwd SEE ALSO getgrent(3), getlogin(3), passwd(5) DIAGNOSTICS A null pointer returned on EOF or error. Printed 5/27/83 1 GETPWENT(3) UNIX Programmer's Manual GETPWENT(3) BUGS All information is contained in a static area so it must be copied if it is to be saved. Printed 5/27/83 2