man(1) Manual page archive


     GETPWENT(3)                                           GETPWENT(3)

     NAME
          getpwent, getpwuid, getpwnam, setpwent, endpwent, pwdecode -
          get password file entry

     SYNOPSIS
          #include <pwd.h>

          struct passwd *getpwent()

          struct passwd *getpwuid(uid)
          int uid;

          struct passwd *getpwnam(name)
          char *name;

          int setpwent()

          int endpwent()

          struct passwd *pwdecode(p)
          char *p;

     DESCRIPTION
          Getpwent, getpwuid and getpwnam each return a pointer to a
          structure containing the broken-out fields of a line in
          struct passwd {
                 char   *pw_name;    login name
                 char   *pw_passwd;  encrypted password
                 int    pw_uid;      numeric userid
                 int    pw_gid;      numeric groupid
                 int    pw_quota;    unused
                 char   *pw_comment; unused
                 char   *pw_gecos;   field for local use
                 char   *pw_dir;     login directory
                 char   *pw_shell;   program to use as Shell
          };

          Getpwent reads the next line (opening the file if neces-
          sary); setpwent rewinds the file; endpwent closes it.

          Getpwuid and getpwnam search from the beginning until a
          matching uid or name is found (or until end-of-file is
          encountered).

          Pwdecode breaks out a null-terminated character string p
          containing a password file entry.  The input string is modi-
          fied by the call and the output structure contains pointers
          into it.

     FILES

     GETPWENT(3)                                           GETPWENT(3)

          overwritten by each call.