2 * Lookup a group by gid.
9 int main(int argc
, char **argv
)
17 printf("ERROR: no arg specified\n");
21 if ((gid
= atoi(argv
[1])) == 0) {
22 printf("ERROR: invalid gid specified\n");
28 if ((gr
= getgrgid(gid
)) == NULL
) {
29 printf("FAIL: gid %d does not exist\n", gid
);
33 /* Print group info */
35 printf("PASS: gid %d exists\n", gid
);
36 printf("gr_name = %s\n", gr
->gr_name
);
37 printf("gr_passwd = %s\n", gr
->gr_passwd
);
38 printf("gr_gid = %d\n", gr
->gr_gid
);
40 /* Group membership */
42 if (gr
->gr_mem
!= NULL
) {
46 while(gr
->gr_mem
[i
] != NULL
) {
47 printf("%s", gr
->gr_mem
[i
]);
49 if (gr
->gr_mem
!= NULL
) {