From baaae94921a3f95a4600c2e101384e00fcf34dc2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 8 Jan 2012 17:57:53 +0000 Subject: [PATCH] wip update --- update-xfonts-traditional | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/update-xfonts-traditional b/update-xfonts-traditional index 1daa70c..fbafe0b 100755 --- a/update-xfonts-traditional +++ b/update-xfonts-traditional @@ -3,11 +3,14 @@ use strict; 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; @@ -148,6 +151,37 @@ sub loadfoundries () { 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 $!; -- 2.11.0