GETGRENT(3C) UNIX Programmer's Manual GETGRENT(3C) NAME getgrent, getgrgid, getgrnam, setgrent, endgrent - get group file entry SYNOPSIS #include struct group *getgrent ( ); struct group *getgrgid (gid) int gid; struct group *getgrnam (name) char *name; int setgrent ( ); int endgrent ( ); HP-UX COMPATIBILITY Level: HP-UX/NUCLEUS Origin: System III DESCRIPTION _G_e_t_g_r_e_n_t, _g_e_t_g_r_g_i_d and _g_e_t_g_r_n_a_m each return pointers to an object with the following structure containing the broken- out fields of a line in the group file. struct group { /* see getgrent(3C) */ char *gr_name; char *gr_passwd; int gr_gid; char *gr_mem; }; The members of this structure are: gr_name The name of the group. gr_passwd The encrypted password of the group. gr_gid The numerical group ID. gr_mem Null-terminated vector of pointers to the individual member names. _G_e_t_g_r_e_n_t reads the next line of the file, so successive calls may be used to search the entire file. _G_e_t_g_r_g_i_d and _g_e_t_g_r_n_a_m search from the beginning of the file until a matching _g_i_d or _n_a_m_e is found, or EOF is encountered. A call to _s_e_t_g_r_e_n_t has the effect of rewinding the group file to allow repeated searches. _E_n_d_g_r_e_n_t may be called to close the group file when processing is complete, although that is usually not necessary. FILES /etc/group SEE ALSO getlogin(3C), getpwent(3C), group(5). DIAGNOSTICS A NULL pointer (0) is returned on EOF or error. Nothing is returned by _e_n_d_g_r_e_n_t or _s_e_t_g_r_e_n_t. BUGS All information is contained in a static area so it must be copied if it is to be saved.