From: Mischa POSLAWSKY Date: Thu, 12 Sep 2019 17:00:39 +0000 (+0200) Subject: signal-stat option to override signal name X-Git-Tag: v1.06~5 X-Git-Url: http://git.shiar.nl/barcat.git/commitdiff_plain/fdfa9b67c2e09cafbd06b20c23b51b48d99b9021 signal-stat option to override signal name Try to please everybody (or in case of unknown environment differences). --- diff --git a/barcat b/barcat index de3f6f8..d7361a1 100755 --- 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;