11 struct passwd
*my_passwd
;
12 struct group
*my_group
;
15 /* Get information about the user ID. */
17 my_passwd
= getpwuid (me
);
20 printf ("Couldn't find out about user %d.\n", (int) me
);
24 /* Print the information. */
25 printf ("I am %s.\n", my_passwd
->pw_gecos
);
26 printf ("My login name is %s.\n", my_passwd
->pw_name
);
27 printf ("My uid is %d.\n", (int) (my_passwd
->pw_uid
));
28 printf ("My home directory is %s.\n", my_passwd
->pw_dir
);
29 printf ("My default shell is %s.\n", my_passwd
->pw_shell
);
31 /* Get information about the default group ID. */
32 my_group
= getgrgid (my_passwd
->pw_gid
);
35 printf ("Couldn't find out about group %d.\n",
36 (int) my_passwd
->pw_gid
);
40 /* Print the information. */
41 printf ("My default group is %s (%d).\n",
42 my_group
->gr_name
, (int) (my_passwd
->pw_gid
));
43 printf ("The members of this group are:\n");
44 members
= my_group
->gr_mem
;
47 printf (" %s\n", *(members
));