Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/id Print the correct usage message for whoami(1) and...
details: https://anonhg.NetBSD.org/src/rev/b572a2f6d796
branches: trunk
changeset: 571407:b572a2f6d796
user: peter <peter%NetBSD.org@localhost>
date: Mon Nov 22 17:21:36 2004 +0000
description:
Print the correct usage message for whoami(1) and groups(1).
ok wiz@
diffstat:
usr.bin/id/id.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diffs (35 lines):
diff -r 7d1c456ba80e -r b572a2f6d796 usr.bin/id/id.c
--- a/usr.bin/id/id.c Mon Nov 22 17:20:02 2004 +0000
+++ b/usr.bin/id/id.c Mon Nov 22 17:21:36 2004 +0000
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)id.c 8.3 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: id.c,v 1.21 2004/11/19 14:18:01 peter Exp $");
+__RCSID("$NetBSD: id.c,v 1.22 2004/11/22 17:21:36 peter Exp $");
#endif
#endif /* not lint */
@@ -334,10 +334,17 @@
void
usage()
{
- (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 -p [user]\n");
- (void)fprintf(stderr, " id -u [-nr] [user]\n");
+
+ if (strcmp(getprogname(), "groups") == 0) {
+ (void)fprintf(stderr, "usage: groups [user]\n");
+ } else if (strcmp(getprogname(), "whoami") == 0) {
+ (void)fprintf(stderr, "usage: whoami\n");
+ } else {
+ (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 -p [user]\n");
+ (void)fprintf(stderr, " id -u [-nr] [user]\n");
+ }
exit(1);
}
Home |
Main Index |
Thread Index |
Old Index