getpwent.3
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3 代码 · 共 151 行
3
151 行
.\" SCCSID: @(#)getpwent.3 8.2 12/3/90.TH getpwent 3 .SH Namegetpwent, getpwuid, getpwnam, setpwent, endpwent, setpwfile \- get password entry.SH Syntax.nf.B #include <pwd.h>.PP.B struct passwd *getpwent().PP.B struct passwd *getpwuid(\fIuid\fP).B uid_t \fIuid\fP;.PP.B struct passwd *getpwnam(\fIname\fP).B char *\fIname\fP;.PP.B void setpwent().PP.B void endpwent().PP.B void setpwfile(\fIpathname\fP).B char *\fIpathname\fP.fi.SH Description.NXR "getpwent subroutine".NXR "getpwuid subroutine".NXR "getpwnam subroutine".NXR "setpwent subroutine".NXR "endpwent subroutine".NXR "setpwfile subroutine".NXA "getpwent subroutine" "putpwent subroutine".NXR "password file (general)" "getting entry"The routines,.PN getpwent ,.PN getpwuidand.PN getpwnam ,each return a pointer to an object with thefollowing structurecontaining the broken-outfields of a line in the password database:.EXstruct passwd { /* see getpwent(3) */ char *pw_name; char *pw_passwd; uid_t pw_uid; gid_t pw_gid; int pw_quota; char *pw_comment; char *pw_gecos; char *pw_dir; char *pw_shell;};struct passwd *getpwent(), *getpwuid(), *getpwnam();.EE.PPThe fields.I pw_quotaand.I pw_commentare unused; the others have meanings described in.MS passwd 5 ..PPA call to.PN setpwenthas the effect of rewindingthe password fileto allowrepeated searches..PN Endpwentmay be called toclose the password databasewhen processing is complete..PPThe.PN getpwentsubroutine simply retrieves the nextentry while.PN getpwuidand.PN getpwnamsearch until a matching.I uidor.I nameis found(or until all entries are exhausted).The.PN getpwentsubroutine keeps a pointer in the database, allowingsuccessive calls to be used to search the entire database..PPA call to .PN setpwentmust be made before a .PN whileloop using .PN getpwentin order to perform initialization and an.PN endpwentmust be used after the loop. Both.PN getpwuidand .PN getpwnammake calls to .PN setpwent and .PN endpwent ..PPThe.PN setpwfilesubroutine sets the pathname of the ASCII passwd file and optional hashed database tobe used for local passwd lookups.If a passwd file has been left open by a call to.PN setpwentor.PN getpwent ,.PN setpwfilewill close it first..PN Setpwfiledoes not directly affect the use of distributed passwd databases..SH Restrictions.NXR "getpwent subroutine" "restrictions"All information is contained in a static areaso it must be copied if it is to be saved..PPIf YP is running, .PN getpwentdoes not return the entries in any particular order.See the.I Guide to the Yellow Pages Servicefor setup information..PPThe password database may also be distributed via the BIND/Hesiodnaming service. See the.I Guide to the BIND/Hesiod Servicefor more information..SH Return ValuesNull pointer(0) returned on EOF or error..SH Files.PN /etc/passwd.SH See Alsogetlogin(3), passwd(5), svc.conf(5).br.I Guide to the BIND/Hesiod Service.br.I Guide to the Yellow Pages Service
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?