Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getpwent(3) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getgrent, getgrgid, getgrnam, setgrent, endgrent

getlogin

putpwent

getpwent, getpwuid, getpwnam, setpwent, endpwent

Purpose

     Gets a password file entry.

Library

     Standard C Library (libc.a)

Syntax

     #include <pwd.h>

     struct passwd *getpwent ( )               void setpwent ( )

     struct passwd *getpwuid (uid)             void endpwent ( )
     int uid;

     struct passwd *getpwnam (name)
     char *name;
     Description

     The getpwent, getpwuid, and getpwnam subroutines return a
     pointer to  a structure containing the  broken-out fields
     of a line in the  /etc/passwd file.  The passwd structure
     is defined in the pwd.h  header file, and it contains the
     following members:

          char  *pw_name;
          char  *pw_passwd;
          int   pw_uid;
          int   pw_gid;
          char  *pw_age;
          char  *pw_comment;
          char  *pw_etc;
          char  *pw_dir;
          char  *pw_shell;

     The pw_comment field is  unused; the others have meanings
     described in "passwd."

     The  getpwent subroutine,  when first  called, returns  a
     pointer to  the first passwd  structure in the  file.  On
     the next  call, it returns  a pointer to the  next passwd
     structure in  the file. Successive  calls can be  used to
     search the entire file.

     The getpwuid  subroutine searches  from the  beginning of
     the file until it finds  a numerical user ID matching the
     uid parameter.  The subroutine  then returns a pointer to
     the structure in which it was found.

     The getpwnam  subroutine searches  from the  beginning of
     the file  until it finds  a login name matching  the name

     parameter.  The search is made using flattened names; the
     characters of the name searched  for are the ASCII equiv-
     alent character (see "Overview of International Character
     Support" in Managing the AIX Operating System).  The sub-
     routine then returns a pointer  to the structure in which
     it was found.

     If an end-of-file condition or an error is encountered on
     reading, these functions return a NULL pointer.

     The  setpwent subroutine  rewinds  the  password file  to
     allow repeated searches.

     The endpwent subroutine closes  the group file when proc-
     essing is complete.

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

     File

     /etc/passwd

     Related Information

     In this  book:  "getgrent, getgrgid,  getgrnam, setgrent,
     endgrent." "getlogin," and "putpwent."

     "Overview of International Character Support" in Managing
     the AIX Operating System.

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