From 7b2e2c91dd4675f39ebf46d5b16be4bb17b4929e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 19 Aug 2020 21:53:50 +0100 Subject: [PATCH] expire-8601: wip new version Signed-off-by: Ian Jackson --- scripts/expire-iso8601.new | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/expire-iso8601.new b/scripts/expire-iso8601.new index f001b35..e3a8836 100755 --- a/scripts/expire-iso8601.new +++ b/scripts/expire-iso8601.new @@ -55,6 +55,7 @@ our $rm = 1; our $recurse = 1; our $unit = 86400; our $slop; +our $debug; our @intervals; sub badusage ($) { @@ -98,7 +99,7 @@ sub precomp () { $_->{A} = ($newest_t - $_->{T}) / $unit foreach @files; $slop /= $unit; -# print DEBUG Dumper(\@files, \@intervals); + print DEBUG Dumper(\@files, \@intervals) if $debug >= 2; } sub flag ($) { @@ -166,7 +167,7 @@ while (@ARGV && $ARGV[0] =~ m/^-/) { while (m/^-./) { if (s/^-n/-/) { $rm=0; } elsif (s/-r/-/) { $recurse=1; } - elsif (s/-D/-/) { open DEBUG, ">&STDERR" or die $!; DEBUG->autoflush(1) } + elsif (s/-D/-/) { $debug++; } elsif (s/-u(\d+)$//) { $unit=$1; } elsif (s/-s(\d+)$//) { $slop=$1; } else { badusage "unknown short option $_" } @@ -181,6 +182,11 @@ while (@ARGV && $ARGV[0] =~ m/^-/) { badusage "too few arguments" unless @ARGV; +if ($debug) { + open DEBUG, ">&STDERR" or die $!; + DEBUG->autoflush(1); +} + $slop //= $unit * 0.1; foreach (@ARGV) { -- 2.30.2