added latency tool
[tridge/junkcode.git] / getpwuid.c
1 #include <stdio.h>
2 #include <pwd.h>
3 #include <sys/types.h>
4
5 static void print_passwd(struct passwd *pwd)
6 {
7         printf("%s:%s:%d:%d:%s:%s:%s\n", 
8                pwd->pw_name,
9                pwd->pw_passwd,
10                pwd->pw_uid,
11                pwd->pw_gid,
12                pwd->pw_gecos,
13                pwd->pw_dir,
14                pwd->pw_shell);
15 }
16
17 int main(int argc, char *argv[])
18 {
19         struct passwd *pwd;
20
21         pwd = getpwuid(atoi(argv[1]));
22
23         if (!pwd) {
24                 printf("Failed to fetch pwd\n");
25         } else {
26                 print_passwd(pwd);
27         }
28         return 0;
29 }