summaryrefslogtreecommitdiff
path: root/font
diff options
context:
space:
mode:
authorG. Branden Robinson <g.branden.robinson@gmail.com>2022-06-02 21:23:13 -0500
committerG. Branden Robinson <g.branden.robinson@gmail.com>2022-06-03 04:01:12 -0500
commit19f7a3562615f96a3ad8722d8083c73fa6988b75 (patch)
tree41a3a3270b3449adcd5ecd3caf725dbf2ac4a8b2 /font
parenta47f786c83bac69332edd1a9be276b768bd0ff85 (diff)
downloadgroff-git-19f7a3562615f96a3ad8722d8083c73fa6988b75.tar.gz
font/devpdf/util/BuildFoundries.pl: Fix fresh bug.
* font/devpdf/util/BuildFoundries.pl: Alter script to write to the standard output stream instead of (re)writing a file named "download" in the current working directory. This recovers from a problem I introduced in commit 6e62be835d, 2 May, as an unforeseen side effect of improving build parallelism so that the "download" file wouldn't be read until it was fully populated. As a side benefit, this approach is more Unixy, and less dependent on $PWD. (top level): Stop calling `WriteDownload` with an argument. (LoadFoundry): Close only the file handle of interest when done, not all of them (including `STDOUT`, which we now need). (CheckFoundry): Same--just for cleanliness, since at present running the script in 'check' mode doesn't write to any streams. (WriteDownload): Stop taking an argument and manipulating file handles. Write download file to standard output. (LoadDownload, WriteDownload): Drop `top` scalar, used as a mutex to serialize read and write access to "download" file; it is no longer needed since the "download" file is now only read.
Diffstat (limited to 'font')
-rw-r--r--font/devpdf/util/BuildFoundries.pl25
1 files changed, 8 insertions, 17 deletions
diff --git a/font/devpdf/util/BuildFoundries.pl b/font/devpdf/util/BuildFoundries.pl
index 7ddec1d25..9c9080e9e 100644
--- a/font/devpdf/util/BuildFoundries.pl
+++ b/font/devpdf/util/BuildFoundries.pl
@@ -13,8 +13,8 @@
# Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# groff is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
@@ -49,7 +49,7 @@ else
{
LoadDownload("download"); # not required
LoadFoundry("Foundry");
- WriteDownload("download");
+ WriteDownload();
}
exit 0;
@@ -157,7 +157,7 @@ sub LoadFoundry
}
}
- close();
+ close(F);
Warn("\nThe path(s) used for searching:\n$foundrypath\n") if $notFoundFont;
}
@@ -406,7 +406,6 @@ sub PutDownload
sub LoadDownload
{
my $fn=shift;
- my $top=1;
return if !open(F,"<$fn");
@@ -415,7 +414,7 @@ sub LoadDownload
chomp;
s/\r$//; # in case edited in windows
- if ($top and substr($_,0,1) eq '#' or $_ eq '')
+ if (substr($_,0,1) eq '#' or $_ eq '')
{
# Preserve comments at top of download file
@@ -423,7 +422,6 @@ sub LoadDownload
next;
}
- $top=0;
s/\s*#.*?$//; # remove comments
next if $_ eq '';
@@ -439,20 +437,13 @@ sub LoadDownload
sub WriteDownload
{
- my $fn=shift;
- my $top=1;
-
- open(F,">$fn") or Die("can't create new file '$fn'");
-
- print F join("\n",@downloadpreamble),"\n";
+ print join("\n",@downloadpreamble),"\n";
foreach my $k (sort keys %download)
{
my ($f,$ps)=split(/ /,$k);
- print F "$f\t$ps\t$download{$k}\n";
+ print "$f\t$ps\t$download{$k}\n";
}
-
- close(F);
}
sub Notice {
@@ -545,5 +536,5 @@ sub CheckFoundry
}
}
- close();
+ close(F);
}