Annotation of 43BSDTahoe/man/man3/getgrent.3, revision 1.1.1.1

1.1       root        1: .\"    @(#)getgrent.3  6.2 (Berkeley) 11/5/87
                      2: .\"
                      3: .TH GETGRENT 3  "November 5, 1987"
                      4: .AT 3
                      5: .SH NAME
                      6: getgrent, getgrgid, getgrnam, setgrent, endgrent setgrfile \- get group file entry
                      7: .SH SYNOPSIS
                      8: .nf
                      9: .B #include <grp.h>
                     10: .PP
                     11: .B struct group *getgrent()
                     12: .PP
                     13: .B struct group *getgrgid(gid)
                     14: .B int gid;
                     15: .PP
                     16: .B struct group *getgrnam(name)
                     17: .B char *name;
                     18: .PP
                     19: .B setgrent()
                     20: .PP
                     21: .B endgrent()
                     22: .PP
                     23: .B setgrfile(name)
                     24: .B char *name;
                     25: .fi
                     26: .SH DESCRIPTION
                     27: .I Getgrent,
                     28: .I getgrgid
                     29: and
                     30: .I getgrnam
                     31: each return pointers
                     32: to an object
                     33: with the following structure
                     34: containing the broken-out
                     35: fields of a line in the group file.
                     36: .RS
                     37: .PP
                     38: .nf
                     39: .so /usr/include/grp.h
                     40: .fi
                     41: .RE
                     42: .PP
                     43: The members of this structure are:
                     44: .TP \w'gr_passwd'u+2n
                     45: gr_name
                     46: The name of the group.
                     47: .br
                     48: .ns
                     49: .TP \w'gr_passwd'u+2n
                     50: gr_passwd
                     51: The encrypted password of the group.
                     52: .br
                     53: .ns
                     54: .TP \w'gr_passwd'u+2n
                     55: gr_gid
                     56: The numerical group-ID.
                     57: .br
                     58: .ns
                     59: .TP \w'gr_passwd'u+2n
                     60: gr_mem
                     61: Null-terminated vector
                     62: of pointers to the individual
                     63: member names.
                     64: .PP
                     65: .I Getgrent
                     66: simply reads the next
                     67: line while
                     68: .I getgrgid
                     69: and
                     70: .I getgrnam
                     71: search until a matching
                     72: .I gid
                     73: or
                     74: .I name
                     75: is found
                     76: (or until EOF is encountered).
                     77: Each routine picks up
                     78: where the others leave off
                     79: so successive calls may be used
                     80: to search the entire file.
                     81: .PP
                     82: A call to
                     83: .I setgrent
                     84: has the effect of rewinding
                     85: the group file
                     86: to allow
                     87: repeated searches.
                     88: .I Endgrent
                     89: may be called to
                     90: close the group file
                     91: when processing is complete.
                     92: .PP
                     93: \fISetgrfile\fP changes the default group file to \fIname\fP thus allowing
                     94: alternate grioup files to be used.  Note that it does \fInot\fP close the
                     95: previous file.  If this is desired, \fIendgrent\fP should be called prior
                     96: to it.
                     97: .SH FILES
                     98: /etc/group
                     99: .SH "SEE ALSO"
                    100: getlogin(3), getpwent(3), group(5)
                    101: .SH DIAGNOSTICS
                    102: A null pointer
                    103: (0) is returned on EOF or error.
                    104: .SH BUGS
                    105: All information is contained in a static area so it must be copied if it is
                    106: to be saved.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.