1 /**
2  * D header file for POSIX.
3  *
4  * Copyright: Public Domain
5  * License:   Public Domain
6  * Authors:   Sean Kelly
7  * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
8  */
9 module tango.stdc.posix.pwd;
10 
11 private import tango.stdc.posix.config;
12 public import tango.stdc.posix.sys.types; // for gid_t, uid_t
13 
14 extern (C):
15 
16 //
17 // Required
18 //
19 /*
20 struct passwd
21 {
22     char*   pw_name;
23     uid_t   pw_uid;
24     gid_t   pw_gid;
25     char*   pw_dir;
26     char*   pw_shell;
27 }
28 
29 passwd* getpwnam(in char*);
30 passwd* getpwuid(uid_t);
31 */
32 
33 version( linux )
34 {
35     struct passwd
36     {
37         char*   pw_name;
38         char*   pw_passwd;
39         uid_t   pw_uid;
40         gid_t   pw_gid;
41         char*   pw_gecos;
42         char*   pw_dir;
43         char*   pw_shell;
44     }
45 }
46 else version(OSX)
47 {
48     struct passwd
49     {
50         char*   pw_name;
51         char*   pw_passwd;
52         uid_t   pw_uid;
53         gid_t   pw_gid;
54         time_t  pw_change;
55         char*   pw_class;
56         char*   pw_gecos;
57         char*   pw_dir;
58         char*   pw_shell;
59         time_t  pw_expire;
60     }
61 }
62 else version( FreeBSD )
63 {
64     struct passwd
65     {
66 		char*   pw_name;		/* user name */
67 		char*   pw_passwd;		/* encrypted password */
68 		uid_t	pw_uid;			/* user uid */
69 		gid_t	pw_gid;			/* user gid */
70 		time_t	pw_change;		/* password change time */
71 		char*   pw_class;		/* user access class */
72 		char*   pw_gecos;		/* Honeywell login info */
73 		char*   pw_dir;		/* home directory */
74 		char*   pw_shell;		/* default shell */
75 		time_t	pw_expire;		/* account expiration */
76 		int	pw_fields;		/* internal: fields filled in */
77     }
78 }
79 else version( solaris )
80 {
81 	struct passwd
82 	{
83 		char*	pw_name;
84 		char*	pw_passwd;
85 		uid_t	pw_uid;
86 		gid_t	pw_gid;
87 		char*	pw_age;
88 		char*	pw_comment;
89 		char*	pw_gecos;
90 		char*	pw_dir;
91 		char*	pw_shell;
92 	}
93 }
94 passwd* getpwnam(in char*);
95 passwd* getpwuid(uid_t);
96 
97 //
98 // Thread-Safe Functions (TSF)
99 //
100 /*
101 int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
102 int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
103 */
104 
105 version( linux )
106 {
107     int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
108     int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
109 }
110 else version(OSX)
111 {
112     int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
113     int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
114 }
115 else version( FreeBSD )
116 {
117     int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
118     int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
119 }
120 else version( solaris )
121 {
122     int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
123     int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
124 }
125 //
126 // XOpen (XSI)
127 //
128 /*
129 void    endpwent();
130 passwd* getpwent();
131 void    setpwent();
132 */
133 
134 version( linux )
135 {
136     void    endpwent();
137     passwd* getpwent();
138     void    setpwent();
139 }
140 else version(OSX)
141 {
142     void    endpwent();
143     passwd* getpwent();
144     void    setpwent();
145 }
146 else version (FreeBSD)
147 {
148     void    endpwent();
149     passwd* getpwent();
150     void    setpwent();
151 }
152 else version ( solaris )
153 {
154     void    endpwent();
155     passwd* getpwent();
156     void    setpwent();
157 }