- (void)fprintf(stderr, "usage: id [user]\n");
- (void)fprintf(stderr, " id -G [-n] [user]\n");
- (void)fprintf(stderr, " id -g [-nr] [user]\n");
- (void)fprintf(stderr, " id -u [-nr] [user]\n");
+ u_int rid;
+
+ if (!pw) {
+ if ((pw = getpwuid(rid = getuid())) == NULL)
+ err(1, "getpwuid");
+ }
+
+ (void)printf("%s:%s:%d:%d:%s:%ld:%ld:%s:%s:%s\n", pw->pw_name,
+ pw->pw_passwd, pw->pw_uid, pw->pw_gid, pw->pw_class,
+ (long)pw->pw_change, (long)pw->pw_expire, pw->pw_gecos,
+ pw->pw_dir, pw->pw_shell);
+}
+
+
+void
+usage(void)
+{
+
+ if (isgroups)
+ (void)fprintf(stderr, "usage: groups [user]\n");
+ else if (iswhoami)
+ (void)fprintf(stderr, "usage: whoami\n");
+ else
+ (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n",
+ "usage: id [user]",
+ " id -G [-n] [user]",
+ " id -P [user]",
+ " id -g [-nr] [user]",
+ " id -p [user]",
+ " id -u [-nr] [user]");