diff options
-rw-r--r-- | include/pwd.h | 5 | ||||
-rw-r--r-- | src/passwd/fgetpwent.c | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/pwd.h b/include/pwd.h index 38e856d3..fbdda3e7 100644 --- a/include/pwd.h +++ b/include/pwd.h @@ -9,6 +9,10 @@ extern "C" { #define __NEED_uid_t #define __NEED_gid_t +#ifdef _GNU_SOURCE +#define __NEED_FILE +#endif + #include <bits/alltypes.h> struct passwd @@ -33,6 +37,7 @@ int getpwnam_r (const char *, struct passwd *, char *, size_t, struct passwd **) #ifdef _GNU_SOURCE char *getpass(const char *); +struct passwd *fgetpwent(FILE *); #endif #ifdef __cplusplus diff --git a/src/passwd/fgetpwent.c b/src/passwd/fgetpwent.c new file mode 100644 index 00000000..e95fdb2c --- /dev/null +++ b/src/passwd/fgetpwent.c @@ -0,0 +1,9 @@ +#include "pwf.h" + +struct passwd *fgetpwent(FILE *f) +{ + static char *line; + static struct passwd pw; + size_t size=0; + return __getpwent_a(f, &pw, &line, &size); +} |