getgrent.3
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3 代码 · 共 150 行
3
150 行
.\" SCCSID: @(#)getgrent.3 8.2 1/28/91.\".TH getgrent 3 .SH Namegetgrent, getgrgid, getgrnam, setgrent, endgrent \- get group entry.SH Syntax.nf.B #include <grp.h>.PP.B struct group *getgrent().PP.B struct group *getgrgid(\fIgid\fP).B gid_t \fIgid\fP;.PP.B struct group *getgrnam(\fIname\fP).B char *\fIname\fP;.PP.B void setgrent().PP.B void endgrent().fi.SH Description.NXR "getgrent subroutine".NXR "getgrgid subroutine".NXR "getgrnam subroutine".NXR "setgrent subroutine".NXR "endgrent subroutine".NXR "group file (general)" "getting entry"The.PN getgrent ,.PN getgrgidand.PN getgrnamsubroutines each return pointersto an objectwith the following structurecontaining the broken-outfields of a line in the group database:.EXstruct group { /* see getgrent(3) */ char *gr_name; char *gr_passwd; int gr_gid; char **gr_mem;};struct group *getgrent(), *getgrgid(), *getgrnam();.EE.PPThe members of this structure are:.TP \w'gr_passwd'u+2ngr_nameThe name of the group..br.ns.TP \w'gr_passwd'u+2ngr_passwdThe encrypted password of the group..br.ns.TP \w'gr_passwd'u+2ngr_gidThe numerical group-ID..br.ns.TP \w'gr_passwd'u+2ngr_memNull-terminated vectorof pointers to the individualmember names..PPA call to.PN setgrenthas the effect of rewindingthe group fileto allowrepeated searches.The.PN endgrentmay be called toclose the group databasewhen processing is complete..PPThe.PN getgrentsubroutine simply reads the nextline while.PN getgrgidand.PN getgrnamsearch until a matching.I gidor.I nameis found(or until EOF is encountered).The.PN getgrentsubroutine keeps a pointer in the database, allowingsuccessive calls to be used to search the entire file..PPA call to .PN setgrentmust be made before a .PN whileloop using .PN getgrentin order to perform initialization and an.PN endgrentmust be used after the loop. Both.PN getgrgidand .PN getgrnammake calls to .PN setgrent and .PN endgrent ..SH Restrictions.NXR "getgrent subroutine" "restrictions"All informationis contained in a static areaso it must be copied if it isto be saved..PPIf YP is running, .PN getgrentdoes not return the entries in any particular order.See the .I Guide to the Yellow Pages Service for setup information..PPThe group database may also be distributed via the BIND/Hesiodnaming service. See the.I Guide to the BIND/Hesiod Servicefor more information..SH Return ValuesA null pointer(0) is returned on EOF or error..SH Files.PN /etc/group.SH See Alsogroup(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 + -
显示快捷键?