提交 cac87295 编写于 作者: R Rich Felker

add fgetgrent function

based on patch by Isaac Dunham, moved to its own file to avoid
increasing bss on static linked programs not using this nonstandard
function but using the standard getgrent function, and vice versa.
上级 b9e08308
...@@ -30,6 +30,10 @@ struct group *getgrent(void); ...@@ -30,6 +30,10 @@ struct group *getgrent(void);
void endgrent(void); void endgrent(void);
void setgrent(void); void setgrent(void);
#ifdef _GNU_SOURCE
struct group *fgetgrent(FILE *stream);
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
int getgrouplist(const char *, gid_t, gid_t *, int *); int getgrouplist(const char *, gid_t, gid_t *, int *);
int setgroups(size_t, const gid_t *); int setgroups(size_t, const gid_t *);
......
#include "pwf.h"
struct group *fgetgrent(FILE *f)
{
static char *line, **mem;
static struct group gr;
size_t size=0, nmem=0;
return __getgrent_a(f, &gr, &line, &size, &mem, &nmem);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册