prt-auf: fixed the off-by-one errors in the printf subroutine

This commit is contained in:
John McQuah 2022-06-12 20:57:11 -04:00
parent 6abc947745
commit 730ab19a6a

View File

@ -315,6 +315,7 @@ sub printf_ports {
$p = (split /\//, $pp)[-1];
@pstats = (get_pkgfile_fields($pp,"all"));
printf CACHE "%s\n"x($#pstats+1), @pstats;
printf CACHE "\n";
} close (CACHE);
print "cache created.\n";
} else {
@ -324,12 +325,11 @@ sub printf_ports {
$outputf = "$inputf\n";
$outputf =~ s/(%p|%n|%v|%r|%d|%e|%u|%P|%M|%R|%E|%O|%l|%i)/%-14s/g;
foreach my $pp (@targets) {
$p = (split /\//, $pp)[-1];
@pstats = get_pkgfile_fields($pp,"all");
$pstats[11] = grep /^$p$/, keys %V_INST;
$pstats[12] = grep /^$p$/, @LOCKED;
$pstats[12] = (grep /^$p$/, keys %V_INST) ? "yes" : "no";
$pstats[13] = (grep /^$p$/, @LOCKED) ? "yes" : "no";
printf STDOUT $outputf, @pstats[@pos];
}
}
@ -375,7 +375,7 @@ sub get_pkgfile_fields {
$readme = "yes" if (-f "$portpath/README") or (-f "$portpath/README.md");
$preInstall = "yes" if (-f "$portpath/pre-install");
$postInstall = "yes" if (-f "$portpath/post-install");
$portpath =~ s/\/[^\/]+?$//; # now it should be called repository path
$portpath =~ s/\/[^\/]+?$//; # now it should be called repository path!
open(PF,$pkgfile) or die "Cannot open $pkgfile for reading!\n";
while (<PF>) {