From: Wayne M. <te...@us...> - 2006-03-14 00:20:41
|
Update of /cvsroot/dnssec-tools/dnssec-tools/tools/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1593 Modified Files: lskrf Log Message: New method for building output for zones. This should make it easier to add new output formats and change existing formats, if needed. Index: lskrf =================================================================== RCS file: /cvsroot/dnssec-tools/dnssec-tools/tools/scripts/lskrf,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** lskrf 13 Mar 2006 23:19:14 -0000 1.24 --- lskrf 14 Mar 2006 00:20:19 -0000 1.25 *************** *** 76,79 **** --- 76,90 ---- my $count = 0; # Record-match count. + ######################################### + + # + # Flags for building output. + # + + my $z_label; # Print a leading label for zones. + my $z_expdate; # Print the zone's expiration date. + my $z_signdate; # Print the zone's signing date. + my $z_zonefile; # Print the zone's zone file. + ####################################################################### *************** *** 273,276 **** --- 284,320 ---- $zpubflag = 1; } + + # + # Set up some zone output flags. + # + if($zonesflag) + { + # + # Set our defaults. + # + $z_label = 1; + $z_expdate = 0; + $z_signdate = 1; + $z_zonefile = 1; + + # + # Set the non-defaults for -long. + # + if($long) + { + $z_expdate = 1; + } + + # + # Set the non-defaults for -terse. + # + if($terse) + { + $z_label = 0; + $z_signdate = 0; + $z_zonefile = 0; + } + + } } *************** *** 358,361 **** --- 402,415 ---- sub showzones { + my $outstr = ""; # Output string to build. + + my $signdate; # Zone's signing date. + my $zonefile; # Zone's zonefile. + + my $endtime; # Calculated expiration date. + my $signsecs; # Signing date in seconds. + my $exptime; # Expiration date in seconds. + my $expstr; # Expiration date in string. + # # Loop through the zone list and give data on the desired zones. *************** *** 385,414 **** # should be given. # ! if($cntflag) ! { ! next; ! } # ! # Give the appropriate style of output. # ! if($terse) ! { ! print "$zk\n"; ! } ! elsif($long) ! { ! my $endtime = $kr{'endtime'}; ! my $signsecs = $kr{'keyrec_signsecs'}; ! my $exptime = $signsecs + $endtime; ! my $expstr = gmtime($exptime); - print "zone $zk\t$kr{'zonefile'}\t\"$kr{'keyrec_signdate'}\"\t\"$expstr\"\n"; - } - else - { - print "zone $zk\t$kr{'zonefile'}\t\t\"$kr{'keyrec_signdate'}\"\n"; - } } } --- 439,467 ---- # should be given. # ! next if($cntflag); # ! # Get a bunch of data from the zone keyrec. # ! $signdate = $kr{'keyrec_signdate'}; ! $zonefile = $kr{'zonefile'}; ! $endtime = $kr{'endtime'}; ! $signsecs = $kr{'keyrec_signsecs'}; ! # ! # Get a string holding the zone's expiration date. ! # ! $exptime = $signsecs + $endtime; ! $expstr = gmtime($exptime); ! ! # ! # Build and print the output string. ! # ! $outstr = $z_label ? "zone $zk" : $zk; ! $outstr .= "\t$zonefile" if($z_zonefile); ! $outstr .= "\t\"$signdate\"" if($z_signdate); ! $outstr .= "\t\"$expstr\"" if($z_expdate); ! print "$outstr\n"; } } |