From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2711 Path: news.gmane.org!not-for-mail From: Isaac Dunham Newsgroups: gmane.linux.lib.musl.general Subject: fgetgrent Date: Fri, 1 Feb 2013 21:14:04 -0800 Message-ID: <20130201211404.55e1589f.idunham@lavabit.com> References: <20130201071053.GA14593@brightrain.aerifal.cx> <20130201182340.c60061b6.idunham@lavabit.com> <20130202023833.GW20323@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart=_Fri__1_Feb_2013_21_14_04_-0800_5nFPFRlKiYZWlUBS" X-Trace: ger.gmane.org 1359782062 24351 80.91.229.3 (2 Feb 2013 05:14:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Feb 2013 05:14:22 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2712-gllmg-musl=m.gmane.org@lists.openwall.com Sat Feb 02 06:14:42 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1U1VQy-0006lr-P6 for gllmg-musl@plane.gmane.org; Sat, 02 Feb 2013 06:14:36 +0100 Original-Received: (qmail 24102 invoked by uid 550); 2 Feb 2013 05:14:18 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 24089 invoked from network); 2 Feb 2013 05:14:18 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=A6HmYq/ZR4TeZzvAtpRMsNAtbM1zZra33SICYdDH5INvUaghN3tu6NtuBX6syT7apvUhEV4YYR5tX6xVWRUQ7MrhdW/PwEd66vDI5DtJPvjL1Y9F1Yrfit/NrPEOM2UIliqnDh98iMTeovGHC0Oql3Yi+C29KlezbSAi6fcUIdw=; h=Date:From:To:Subject:Message-Id:In-Reply-To:References:X-Mailer:Mime-Version:Content-Type; In-Reply-To: <20130202023833.GW20323@brightrain.aerifal.cx> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; i486-pc-linux-gnu) Xref: news.gmane.org gmane.linux.lib.musl.general:2711 Archived-At: This is a multi-part message in MIME format. --Multipart=_Fri__1_Feb_2013_21_14_04_-0800_5nFPFRlKiYZWlUBS Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 1 Feb 2013 21:38:33 -0500 Rich Felker wrote: > > Add fgetgrent (for heirloom-pkgtools) (patch same as the last time I sent it) > > I'll look at it again. It would be possible to implement getgrent as a wrapper for __fgetgrent, if that shrinks code size for a worthwhile amount. -- Isaac Dunham --Multipart=_Fri__1_Feb_2013_21_14_04_-0800_5nFPFRlKiYZWlUBS Content-Type: text/x-diff; name="fgetgrent.diff" Content-Disposition: attachment; filename="fgetgrent.diff" Content-Transfer-Encoding: 7bit diff --git a/include/grp.h b/include/grp.h index 030d7f8..cb40e07 100644 --- a/include/grp.h +++ b/include/grp.h @@ -30,6 +30,10 @@ struct group *getgrent(void); void endgrent(void); void setgrent(void); +#ifdef _GNU_SOURCE +struct group *fgetgrent(FILE *stream); +#endif + #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) int getgrouplist(const char *, gid_t, gid_t *, int *); int setgroups(size_t, const gid_t *); diff --git a/src/passwd/getgrent.c b/src/passwd/getgrent.c index 429a3e5..d59bcb6 100644 --- a/src/passwd/getgrent.c +++ b/src/passwd/getgrent.c @@ -10,6 +10,17 @@ void setgrent() weak_alias(setgrent, endgrent); +struct group *__fgetgrent(FILE *f) +{ + static char *line, **mem; + static struct group gr; + size_t size=0, nmem=0; + if (!f) return 0; + return __getgrent_a(f, &gr, &line, &size, &mem, &nmem); +} + +weak_alias(__fgetgrent,fgetgrent); + struct group *getgrent() { static char *line, **mem; --Multipart=_Fri__1_Feb_2013_21_14_04_-0800_5nFPFRlKiYZWlUBS--