wip update
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 8 Jan 2012 17:57:53 +0000 (17:57 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 8 Jan 2012 17:57:53 +0000 (17:57 +0000)
update-xfonts-traditional

index 1daa70c..fbafe0b 100755 (executable)
@@ -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 $!;