#ifndef _PWD_H
#define _PWD_H

#include <sys/types.h>

/* Structure representing a password file entry. */
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;
};

#ifdef __cplusplus
extern "C"
{
#endif

    /* Returns the next password file entry. */
    struct passwd* getpwent(void);

    /* Returns the first password file entry with a login name matching name, or NULL if there are none. */
    struct passwd* getpwnam(const char* name);

    /* Returns the first password file entry with a user ID matching uid, or NULL if there are none. */
    struct passwd* getpwuid(uid_t uid);

    /* Rewinds to the first password file entry. */
    void setpwent(void);

    /* Ends password file processing. */
    void endpwent(void);

#ifdef __cplusplus
}
#endif

#endif