summaryrefslogtreecommitdiff
path: root/src/who.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-17 03:57:04 +0000
committerJim Meyering <jim@meyering.net>1993-10-17 03:57:04 +0000
commitfa7a1e19e2b4fcec1f67ebd75f6f12ae65eef8c8 (patch)
treeffc67e10bcf805a9ee5b8243a5103f5bdb4fb90a /src/who.c
parent6e1a4cca6862fa1fb40b4c38b73fa30ebb61344b (diff)
downloadcoreutils-fa7a1e19e2b4fcec1f67ebd75f6f12ae65eef8c8.tar.xz
merge with 1.8.1g
Diffstat (limited to 'src/who.c')
-rw-r--r--src/who.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/src/who.c b/src/who.c
index 5f2e0d850..16bd3523f 100644
--- a/src/who.c
+++ b/src/who.c
@@ -168,7 +168,7 @@ main (argc, argv)
break;
default:
- usage ();
+ usage (1);
}
}
@@ -179,7 +179,7 @@ main (argc, argv)
}
if (show_help)
- usage ();
+ usage (0);
if (chdir ("/dev"))
error (1, errno, "cannot change directory to /dev");
@@ -205,7 +205,7 @@ main (argc, argv)
break;
default: /* lose */
- usage ();
+ usage (1);
}
exit (0);
@@ -459,11 +459,35 @@ idle_string (when)
}
static void
-usage ()
+usage (status)
+ int status;
{
- fprintf (stderr, "\
-Usage: %s [-imqsuwHT] [--count] [--idle] [--heading] [--message] [--mesg]\n\
- [--writable] [file] [am i]\n",
+ fprintf (status == 0 ? stdout : stderr, "\
+Usage: %s [OPTION]... [ FILE | ARG1 ARG2 ]\n\
+",
program_name);
- exit (1);
+
+ if (status != 0)
+ fprintf (stderr, "\nTry `%s --help' for more information.\n",
+ program_name);
+ else
+
+ printf ("\
+\n\
+ -H, --heading print line of column headings\n\
+ -T, -w, --mesg add user's message status as +, - or ?\n\
+ -i, -u, --idle add user idle time as HOURS:MINUTES, . or old\n\
+ -m only hostname and user associated with stdin\n\
+ -q, --count all login names and number of users logged on\n\
+ -s (ignored)\n\
+ --help display this help and exit\n\
+ --message same as -T\n\
+ --version output version information and exit\n\
+ --writeable same as -T\n\
+\n\
+If FILE not given, uses /etc/utmp. /etc/wtmp as FILE is common.\n\
+If ARG1 ARG2 given, -m presumed: `am i' or `mom likes' are usual.\n\
+");
+
+ exit (status);
}