File: foomatic-datafile

package info (click to toggle)
foomatic 0.20020408-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 16,940 kB
  • ctags: 456
  • sloc: xml: 300,403; perl: 14,168; ansic: 2,756; makefile: 247; sh: 179
file content (59 lines) | stat: -rwxr-xr-x 1,263 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#! /usr/bin/perl

use Foomatic::Defaults;
use Foomatic::DB;
use Getopt::Std;

getopts("d:p:t:hf");
help() if $opt_h;
my $driver = $opt_d;
my $poid   = $opt_p;
my $type = $opt_t;
my $force = ($opt_f ? 1 : undef);

if (defined($driver) and defined($poid)) {

    my $db = Foomatic::DB->new();
    # Get all the data about this driver/printer pair
    $db->getdat($driver, $poid, $force);

    if (!$opt_t) {
	$type = 'ppd';
    }
    my @data;

    if ($type eq 'cups') {
	@data = $db->getcupsppd();
    } elsif ($type eq 'pdq') {
	@data = $db->getpdqdata();
    } elsif ($type eq 'lpd') {
	@data = $db->getlpddata();
    } elsif ($type eq 'lprng') {
	@data = $db->getlpddata();
    } elsif ($type eq 'mf') {
	@data = $db->getmfdata();
    } elsif ($type eq 'ppd') {
	@data = $db->getgenericppd();
    } elsif ($type eq 'ppr') {
	@data = $db->getgenericppd();
    } elsif ($type eq 'direct') {
	@data = $db->getlpddata();
    } else {
	die "Unknown type $type!  Specify cups, pdq, lpd, lprng, mf, ppr, direct, or ppd.\n";
    }
    
    print @data;
}

exit 0;

sub help {
    print <<HELP;
foomatic-datafile -t cups|pdq|lpd|lprng|mf|ppr|direct|ppd -d <driver> -p <printerid> [-f]
 -t: datafile type
 -d: driver name
 -p: printer id
 -f: force data rebuild
HELP

}