diff options
author | Jim Meyering <jim@meyering.net> | 1993-10-12 01:52:24 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1993-10-12 01:52:24 +0000 |
commit | 87fa23e6417d7d1938b72e872d779ae7225a5aa4 (patch) | |
tree | 0fcc68f9cdf7315d09d5836df0f261e3d6b8c13a /src/who.c | |
parent | f12b53b2ce8f0bb0dd28a290f9b27490ef4599a9 (diff) | |
download | coreutils-87fa23e6417d7d1938b72e872d779ae7225a5aa4.tar.xz |
merge with 1.8.1b
Diffstat (limited to 'src/who.c')
-rw-r--r-- | src/who.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -40,7 +40,9 @@ #ifndef _POSIX_SOURCE #include <sys/param.h> #endif + #include "system.h" +#include "version.h" #ifndef UTMP_FILE #ifdef _PATH_UTMP /* 4.4BSD. */ @@ -75,6 +77,12 @@ static void who_am_i (); /* The name this program was run with. */ char *program_name; +/* If non-zero, display usage information and exit. */ +static int show_help; + +/* If non-zero, print the version on standard output and exit. */ +static int show_version; + /* If nonzero, display only a list of usernames and count of the users logged on. Ignored for `who am i'. */ @@ -95,10 +103,12 @@ static int include_mesg; static struct option const longopts[] = { {"count", no_argument, NULL, 'q'}, + {"help", no_argument, &show_help, 1}, {"idle", no_argument, NULL, 'u'}, {"heading", no_argument, NULL, 'H'}, {"message", no_argument, NULL, 'T'}, {"mesg", no_argument, NULL, 'T'}, + {"version", no_argument, &show_version, 1}, {"writable", no_argument, NULL, 'T'}, {NULL, 0, NULL, 0} }; @@ -118,6 +128,9 @@ main (argc, argv) { switch (optc) { + case 0: + break; + case 'm': my_line_only = 1; break; @@ -148,6 +161,15 @@ main (argc, argv) } } + if (show_version) + { + printf ("%s\n", version_string); + exit (0); + } + + if (show_help) + usage (); + if (chdir ("/dev")) error (1, errno, "cannot change directory to /dev"); |