diff options
Diffstat (limited to 'src/grp/_grp.h')
| -rw-r--r-- | src/grp/_grp.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/grp/_grp.h b/src/grp/_grp.h new file mode 100644 index 00000000..e3a15be4 --- /dev/null +++ b/src/grp/_grp.h @@ -0,0 +1,32 @@ +#ifndef ___GRP_H__ +#define ___GRP_H__ + +#include <sys/types.h> +#include <grp.h> +#include <stdio.h> + +#define MAX_MEMBERS 128 + +struct __grp { + FILE *db; + struct group grp; + struct group * (*getgrent)(void); + char *members[MAX_MEMBERS]; +}; + +extern struct __grp __grp; + +#ifndef _XOPEN_SOURCE +#define setgrent() (__grp.db == NULL ? (void)0 : (void)rewind(__grp.db)) + +#define endgrent() do { \ + if (__grp.db) { \ + fclose(__grp.db); \ + __grp.db = NULL; \ + } \ +} while (0) + +#define getgrent __grp.getgrent +#endif + +#endif |
