Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ endpwent(3) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                              getpwent(3)



        _________________________________________________________________
        getpwent, getpwuid, getpwnam, setpwent, endpwent,      Subroutine
        fgetpwent
        get password file entry
        _________________________________________________________________


        SYNTAX

        #include <pwd.h>

        struct passwd *getpwent ( )

        struct passwd *getpwuid (uid)
        int uid;

        struct passwd *getpwnam (name)
        char *name;

        void setpwent ( )

        void endpwent ( )

        struct passwd *fgetpwent (f)
        FILE *f;


        DESCRIPTION

        Getpwent, getpwuid, and getpwnam return 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;
                  int  pw_uid;
                  int  pw_gid;
                  char *pw_age;
                  char *pw_comment;
                  char *pw_gecos;
                  char *pw_dir;
                  char *pw_shell;
             };

        This structure is declared in <pwd.h> so you don't need to
        redeclare it.

        The pw_comment field is unused; the others have meanings
        described in passwd(4).



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                              getpwent(3)



        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.  You can use successive calls
        to search the entire file.

        Getpwuid searches from the beginning of the file until it finds a
        numerical user id matching uid.  It returns a pointer to the
        structure where it found the match.

        Getpwnam searches from the beginning of the file until it finds a
        login name matching name.  It returns a pointer to the structure
        where it found the match.

        Setpwent rewinds the password file. You can use it to make
        repeated searches.

        Endpwent closes the password file.

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


        ERRORS

        If an end-of-file or an error is encountered on reading,
        getpwent, getpwuid, getpwnam, and fgetpwent return a NULL
        pointer.



        FILES

        /etc/passwd


        SEE ALSO

        getlogin(3C), getgrent(3C), passwd(4).


        DIAGNOSTICS

        A NULL pointer is returned on EOF or error.


        WARNING

        The above routines use <stdio.h>, which causes them to increase
        the size of programs that don't otherwise use standard I/O. The
        size increases more than you might expect.




        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)





                                                              getpwent(3)



        CAVEAT

        All information is contained in a static area, so you have to
        copy it if you want to save it.


















































        DG/UX 4.00                                                 Page 3
               Licensed material--property of copyright holder(s)



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