summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2004-08-24 06:09:57 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2004-08-24 06:09:57 +0000
commit7a286cf28c962341ab2f64b615076ecb435ce7b6 (patch)
treeaf005d1282fb52b40a2c019f840184ab7fbe413f
parentbcbad4448a441818778b1ac5a313336d87d82568 (diff)
downloaddrakx-backup-do-not-use-7a286cf28c962341ab2f64b615076ecb435ce7b6.tar
drakx-backup-do-not-use-7a286cf28c962341ab2f64b615076ecb435ce7b6.tar.gz
drakx-backup-do-not-use-7a286cf28c962341ab2f64b615076ecb435ce7b6.tar.bz2
drakx-backup-do-not-use-7a286cf28c962341ab2f64b615076ecb435ce7b6.tar.xz
drakx-backup-do-not-use-7a286cf28c962341ab2f64b615076ecb435ce7b6.zip
Added "listsupportedprinters", a simple program which runs the printer model list function of printerdrake to get a list of supported printer models on STDOUT (Mainly for auto-generation of Mandrakelinux hardware support database).
-rwxr-xr-xperl-install/standalone/listsupportedprinters64
1 files changed, 64 insertions, 0 deletions
diff --git a/perl-install/standalone/listsupportedprinters b/perl-install/standalone/listsupportedprinters
new file mode 100755
index 000000000..efd334409
--- /dev/null
+++ b/perl-install/standalone/listsupportedprinters
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+#
+# Copyright (C) 2003-2004 Mandrakesoft
+#
+# Till Kamppeter <till@mandrakesoft.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License Version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+use strict;
+use lib qw(/usr/lib/libDrakX);
+use standalone;
+use printer::main;
+
+# Data structure for printer data
+my $printer;
+
+# printer::main::read_printer_db() needs a spooler name ...
+$printer->{SPOOLER} = 'cups';
+
+# ... and the user mode (expert mode gives us more info)
+$printer->{expert} = 1;
+
+# Read the command line options
+my $commandline = join ('', @ARGV);
+
+# HELP !!!
+$commandline =~ /-(h\b|help)/i and print "
+Uasge: $ARGV[0] [--only-models] [--help]
+
+Shows list of supported printers and the drivers which support them.
+Manufacturer-supplied PPDs of native PostScript printers, manually added
+drivers, or installed updates are taken into account.
+
+--only-models: Show only the model names, not the drivers
+
+--help: This help page.
+
+" and exit 0;
+
+# Do we only need models and not drivers? Beginner's mode gives us the
+# needed info then.
+$commandline =~ /-only-models/i and $printer->{expert} = 0;
+
+# Build the list of supported printers
+printer::main::read_printer_db($printer, $printer->{SPOOLER});
+
+# Show the list on STDOUT
+foreach my $item (sort keys %printer::main::thedb) {
+ print "$item\n";
+}
+
+