summaryrefslogtreecommitdiffstats
path: root/man3/getgrouplist.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/getgrouplist.3')
-rw-r--r--man3/getgrouplist.327
1 files changed, 13 insertions, 14 deletions
diff --git a/man3/getgrouplist.3 b/man3/getgrouplist.3
index 0fe3690..33e344d 100644
--- a/man3/getgrouplist.3
+++ b/man3/getgrouplist.3
@@ -7,7 +7,7 @@
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
-.TH getgrouplist 3 2023-07-20 "Linux man-pages 6.05.01"
+.TH getgrouplist 3 2024-03-16 "Linux man-pages 6.7"
.SH NAME
getgrouplist \- get list of groups to which a user belongs
.SH LIBRARY
@@ -16,16 +16,16 @@ Standard C library
.SH SYNOPSIS
.nf
.B #include <grp.h>
-.PP
+.P
.BI "int getgrouplist(const char *" user ", gid_t " group ,
.BI " gid_t *" groups ", int *" ngroups );
.fi
-.PP
+.P
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
-.PP
+.P
.BR getgrouplist ():
.nf
Since glibc 2.19:
@@ -45,7 +45,7 @@ Up to
.I *ngroups
of these groups are returned in the array
.IR groups .
-.PP
+.P
If it was not among the groups defined for
.I user
in the group database, then
@@ -55,7 +55,7 @@ is included in the list of groups returned by
typically this argument is specified as the group ID from
the password record for
.IR user .
-.PP
+.P
The
.I ngroups
argument is a value-result argument:
@@ -73,7 +73,7 @@ is a member is less than or equal to
then the value
.I *ngroups
is returned.
-.PP
+.P
If the user is a member of more than
.I *ngroups
groups, then
@@ -97,7 +97,6 @@ T{
.BR getgrouplist ()
T} Thread safety MT-Safe locale
.TE
-.sp 1
.SH STANDARDS
None.
.SH HISTORY
@@ -119,7 +118,7 @@ The second command-line argument specifies the
value to be supplied to
.BR getgrouplist ().
The following shell session shows examples of the use of this program:
-.PP
+.P
.in +4n
.EX
.RB "$" " ./a.out cecilia 0"
@@ -143,10 +142,10 @@ ngroups = 3
int
main(int argc, char *argv[])
{
- int ngroups;
- struct passwd *pw;
- struct group *gr;
- gid_t *groups;
+ int ngroups;
+ gid_t *groups;
+ struct group *gr;
+ struct passwd *pw;
\&
if (argc != 3) {
fprintf(stderr, "Usage: %s <user> <ngroups>\en", argv[0]);
@@ -180,7 +179,7 @@ main(int argc, char *argv[])
/* Display list of retrieved groups, along with group names. */
\&
fprintf(stderr, "ngroups = %d\en", ngroups);
- for (size_t j = 0; j < ngroups; j++) {
+ for (int j = 0; j < ngroups; j++) {
printf("%d", groups[j]);
gr = getgrgid(groups[j]);
if (gr != NULL)