summaryrefslogtreecommitdiff
path: root/grp/getgrent.c
diff options
context:
space:
mode:
Diffstat (limited to 'grp/getgrent.c')
-rw-r--r--grp/getgrent.c59
1 files changed, 11 insertions, 48 deletions
diff --git a/grp/getgrent.c b/grp/getgrent.c
index 105572f9a0..4e14bbcf17 100644
--- a/grp/getgrent.c
+++ b/grp/getgrent.c
@@ -1,5 +1,6 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
+/* Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -13,55 +14,17 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
-#include <ansidecl.h>
-#include <stddef.h>
-#include <stdio.h>
#include <grp.h>
-static FILE *stream = NULL;
-/* Rewind the stream. */
-void
-DEFUN_VOID(setgrent)
-{
- if (stream != NULL)
- rewind(stream);
-}
+#define LOOKUP_TYPE struct group
+#define SETFUNC_NAME setgrent
+#define GETFUNC_NAME getgrent
+#define ENDFUNC_NAME endgrent
+#define DATABASE_NAME group
+#define BUFLEN 1024
-
-/* Close the stream. */
-void
-DEFUN_VOID(endgrent)
-{
- if (stream != NULL)
- {
- (void) fclose(stream);
- stream = NULL;
- }
-}
-
-
-/* Read an entry from the stream. */
-struct group *
-DEFUN_VOID(getgrent)
-{
- static PTR info = NULL;
- if (info == NULL)
- {
- info = __grpalloc();
- if (info == NULL)
- return(NULL);
- }
-
- if (stream == NULL)
- {
- stream = __grpopen();
- if (stream == NULL)
- return(NULL);
- }
-
- return(__grpread(stream, info));
-}
+#include "../nss/getXXent.c"