about summary refs log tree commit diff
path: root/grp
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-08-10 00:00:16 +0000
committerUlrich Drepper <drepper@redhat.com>1996-08-10 00:00:16 +0000
commita8922de8c70ba56fda40ce9e171c4069a6a90d53 (patch)
tree2a8f8a7b499ab4ab42c7713c3de24c4226cbc2cd /grp
parenta5113b141cd85a98b4711607c430e6e01775bd9a (diff)
downloadglibc-a8922de8c70ba56fda40ce9e171c4069a6a90d53.tar.gz
glibc-a8922de8c70ba56fda40ce9e171c4069a6a90d53.tar.xz
glibc-a8922de8c70ba56fda40ce9e171c4069a6a90d53.zip
Update for 960809.
Fri Aug  9 17:38:58 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/sys/timex.h: Include <sys/time.h> to
	get `struct timeval'.
	* sysdeps/unix/sysv/linux/sys/acct.h: Get time_t from <time.h>.
	* sysdeps/unix/sysv/linux/sys/module.h: Get size_t from <stddef.h>.
	* sysdeps/unix/sysv/linux/sys/io.h: Get definition of __P.
	* sysdeps/unix/sysv/linux/sys/klog.h: Likewise.
	* gmon/sys/gmon.h: Include <sys/types.h> to get u_long.
	* sysdeps/unix/sysv/linux/direntry.h: Complete types in
	<linux/dirent.h>.
	* io/fts.h: Include <sys/types.h> to get dev_t.
	Reported by Matthias Urlichs.

	* sysdeps/posix/tempname.c [USE_IN_LIBIO]: Don't clear
 	_IO_file_flags.  It's the same as _flags.
	Reported by Miquel van Smoorenburg <miquels@Q.cistron.nl>.

Wed Aug  7 19:38:47 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/m68k/resourcebits.h: Add RLIMIT_AS.
Diffstat (limited to 'grp')
-rw-r--r--grp/Makefile2
-rw-r--r--grp/fgetgrent.c36
-rw-r--r--grp/getgrent.c2
-rw-r--r--grp/getgrent_r.c2
-rw-r--r--grp/getgrgid.c2
-rw-r--r--grp/getgrgid_r.c2
-rw-r--r--grp/getgrnam.c2
-rw-r--r--grp/grp.h10
8 files changed, 18 insertions, 40 deletions
diff --git a/grp/Makefile b/grp/Makefile
index 273b7d17ea..091d8ba84b 100644
--- a/grp/Makefile
+++ b/grp/Makefile
@@ -23,7 +23,7 @@ subdir	:= grp
 
 routines := fgetgrent initgroups setgroups \
 	    getgrent getgrgid getgrnam \
-	    getgrent_r getgrgid_r getgrnam_r
+	    getgrent_r getgrgid_r getgrnam_r fgetgrent_r
 
 tests := testgrp
 
diff --git a/grp/fgetgrent.c b/grp/fgetgrent.c
index 38ccd15e6f..95ae2ecd6a 100644
--- a/grp/fgetgrent.c
+++ b/grp/fgetgrent.c
@@ -16,25 +16,8 @@ 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.  */
 
-#include <stdio.h>
 #include <grp.h>
-
-/* Define a line parsing function using the common code
-   used in the nss_files module.  */
-
-#define STRUCTURE	group
-#define ENTNAME		grent
-struct grent_data {};
-
-#define TRAILING_LIST_MEMBER		gr_mem
-#define TRAILING_LIST_SEPARATOR_P(c)	((c) == ',')
-#include "../nss/nss_files/files-parse.c"
-LINE_PARSER
-(,
- STRING_FIELD (result->gr_name, ISCOLON, 0);
- STRING_FIELD (result->gr_passwd, ISCOLON, 0);
- INT_FIELD (result->gr_gid, ISCOLON, 0, 10,);
- )
+#include <stdio.h>
 
 
 /* Read one entry from the given stream.  */
@@ -43,21 +26,6 @@ fgetgrent (FILE *stream)
 {
   static char buffer[BUFSIZ];
   static struct group result;
-  char *p;
-
-  do
-    {
-      p = fgets (buffer, sizeof buffer, stream);
-      if (p == NULL)
-	return NULL;
-
-      /* Skip leading blanks.  */
-      while (isspace (*p))
-	++p;
-    } while (*p == '\0' || *p == '#' ||	/* Ignore empty and comment lines.  */
-	     /* Parse the line.  If it is invalid, loop to
-		get the next line of the file to parse.  */
-	     ! parse_line (p, &result, (void *) buffer, sizeof buffer));
 
-  return &result;
+  return __fgetgrent_r (stream, &result, buffer, sizeof buffer);
 }
diff --git a/grp/getgrent.c b/grp/getgrent.c
index 4e14bbcf17..d19e4d189b 100644
--- a/grp/getgrent.c
+++ b/grp/getgrent.c
@@ -25,6 +25,6 @@ Boston, MA 02111-1307, USA.  */
 #define	GETFUNC_NAME	getgrent
 #define	ENDFUNC_NAME	endgrent
 #define DATABASE_NAME	group
-#define BUFLEN		1024
+#define BUFLEN		NSS_BUFLEN_GROUP
 
 #include "../nss/getXXent.c"
diff --git a/grp/getgrent_r.c b/grp/getgrent_r.c
index db692b20d6..1f60763ea8 100644
--- a/grp/getgrent_r.c
+++ b/grp/getgrent_r.c
@@ -25,6 +25,6 @@ Boston, MA 02111-1307, USA.  */
 #define	GETFUNC_NAME	getgrent
 #define	ENDFUNC_NAME	endgrent
 #define DATABASE_NAME	group
-#define BUFLEN		1024
+#define BUFLEN		NSS_BUFLEN_GROUP
 
 #include "../nss/getXXent_r.c"
diff --git a/grp/getgrgid.c b/grp/getgrgid.c
index 855d31cbe9..b90000ba1e 100644
--- a/grp/getgrgid.c
+++ b/grp/getgrgid.c
@@ -25,6 +25,6 @@ Boston, MA 02111-1307, USA.  */
 #define DATABASE_NAME	group
 #define ADD_PARAMS	gid_t gid
 #define ADD_VARIABLES	gid
-#define BUFLEN		1024
+#define BUFLEN		NSS_BUFLEN_GROUP
 
 #include "../nss/getXXbyYY.c"
diff --git a/grp/getgrgid_r.c b/grp/getgrgid_r.c
index 3b1719d644..6c7704dd52 100644
--- a/grp/getgrgid_r.c
+++ b/grp/getgrgid_r.c
@@ -25,6 +25,6 @@ Boston, MA 02111-1307, USA.  */
 #define DATABASE_NAME	group
 #define ADD_PARAMS	gid_t gid
 #define ADD_VARIABLES	gid
-#define BUFLEN		1024
+#define BUFLEN		NSS_BUFLEN_GROUP
 
 #include "../nss/getXXbyYY_r.c"
diff --git a/grp/getgrnam.c b/grp/getgrnam.c
index 2104d87459..f060ea9f5f 100644
--- a/grp/getgrnam.c
+++ b/grp/getgrnam.c
@@ -25,6 +25,6 @@ Boston, MA 02111-1307, USA.  */
 #define DATABASE_NAME	group
 #define ADD_PARAMS	const char *name
 #define ADD_VARIABLES	name
-#define BUFLEN		1024
+#define BUFLEN		NSS_BUFLEN_GROUP
 
 #include "../nss/getXXbyYY.c"
diff --git a/grp/grp.h b/grp/grp.h
index 1abe22e4e2..6a88191380 100644
--- a/grp/grp.h
+++ b/grp/grp.h
@@ -110,6 +110,16 @@ extern struct group *getgrnam_r __P ((__const char *__name,
 				      struct group *__resultbuf,
 				      char *buffer, int __buflen));
 
+#ifdef	__USE_SVID
+/* Read a group entry from STREAM.  */
+extern struct group *__fgetgrent_r __P ((FILE * __stream,
+					 struct group *__resultbuf,
+					 char *buffer, int __buflen));
+extern struct group *fgetgrent_r __P ((FILE * __stream,
+				       struct group *__resultbuf,
+				       char *buffer, int __buflen));
+#endif
+
 #endif	/* reentrant */