2 * Lookup a group by name
9 int main(int argc
, char **argv
)
16 printf("ERROR: no arg specified\n");
22 if ((gr
= getgrnam(argv
[1])) == NULL
) {
23 printf("FAIL: group %s does not exist\n", argv
[1]);
27 /* Print group info */
29 printf("PASS: group %s exists\n", argv
[1]);
30 printf("gr_name = %s\n", gr
->gr_name
);
31 printf("gr_passwd = %s\n", gr
->gr_passwd
);
32 printf("gr_gid = %d\n", gr
->gr_gid
);
34 /* Group membership */
36 if (gr
->gr_mem
!= NULL
) {
40 while(gr
->gr_mem
[i
] != NULL
) {
41 printf("%s", gr
->gr_mem
[i
]);
43 if (gr
->gr_mem
!= NULL
) {