summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow (mars.fritz.box) <paul@buetow.org>2014-03-02 13:57:34 +0100
committerPaul Buetow (mars.fritz.box) <paul@buetow.org>2014-03-02 13:57:34 +0100
commit1fee70f46294743efd2447bfd6bfb3529c1fa7e8 (patch)
tree4e97e81adb49c91cefa1f1280ebc64abbc429bb1
parent09efdad340d371d9af55a518816704f7e7cfe8c0 (diff)
only print help if no output
-rwxr-xr-xsrc/guprecords12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/guprecords b/src/guprecords
index 1a1d81a..ed353c7 100755
--- a/src/guprecords
+++ b/src/guprecords
@@ -9,10 +9,10 @@ use v5.14;
use Getopt::Long;
use POSIX qw(strftime);
-my $VERSION = 'VERSION_DEVEL';
-my $FLAG = 0;
+our $VERSION = 'VERSION_DEVEL';
+our $FLAG = 0;
-my %ARGS = (
+our %ARGS = (
all => 0,
total => 0,
reverse => 0,
@@ -21,7 +21,7 @@ my %ARGS = (
'indir=s' => '.',
);
-my %OPTS = map { $_ => \$ARGS{$_} } keys %ARGS;
+our %OPTS = map { $_ => \$ARGS{$_} } keys %ARGS;
GetOptions %OPTS or die "Error in command line arguments. Try --help";
sub help() {
@@ -33,7 +33,6 @@ sub help() {
sub uptime($) {
my $uptime = shift;
-
my ($s,$m,$h,undef,undef,$y,undef,$d) = localtime($uptime);
$y -= 70;
@@ -55,6 +54,7 @@ sub trimlen($$) {
sub out(\@;$) {
my ($records,$show_bt) = @_;
+ $FLAG = 1;
my $count = 0;
printf "%3s | %17s | %20s | %13s | %24s\n",
@@ -81,8 +81,6 @@ sub out(\@;$) {
sort { $a->{uptime} <=> $b->{uptime} } @$records
}
};
-
- $FLAG = 1;
}
sub all() {