Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ setpwent(3C) — svr4 — mips UMIPS RISC/os 5.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getlogin(3C)

getgrent(3C)

passwd(4)



GETPWENT(3C-SVR4)   RISC/os Reference Manual    GETPWENT(3C-SVR4)



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

SYNOPSIS
     #include <pwd.h>

     struct passwd *getpwent (void);

     struct passwd *getpwuid (uidt uid);

     struct passwd *getpwnam (const char *name);

     void setpwent (void);

     void endpwent (void);

     struct passwd *fgetpwent (FILE *f);

DESCRIPTION
     getpwent, getpwuid, and getpwnam each returns a pointer to
     an object with the following structure containing the
     broken-out fields of a line in the /etc/passwd file.  Each
     line in the file contains a passwd structure, declared in
     the pwd.h header file:

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

     getpwent when first called returns a pointer to the first
     passwd structure in the file; thereafter, it returns a
     pointer to the next passwd structure in the file; so succes-
     sive calls can be used to search the entire file.  getpwuid
     searches from the beginning of the file until a numerical
     user id matching uid is found and returns a pointer to the
     particular structure in which it was found.  getpwnam
     searches from the beginning of the file until a login name
     matching name is found, and returns a pointer to the partic-
     ular structure in which it was found.  If an end-of-file or
     an error is encountered on reading, these functions return a
     null pointer.





                        Printed 11/19/92                   Page 1





GETPWENT(3C-SVR4)   RISC/os Reference Manual    GETPWENT(3C-SVR4)



     A call to setpwent has the effect of rewinding the password
     file to allow repeated searches.  endpwent may be called to
     close the password file when processing is complete.

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

FILES
     /etc/passwd

SEE ALSO
     getlogin(3C), getgrent(3C).
     passwd(4) in the System Administrator's Reference Manual.

DIAGNOSTICS
     getpwent, getpwnid, getpwnam, and fgetpwent return a null
     pointer on EOF or error.

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


































 Page 2                 Printed 11/19/92



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