>From b505cc39fcd0e461f5ee7b94231e162300e10412 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Mon, 27 Nov 2017 11:25:39 +0100 Subject: [PATCH] timeout: also support short -v option * src/timeout.c (main): Add short option character 'v' to getopt_long call. * tests/misc/timeout.sh: Run the test both for the long and the short option. --- src/timeout.c | 2 +- tests/misc/timeout.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/timeout.c b/src/timeout.c index 466ada2ef..c7b3161d6 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -442,7 +442,7 @@ main (int argc, char **argv) initialize_exit_failure (EXIT_CANCELED); atexit (close_stdout); - while ((c = getopt_long (argc, argv, "+k:s:", long_options, NULL)) != -1) + while ((c = getopt_long (argc, argv, "+k:s:v", long_options, NULL)) != -1) { switch (c) { diff --git a/tests/misc/timeout.sh b/tests/misc/timeout.sh index a4a55b615..77d5998db 100755 --- a/tests/misc/timeout.sh +++ b/tests/misc/timeout.sh @@ -58,11 +58,13 @@ status=$? test "$out" = "" && test $status = 124 || fail=1 # Verify --verbose output -timeout --verbose -s0 -k .1 .1 sleep 10 2> err cat > exp <<\EOF timeout: sending signal EXIT to command 'sleep' timeout: sending signal KILL to command 'sleep' EOF -compare exp err || fail=1 +for opt in -v --verbose; do + timeout $opt -s0 -k .1 .1 sleep 10 2> err + compare exp err || fail=1 +done Exit $fail -- 2.15.0