GETPWNAM(3C-POSIX) RISC/os Reference Manual GETPWNAM(3C-POSIX)
NAME
getpwnam, getpwuid - get password file entry
SYNOPSIS
#include <pwd.h>
struct passwd *getpwnam (name)
char *name;
struct passwd *getpwuid (uid)
uidt uid;
DESCRIPTION
getpwnam and getpwuid each 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;
uid_t pw_uid;
uid_t pw_gid;
char *pw_age;
char *pw_comment;
char *pw_gecos;
char *pw_dir;
char *pw_shell;
};
The fields have meanings described in passwd(4).
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 particular structure in which it was found.
If an end-of-file or an error is encountered on reading,
these functions return a NULL pointer.
RETURN VALUES
A NULL pointer is returned on EOF or error.
FILES
/etc/passwd
SEE ALSO
getlogin(3C), getgrgid(3C), passwd(4).
Printed 1/15/91 Page 1
GETPWNAM(3C-POSIX) RISC/os Reference Manual GETPWNAM(3C-POSIX)
WARNING
The above routines use <stdio.h>, which causes them to
increase the size of programs, not otherwise using standard
I/O, more than might be expected.
CAVEAT
All information is contained in a static area, so it must be
copied if it is to be saved. The structure contains
pointers, and this data must also be saved.
Page 2 Printed 1/15/91