]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
timeout: also support short -v option
authorBernhard Voelker <mail@bernhard-voelker.de>
Mon, 27 Nov 2017 10:25:39 +0000 (11:25 +0100)
committerBernhard Voelker <mail@bernhard-voelker.de>
Mon, 27 Nov 2017 21:05:56 +0000 (22:05 +0100)
* 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
tests/misc/timeout.sh

index 466ada2efb18b0e73bcb31f2edbe050e99b17afc..c7b3161d6e8bdd70debb373817664a88bd244f63 100644 (file)
@@ -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)
         {
index a4a55b615be22f6c896224c43ac9f1da13e87ea3..77d5998db87855fb64e0ffc08f290e4af2ea5957 100755 (executable)
@@ -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