use POSIX;
use IO::File;
use Getopt::Long;
+use File::Glob qw(:glob);
our $prefix="/usr/local";
our $package='xfonts-traditional';
our $sharedir="$prefix/share/$package";
our @fontsdirs=qw(/usr/share/fonts/X11 /usr/local/share/fonts/X11);
+our $donefile="$package.done";
+our $fontprefix="trad--";
our @rulespath;
our $mode;
our %foundrymap;
die "no foundry maps\n" unless %foundrymap;
}
+sub processfontdir ($) {
+ my ($fontdir) = @_;
+ if (!opendir FD, $fontdir) {
+ die "$fontdir $!" unless $!==&ENOENT;
+ return;
+ }
+ my $done = do "$fontdir/$donefile";
+ if (!$done) {
+ die "$fontdir $! $@ " unless $!==&ENOENT;
+ $done = { };
+ }
+ my %found;
+ while (my $dent = readdir FD) {
+ next unless $dent =~ m/^[^.\/].*\.pcf\.gz$/;
+ if ($dent =~ m/^\Q$fontprefix/) {
+ $found{$dent} = 1;
+ next;
+ }
+ if (!stat $dent) {
+ die "$fontdir $dent $!" unless $!==&ENOENT;
+ next;
+ }
+ die "$fontdir $dent" unless -f _;
+ my $stats = join ' ', ((stat _)[1,7,9,10]);
+ $tdone = $done{$dent};
+ if (defined $tdone && $tdone eq $stats) {
+ $found{$dent} = 2;
+ next;
+ }
+
+
our $stdin = new IO::File '<&STDIN' or die $!;
our $stdout = new IO::File '>&STDOUT' or die $!;
our $stderr = new IO::File '>&STDERR' or die $!;