123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
/**
 * D header file for POSIX.
 *
 * Copyright: Public Domain
 * License:   Public Domain
 * Authors:   Sean Kelly
 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
 */
module tango.stdc.posix.pwd;

private import tango.stdc.posix.config;
public import tango.stdc.posix.sys.types; // for gid_t, uid_t

extern (C):

//
// Required
//
/*
struct passwd
{
    char*   pw_name;
    uid_t   pw_uid;
    gid_t   pw_gid;
    char*   pw_dir;
    char*   pw_shell;
}

passwd* getpwnam(in char*);
passwd* getpwuid(uid_t);
*/

version( linux )
{
    struct passwd
    {
        char*   pw_name;
        char*   pw_passwd;
        uid_t   pw_uid;
        gid_t   pw_gid;
        char*   pw_gecos;
        char*   pw_dir;
        char*   pw_shell;
    }
}
else version( darwin )
{
    struct passwd
    {
        char*   pw_name;
        char*   pw_passwd;
        uid_t   pw_uid;
        gid_t   pw_gid;
        time_t  pw_change;
        char*   pw_class;
        char*   pw_gecos;
        char*   pw_dir;
        char*   pw_shell;
        time_t  pw_expire;
    }
}
else version( FreeBSD )
{
    struct passwd
    {
		char*   pw_name;		/* user name */
		char*   pw_passwd;		/* encrypted password */
		uid_t	pw_uid;			/* user uid */
		gid_t	pw_gid;			/* user gid */
		time_t	pw_change;		/* password change time */
		char*   pw_class;		/* user access class */
		char*   pw_gecos;		/* Honeywell login info */
		char*   pw_dir;		/* home directory */
		char*   pw_shell;		/* default shell */
		time_t	pw_expire;		/* account expiration */
		int	pw_fields;		/* internal: fields filled in */
    }
}
else version( solaris )
{
	struct passwd
	{
		char*	pw_name;
		char*	pw_passwd;
		uid_t	pw_uid;
		gid_t	pw_gid;
		char*	pw_age;
		char*	pw_comment;
		char*	pw_gecos;
		char*	pw_dir;
		char*	pw_shell;
	}
}
passwd* getpwnam(in char*);
passwd* getpwuid(uid_t);

//
// Thread-Safe Functions (TSF)
//
/*
int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
*/

version( linux )
{
    int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
    int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
}
else version( darwin )
{
    int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
    int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
}
else version( FreeBSD )
{
    int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
    int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
}
else version( solaris )
{
    int getpwnam_r(in char*, passwd*, char*, size_t, passwd**);
    int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
}
//
// XOpen (XSI)
//
/*
void    endpwent();
passwd* getpwent();
void    setpwent();
*/

version( linux )
{
    void    endpwent();
    passwd* getpwent();
    void    setpwent();
}
else version ( darwin )
{
    void    endpwent();
    passwd* getpwent();
    void    setpwent();
}
else version (FreeBSD)
{
    void    endpwent();
    passwd* getpwent();
    void    setpwent();
}
else version ( solaris )
{
    void    endpwent();
    passwd* getpwent();
    void    setpwent();
}