/****************************************************************************
 *
 * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/grp/fgetgrent.c,v $
 * $Date: 2005/11/16 03:15:41 $
 * $Revision: 1.5 $
 * $State: Exp $
 * $Author: joty $
 *
 ***************************************************************************/

/* Read a group password file entry. */

#include <stddef.h>
#include <stdio.h>
#include <grp.h>
#include <pthread.h>

/* Read one entry from the given stream.
   Not thread safe.  */
struct group *
fgetgrent (FILE * stream)
{
  static struct group grp;
  static char buffer[256];

  PTHREAD_UNSAFE_CANCELLATION

  if (stream == NULL)
    return NULL;

  return __grpread (stream, &grp, buffer, sizeof (buffer));
}
