signal-stat option to override signal name
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 12 Sep 2019 17:00:39 +0000 (19:00 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 19 Sep 2019 12:42:31 +0000 (14:42 +0200)
Try to please everybody (or in case of unknown environment differences).

barcat

diff --git a/barcat b/barcat
index de3f6f8459721ae78c734401961607eaef4c4e20..d7361a11f9655ab589bbd659bf1c1d72a7c42c0f 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -50,6 +50,7 @@ GetOptions(\%opt,
                $opt{spark} = [split //, $_[1] || '⎽▁▂▃▄▅▆▇█'];
        },
        'stat|s!',
+       'signal-stat=s',
        'unmodified|u!',
        'width|w=i',
        'usage|h' => sub {
@@ -84,10 +85,11 @@ $opt{units}   = [split //, ' kMGTPEZYyzafpnμm'] if $opt{'human-readable'};
 $opt{anchor} //= qr/\A/;
 $opt{'value-length'} = 6 if $opt{units};
 $opt{'value-length'} = 1 if $opt{unmodified};
+$opt{'signal-stat'} //= exists $SIG{INFO} ? 'INFO' : 'QUIT';
 
 my (@lines, @values, @order);
 
-$SIG{$_} = \&show_stat for exists $SIG{INFO} ? 'INFO' : 'QUIT';
+$SIG{$_} = \&show_stat for $opt{'signal-stat'} || ();
 $SIG{ALRM} = sub {
        show_lines();
        alarm $opt{interval} if defined $opt{interval} and $opt{interval} > 0;