2 * Lookup a user by name
9 int main(int argc
, char **argv
)
16 printf("ERROR: no arg specified\n");
22 if ((pw
= getpwnam(argv
[1])) == NULL
) {
23 printf("FAIL: user %s does not exist\n", argv
[1]);
27 printf("PASS: user %s exists\n", argv
[1]);
28 printf("pw_name = %s\n", pw
->pw_name
);
29 printf("pw_passwd = %s\n", pw
->pw_passwd
);
30 printf("pw_uid = %d\n", pw
->pw_uid
);
31 printf("pw_gid = %d\n", pw
->pw_gid
);
32 printf("pw_gecos = %s\n", pw
->pw_gecos
);
33 printf("pw_dir = %s\n", pw
->pw_dir
);
34 printf("pw_shell = %s\n", pw
->pw_shell
);