#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-cleanupdrivers
#!/usr/bin/perl
# -*- perl -*-

# This is foomatic-cleanupdrivers. It removes all driver XML files
# which have an empty command line. So one can avoid that "unusable"
# printer/driver combos are shown in frontends. This program also runs
# when Foomatic is not installed.

use Foomatic::Defaults;
if ($#ARGV > -1) {
    $libdir = $ARGV[0];
} elsif ($ENV{FOOMATICDB}) {
    $libdir = $ENV{FOOMATICDB};
} elsif (!$libdir) {
    $libdir = "/usr/share/foomatic";
}

# Read out the program name with which we were called, but discard the path
$0 =~ m!/([^/]+)\s*$!;
$progname = $1;

# Read the directory with the driver's XML entries
opendir DRIVERDIR, "$libdir/db/source/driver" ||
    die "Cannot open driver XML directory!\n";
my $driver;
while ($driver = readdir(DRIVERDIR)) {
    open DRIVERENTRY, "< $libdir/db/source/driver/$driver" || die "   Database entry for the driver $driver cannot be read!\n";
    my @driverentryfield = <DRIVERENTRY>;
    close DRIVERENTRY;
    my $driverentry = join ('', @driverentryfield);
    next unless $driverentry;
    if (($driverentry =~ m!<prototype>\s*</prototype>!sg) ||
	($driverentry =~ m!<prototype\s*/\s*>!sg) ||
	($driverentry !~ m!<prototype[>/\s]!sg)) {
	unlink("$libdir/db/source/driver/$driver") ||
	    die "Cannot delete $driver!\n";
	print "$driver has an empty command line, deleted!\n";
    }
}
closedir DRIVERDIR;