s3:smbd: s/event_add_fd/tevent_add_fd and s/EVENT_FD_/TEVENT_FD_
[Samba/gebeck_regimport.git] / testsuite / nsswitch / getpwnam.c
blobe7dd2910b66443f8a2d1dff941057bb72efdb12f
1 /*
2 * Lookup a user by name
3 */
5 #include <stdio.h>
6 #include <pwd.h>
7 #include <sys/types.h>
9 int main(int argc, char **argv)
11 struct passwd *pw;
13 /* Check args */
15 if (argc != 2) {
16 printf("ERROR: no arg specified\n");
17 exit(1);
20 /* Do getpwnam() */
22 if ((pw = getpwnam(argv[1])) == NULL) {
23 printf("FAIL: user %s does not exist\n", argv[1]);
24 exit(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);
36 exit(0);