X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=blobdiff_plain;f=config%2Fcfgroot%2Fheader.pl;fp=config%2Fcfgroot%2Fheader.pl;h=e2e6fd6892195659ca4f2a669bda6acdf1758246;hp=6322cfebef18d0455f8e20cfa634fe0befa52df1;hb=c27b8825beeed2f45b5c6caa507363982675bd10;hpb=934a376918ac343b299b6ffcc5d71d2a9d69cefa diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl index 6322cfebef..e2e6fd6892 100644 --- a/config/cfgroot/header.pl +++ b/config/cfgroot/header.pl @@ -418,6 +418,8 @@ END $ip = $temp[1]; #All field are not necessarily read. Clear everything $endtime = 0; + $endtime_print = ""; + $expired = 0; $ether = ""; $hostname = ""; } @@ -425,6 +427,9 @@ END if ($line =~ /^\s*ends/) { $line =~ /(\d+)\/(\d+)\/(\d+) (\d+):(\d+):(\d+)/; $endtime = timegm($6, $5, $4, $3, $2 - 1, $1 - 1900); + ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $dst) = localtime($endtime); + $endtime_print = sprintf ("%02d/%02d/%d %02d:%02d:%02d",$mday,$mon+1,$year+1900,$hour,$min,$sec); + $expired = $endtime < time(); } if ($line =~ /^\s*hardware ethernet/) { @@ -434,12 +439,11 @@ END if ($line =~ /^\s*client-hostname/) { $hostname = "$temp[1] $temp[2] $temp[3]"; - $hostname =~ s/;//g; - $hostname =~ s/\"//g; + $hostname =~ s/\"|[;\s]+?$//g; # remove quotes, trim semicolon and white space } if ($line eq "}") { - @record = ('IPADDR',$ip,'ENDTIME',$endtime,'ETHER',$ether,'HOSTNAME',$hostname); + @record = ('IPADDR',$ip,'ENDTIME',$endtime,'ETHER',$ether,'HOSTNAME',$hostname,'endtime_print',$endtime_print,'expired',$expired); $record = {}; # create a reference to empty hash %{$record} = @record; # populate that hash with @record $entries{$record->{'IPADDR'}} = $record; # add this to a hash of hashes @@ -449,37 +453,53 @@ END my $id = 0; my $col = ""; + my $divider_printed = 0; foreach my $key (sort leasesort keys %entries) { - print "
+