summaryrefslogtreecommitdiff
path: root/src/pwd/_pwd.h
blob: b5d666bf0476aefb59c226869ebda2c69a6bef48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef ___PWD_H__
#define ___PWD_H__

#include <sys/types.h>
#include <pwd.h>
#include <stdio.h>

struct __pwd {
	FILE *db;
	struct passwd pwd;
	struct passwd * (*getpwent)(void);
};

extern struct __pwd __pwd;

#ifndef _XOPEN_SOURCE
#define setpwent() (__pwd.db == NULL ? (void)0 : (void)rewind(__pwd.db))

#define endpwent() do { \
	if (__pwd.db) { \
		fclose(__pwd.db); \
		__pwd.db = NULL; \
	} \
} while (0)

#define getpwent __pwd.getpwent
#endif

#endif