2 * Lookup a user by uid.
9 int main(int argc
, char **argv
)
17 printf("ERROR: no arg specified\n");
21 if ((uid
= atoi(argv
[1])) == 0) {
22 printf("ERROR: invalid uid specified\n");
28 if ((pw
= getpwuid(uid
)) == NULL
) {
29 printf("FAIL: uid %d does not exist\n", uid
);
33 printf("PASS: uid %d exists\n", uid
);
34 printf("pw_name = %s\n", pw
->pw_name
);
35 printf("pw_passwd = %s\n", pw
->pw_passwd
);
36 printf("pw_uid = %d\n", pw
->pw_uid
);
37 printf("pw_gid = %d\n", pw
->pw_gid
);
38 printf("pw_gecos = %s\n", pw
->pw_gecos
);
39 printf("pw_dir = %s\n", pw
->pw_dir
);
40 printf("pw_shell = %s\n", pw
->pw_shell
);