summaryrefslogtreecommitdiff
path: root/src/pinky.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-03-06 15:28:54 +0000
committerJim Meyering <jim@meyering.net>1999-03-06 15:28:54 +0000
commit5b2aa1846bc8dc6d8ffce7d523cebc1ab45a17d7 (patch)
tree84329e3e3519feb76d3835f81928c4b657c495cf /src/pinky.c
parent782b27031417465b6d79e2d0d8c608b8ea842ce9 (diff)
downloadcoreutils-5b2aa1846bc8dc6d8ffce7d523cebc1ab45a17d7.tar.xz
Include long-options.h.
[long_options]: Remove the "help" and "version" entries. Remove declarations of show_help and show_version. (main): Use parse_long_options, including author name(s). Remove the show_version and show_help blocks.
Diffstat (limited to 'src/pinky.c')
-rw-r--r--src/pinky.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/pinky.c b/src/pinky.c
index 0f0327ea5..31c75ea7b 100644
--- a/src/pinky.c
+++ b/src/pinky.c
@@ -24,6 +24,7 @@
#include "system.h"
#include "error.h"
+#include "long-options.h"
#include "readutmp.h"
#ifndef MAXHOSTNAMELEN
@@ -40,12 +41,6 @@ char *ttyname ();
/* The name this program was run with. */
const char *program_name;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
/* If nonzero, display the hours:minutes since each user has touched
the keyboard, or blank if within the last minute, or days followed
by a 'd' if not within the last day. */
@@ -77,8 +72,6 @@ static int include_where = 1;
static struct option const longopts[] =
{
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
@@ -433,7 +426,7 @@ The utmp file will be %s.\n\
}
int
-main (int argc, char *const argv[])
+main (int argc, char **argv)
{
int optc, longind;
@@ -442,6 +435,10 @@ main (int argc, char *const argv[])
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "pinky", GNU_PACKAGE, VERSION,
+ "Joseph Arceneaux, David MacKenzie, and Kaveh Ghazi",
+ usage);
+
while ((optc = getopt_long (argc, argv, "sfwiqbhlp", longopts, &longind))
!= -1)
{
@@ -498,15 +495,6 @@ main (int argc, char *const argv[])
}
}
- if (show_version)
- {
- printf ("pinky (%s) %s\n", GNU_PACKAGE, VERSION);
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (do_short_format)
short_pinky (UTMP_FILE, argc - optind, argv + optind);
else