summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKim Hansen <kim@i9.dk>2010-03-25 17:43:10 +0000
committerPádraig Brady <P@draigBrady.com>2010-03-26 14:27:54 +0000
commit88d4b3461e3eeb69e1d09e89f38050abd6b81402 (patch)
treec4786c4734ad209c5ef48071faffef6f4b67298d /src
parent4c38625ef32f0d7941b4dbe521a1e34d12f17608 (diff)
downloadcoreutils-88d4b3461e3eeb69e1d09e89f38050abd6b81402.tar.xz
timeout: use more standard option parsing
* src/timeout.c (main): Don't use parse_long_options() which is a helper for commands that don't have any long options specific to them. * tests/misc/timeout-parameters: Remove a case that now passes due to us accepting multiple instances of the --help and --version options. * THANKS: Add the author. Signed-off-by: Pádraig Brady <P@draigBrady.com>
Diffstat (limited to 'src')
-rw-r--r--src/timeout.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/timeout.c b/src/timeout.c
index 49fc4d879..d1ea06d83 100644
--- a/src/timeout.c
+++ b/src/timeout.c
@@ -66,7 +66,6 @@
#include "operand2sig.h"
#include "cloexec.h"
#include "error.h"
-#include "long-options.h"
#include "quote.h"
#define PROGRAM_NAME "timeout"
@@ -83,6 +82,8 @@ static struct option const long_options[] =
{
{"kill-after", required_argument, NULL, 'k'},
{"signal", required_argument, NULL, 's'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -261,9 +262,6 @@ main (int argc, char **argv)
initialize_exit_failure (EXIT_CANCELED);
atexit (close_stdout);
- parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
- usage, AUTHORS, (char const *) NULL);
-
while ((c = getopt_long (argc, argv, "+k:s:", long_options, NULL)) != -1)
{
switch (c)
@@ -271,11 +269,17 @@ main (int argc, char **argv)
case 'k':
kill_after = parse_duration (optarg);
break;
+
case 's':
term_signal = operand2sig (optarg, signame);
if (term_signal == -1)
usage (EXIT_CANCELED);
break;
+
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
default:
usage (EXIT_CANCELED);
break;