getfstype has been removed
[unix-history] / usr / src / lib / libc / gen / getpwent.3
... / ...
CommitLineData
1.\" @(#)getpwent.3 6.3 (Berkeley) %G%
2.\"
3.TH GETPWENT 3 ""
4.AT 3
5.SH NAME
6getpwent, getpwuid, getpwnam, setpwent, endpwent, setpwfile \- get password file entry
7.SH SYNOPSIS
8.nf
9.B #include <pwd.h>
10.PP
11.B struct passwd *getpwuid(uid)
12.B int uid;
13.PP
14.B struct passwd *getpwnam(name)
15.B char *name;
16.PP
17.B struct passwd *getpwent()
18.PP
19.B setpwent()
20.PP
21.B endpwent()
22.PP
23.B setpwfile(name)
24.B char *name;
25.fi
26.SH DESCRIPTION
27.I Getpwent,
28.I getpwuid
29and
30.I getpwnam
31each return a pointer to an object with the
32following structure
33containing the broken-out
34fields of a line in the password file.
35.RS
36.PP
37.nf
38.so /usr/include/pwd.h
39.ft R
40.ad
41.fi
42.RE
43.PP
44The fields
45.I pw_quota
46and
47.I pw_comment
48are unused; the others have meanings described in
49.IR passwd (5).
50.PP
51Searching of the password file is done using the \fIndbm\fP
52database access routines.
53.I Setpwent
54opens the database;
55.I endpwent
56closes it.
57.I Getpwuid
58and
59.I getpwnam
60search the database (opening it if necessary) for a matching
61.I uid
62or
63.IR name .
64EOF is returned if there is no entry.
65.PP
66For programs wishing to read the entire database,
67.I getpwent
68reads the next
69line (opening the database if necessary).
70In addition to opening the database,
71.I setpwent
72can be used to make
73.I getpwent
74begin its search from the beginning of the database.
75.PP
76.I Setpwfile
77changes the default password file to
78.I name
79thus allowing alternate password files to be used.
80Note that it does
81.I not
82close the previous file.
83If this is desired,
84.I endpwent
85should be called prior to it.
86.SH FILES
87/etc/passwd
88.SH "SEE ALSO"
89getlogin(3), getgrent(3), passwd(5)
90.SH DIAGNOSTICS
91The routines
92.IR getpwent ,
93.IR getpwuid ,
94and
95.IR getpwnam ,
96return a null pointer (0) on EOF or error.
97.SH BUGS
98All information
99is contained in a static area
100so it must be copied if it is
101to be saved.