GETPWENT(3C) UNIX Programmer's Manual GETPWENT(3C) 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 ( ); HP-UX COMPATIBILITY Level: HP-UX/NUCLEUS Origin: System III 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 returns a pointer to an object with the following structure containing the broken- out fields of a line in the password file. struct passwd { char *pw_name; char *pw_passwd; unsigned int pw_uid; unsigned int pw_gid; char *pw_age; char *pw_comment; char *pw_gecos; char *pw_dir; char *pw_shell; }; The _p_w__c_o_m_m_e_n_t field is 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 in the file, so successive calls can be used to search the entire file. _G_e_t_p_w_u_i_d and _g_e_t_p_w_n_a_m search from the beginning of the file until a matching _u_i_d or _n_a_m_e is found, or EOF is encountered. A call to _s_e_t_p_w_e_n_t has the effect of rewinding the password file to allow repeated searches. _E_n_d_p_w_e_n_t may be called to close the password file when processing is complete. FILES /etc/passwd SEE ALSO getlogin(3C), getgrent(3C), passwd(5). DIAGNOSTICS Null pointer (0) returned on EOF or error. Nothing is returned by _e_n_d_p_w_e_n_t or _s_e_t_p_w_e_n_t. BUGS All information is contained in a static area so it must be copied if it is to be saved.