diff options
| author | Jakob Kaivo <jkk@ung.org> | 2020-08-14 16:56:59 -0400 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2020-08-14 16:56:59 -0400 |
| commit | e83323c4635dd40a0b7c4260b6cbbac12005772e (patch) | |
| tree | 58c70c175b75e05d3a5d30f058048438b25ce951 /src/grp/_grp.h | |
| parent | 57a91fc9f0eb8a14ce9ffa4d5218dc8e358fb273 (diff) | |
add internal state for <grp.h>
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 |
