From: Mischa POSLAWSKY Date: Thu, 12 Sep 2019 16:56:15 +0000 (+0200) Subject: show statistics on SIGQUIT X-Git-Url: http://git.shiar.net/barcat.git/commitdiff_plain/dc32f77efabfc491dfeea2b5cbd760c62b9060cd show statistics on SIGQUIT --- diff --git a/barcat b/barcat index bdfde47..650e406 100755 --- a/barcat +++ b/barcat @@ -87,6 +87,7 @@ $opt{'value-length'} = 1 if $opt{unmodified}; my (@lines, @values, @order); +$SIG{QUIT} = \&show_stat; $SIG{ALRM} = sub { show_lines(); alarm $opt{interval} if defined $opt{interval} and $opt{interval} > 0; @@ -220,7 +221,7 @@ say '' if $opt{spark}; } show_lines(); -if ($opt{stat}) { +sub show_stat { if ($opt{hidemin} or $opt{hidemax}) { $opt{hidemin} ||= 1; $opt{hidemax} ||= @lines; @@ -238,6 +239,7 @@ if ($opt{stat}) { } say ''; } +show_stat() if $opt{stat}; __END__ =encoding utf8