Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getpwent(3C) — DG/UX 5.4.2A

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ypserv(1M)

getlogin(3C)

getgrent(3C)

passwd(4)



getpwent(3C)                     DG/UX 5.4.2                    getpwent(3C)


NAME
       getpwent, getpwuid, getpwnam, setpwent, endpwent, setpwfile,
       fgetpwent - manipulate password file entry

SYNOPSIS
       #include <pwd.h>

       struct passwd *getpwuid(uid_t uid);

       struct passwd *getpwnam(const char *name);

       struct passwd *getpwent(void);

       setpwent(void);

       endpwent(void);

       setpwfile(char *name);

       struct passwd *fgetpwent(FILE *f);

DESCRIPTION
       getpwent, getpwuid and getpwnam each return a pointer to an object
       with the following structure containing the broken-out fields of a
       line in the password stream.  The password stream consists of the
       /etc/passwd file and optionally the Network Information Services
       (NIS) password database.

              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;
              };

              struct comment {
                   char *c_dept;
                   char *c_name;
                   char *c_acct;
                   char *c_bin;
              };

       The pwcomment field is not used; the others have meanings  described
       in passwd(5).

       setpwent  opens  the  database;  endpwent  closes  it.   getpwuid and
       getpwnam search the database (opening it if necessary) for a matching
       uid or name.  EOF is returned if there is no entry.




Licensed material--property of copyright holder(s)                         1




getpwent(3C)                     DG/UX 5.4.2                    getpwent(3C)


       For  programs wishing to read the entire database, getpwent reads the
       next line (opening  the  database  if  necessary).   In  addition  to
       opening the database, setpwent can be used to make getpwent begin its
       search from the beginning of the database.

       setpwfile changes the default password file  to  name  thus  allowing
       alternate password files to be used.  Note that it does not close the
       previous file.  If this is desired, endpwent should be  called  prior
       to it.

       fgetpwent  returns  a  pointer  to  the  next passwd structure in the
       stream f, which matches the format of the password file  /etc/passwd.

FILES
       /etc/passwd

DIAGNOSTICS
       The  routines  getpwent,  getpwuid, getpwnam, and fgetpwent, return a
       null pointer (0) on EOF or error.

SEE ALSO
       ypserv(1M), getlogin(3C), getgrent(3C), passwd(4).

BUGS
       All information is contained in a static area, so it must  be  copied
       if it is to be saved.

STANDARDS
       When  using  m88kbcs  as the Software Development Environment target,
       the functions mentioned above will  be  implemented  on  top  of  the
       bcscat  command.   Because of this, some performance degradation may
       be noticed in comparison to using these routines in /lib/libc.a.

























Licensed material--property of copyright holder(s)                         2


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026