ualarm
[unix-history] / usr / src / lib / libc / gen / getpwent.3
... / ...
CommitLineData
1.\" @(#)getpwent.3 6.2 (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 *getpwent()
12.PP
13.B struct passwd *getpwuid(uid)
14.B int uid;
15.PP
16.B struct passwd *getpwnam(name)
17.B char *name;
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
51.I Getpwent
52reads the next
53line (opening the file if necessary);
54.I setpwent
55rewinds the file;
56.I endpwent
57closes it.
58.PP
59.I Setpwfile
60changes the default password file to
61.I name
62thus allowing alternate password files to be used.
63Note that it does
64.I not
65close the previous file.
66If this is desired,
67.I endpwent
68should be called prior to it.
69.PP
70.I Getpwuid
71and
72.I getpwnam
73search from the beginning until a matching
74.I uid
75or
76.I name
77is found
78(or until EOF is encountered).
79.SH FILES
80/etc/passwd
81.SH "SEE ALSO"
82getlogin(3), getgrent(3), passwd(5)
83.SH DIAGNOSTICS
84The routines
85.IR getpwent ,
86.IR getpwuid ,
87and
88.IR getpwnam ,
89return a null pointer (0) on EOF or error.
90.SH BUGS
91All information
92is contained in a static area
93so it must be copied if it is
94to be saved.