The getgrent function returns the next group in the sequential search, returning a pointer to a structure containing the broken- out fields of an entry in the group database. When first called, getgrent returns a pointer to a group structure containing the first entry in the group database. Thereafter, it returns a pointer to the next group structure in the group database, so successive calls can be used to search the entire database. If an end-of-file or an error is encountered on reading, getgrent returns a NULL pointer and sets errno.