|
|
1.1 root 1: .TH GETPWENT 3
2: .CT 2 secur
3: .SH NAME
4: getpwent, getpwuid, getpwnam, setpwent, endpwent, pwdecode \(mi get password file entry
5: .SH SYNOPSIS
6: .nf
7: .B #include <pwd.h>
8: .PP
9: .B struct passwd *getpwent()
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 int setpwent()
18: .PP
19: .B int endpwent()
20: .PP
21: .B struct passwd *pwdecode(p)
22: .B char *p;
23: .fi
24: .SH DESCRIPTION
25: .I Getpwent,
26: .I getpwuid
27: and
28: .I getpwnam
29: each return a pointer to a structure
30: containing the broken-out
31: fields of a line in
32: .FR /etc/passwd .
33: .EX
34: .ta \w'struct 'u +\w'passwd 'u +\w'*pw_comment; 'u
35: struct passwd {
36: \fLchar *pw_name;\fR login name
37: \fLchar *pw_passwd;\fP encrypted password
38: \fLint pw_uid;\fP numeric userid
39: \fLint pw_gid;\fP numeric groupid
40: \fLint pw_quota;\fP unused
41: \fLchar *pw_comment;\fP unused
42: \fLchar *pw_gecos;\fP field for local use
43: \fLchar *pw_dir;\fP login directory
44: \fLchar *pw_shell;\fP program to use as Shell
45: \fL};\fP
46: .EE
47: .PP
48: .I Getpwent
49: reads the next
50: line (opening the file if necessary);
51: .I setpwent
52: rewinds the file;
53: .I endpwent
54: closes it.
55: .PP
56: .I Getpwuid
57: and
58: .I getpwnam
59: search from the beginning until a matching
60: .I uid
61: or
62: .I name
63: is found
64: (or until end-of-file is encountered).
65: .PP
66: .I Pwdecode
67: breaks out a null-terminated character string
68: .I p
69: containing a password file entry.
70: The input string is modified by the call and
71: the output structure contains pointers into it.
72: .SH FILES
73: .TP
74: .F /etc/passwd
75: .SH "SEE ALSO"
76: .IR getlogin (3),
77: .IR getgrent (3),
78: .IR passwd (5)
79: .SH DIAGNOSTICS
80: These routines return 0 for end of file or error.
81: .SH BUGS
82: The return values point to static data
83: whose content is overwritten by each call.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.