.TH getpwnam() "" "" "General Function (libc)"
.PC "Get password file information, by name"
.B "#include <pwd.h>"
\fBstruct passwd *getpwnam(\fIuname\^\fB)\fR
\fBchar *\fIuname\^\fB;\fR
.PP
The \*(CO system has five
routines that search the file
.BR /etc/passwd ,
which contains information about every user of the system.
The returned structure
.B passwd
is defined in the header file
.BR pwd.h .
For a description of this structure, see
.BR pwd.h .
.PP
.B getpwnam()
attempts to find the first entry with a name of
.IR uname .
.SH Example
For an example of this function, see the entry for
.BR getpwent() .
.SH Files
.B /etc/passwd
.br
.B pwd.h
.SH "See Also"
.Xr "libc" libc
.br
\*(PX Standard, \(sc9.2.2
.SH Diagnostics
.B getpwnam()
returns NULL for any error or on end of file.
.SH Notes
All structures and information returned are
in static areas internal to
.BR getpwnam() .
Therefore, information from a previous call is overwritten by each
subsequent call.
.PP
If your system has implemented shadow passwords, you must use the
shadow-password routine
.B getspnam()
to retrieve records that contain passwords.
For details, see this function's entry in the Lexicon.
