[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] bug in list of files displayed on 'automake --help'
From: |
Alexey Mahotkin |
Subject: |
[PATCH] bug in list of files displayed on 'automake --help' |
Date: |
Fri, 13 Jul 2001 00:21:25 +0400 (MSD) |
Below is the patch that fixes the list of files that are automatically
distributed by Automake. If you'll look closer to it, the files at
the bottom of column are duplicated at the top of next column.
Correct implementation of the algorithm is written by Maxim Sinev,
kudos to him!
--- automake.in-orig Tue Jul 10 01:03:39 2001
+++ automake.in Fri Jul 13 00:16:00 2001
@@ -7872,34 +7872,40 @@
$last = $iter;
}
- my ($one, $two, $three, $four, $max);
+ my @four;
print "\nFiles which are automatically distributed, if found:\n";
format USAGE_FORMAT =
@<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<
- $one, $two, $three, $four
+ $four[0], $four[1], $four[2], $four[3]
.
$~ = "USAGE_FORMAT";
- $max = int (($#lcomm + 1) / 4);
- for (my $i = 0; $i < $max; ++$i)
- {
- $one = $lcomm[$i];
- $two = $lcomm[$max + $i];
- $three = $lcomm[2 * $max + $i];
- $four = $lcomm[3 * $max + $i];
- write;
- }
+# Thanks to Maxim Sinev <address@hidden>
+
+ my $cols = 4;
+ my $rows = int(@lcomm / $cols);
+ my $rest = @lcomm % $cols;
- my $mod = ($#lcomm + 1) % 4;
- if ($mod != 0)
- {
- $one = $lcomm[$max];
- $two = ($mod > 1) ? $lcomm[2 * $max] : '';
- $three = ($mod > 2) ? $lcomm[3 * $max] : '';
- $four = ($mod > 3) ? $lcomm[4 * $max] : '';
- write;
+ if($rest) {
+ $rows++;
+ } else {
+ $rest = $cols;
}
+ for (my $y = 0; $y < $rows; $y++) {
+ @four = ("", "", "", "");
+ for (my $x = 0; $x < $cols; $x++) {
+ last if (($y + 1 == $rows && $x == $rest));
+
+ my $idx = ($x > $rest) ? ($rows * $rest + ($rows - 1) * ($x - $rest))
+ : ($rows * $x);
+
+ $idx += $y;
+ $four[$x] = $lcomm[$idx];
+ }
+ write;
+ }
+
print "\nReport bugs to <address@hidden>.\n";
exit 0;
--alexm
- [PATCH] bug in list of files displayed on 'automake --help',
Alexey Mahotkin <=