summaryrefslogtreecommitdiff
path: root/src/id.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/id.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/id.c')
-rw-r--r--src/id.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/id.c b/src/id.c
index b9a404cd3..24c72497c 100644
--- a/src/id.c
+++ b/src/id.c
@@ -28,6 +28,7 @@
#include "system.h"
#include "error.h"
+#include "long-options.h"
#ifndef _POSIX_VERSION
struct passwd *getpwuid ();
@@ -70,21 +71,13 @@ static gid_t rgid, egid;
/* The number of errors encountered so far. */
static int problems = 0;
-/* 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;
-
static struct option const longopts[] =
{
{"group", no_argument, NULL, 'g'},
{"groups", no_argument, NULL, 'G'},
- {"help", no_argument, &show_help, 1},
{"name", no_argument, NULL, 'n'},
{"real", no_argument, NULL, 'r'},
{"user", no_argument, NULL, 'u'},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
@@ -126,6 +119,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "id", GNU_PACKAGE, VERSION,
+ "Arnold Robbins and David MacKenzie", usage);
+
while ((optc = getopt_long (argc, argv, "agnruG", longopts, NULL)) != -1)
{
switch (optc)
@@ -155,15 +151,6 @@ main (int argc, char **argv)
}
}
- if (show_version)
- {
- printf ("id (%s) %s\n", GNU_PACKAGE, VERSION);
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (just_user + just_group + just_group_list > 1)
error (1, 0, _("cannot print only user and only group"));