From fdfa9b67c2e09cafbd06b20c23b51b48d99b9021 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 12 Sep 2019 19:00:39 +0200 Subject: [PATCH] signal-stat option to override signal name Try to please everybody (or in case of unknown environment differences). --- barcat | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.30.0