summaryrefslogtreecommitdiff
path: root/src/foomatic/mk_printerlist.in
blob: a8f516f8567e52d2f6faf753be01e42d9a72a7ca (plain)
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
#!@PERL@

%printer_list = ();
@printer_names = ();

eval `./printers`;

open PRINTERS, "(wget -q -O - http://www.linuxprinting.org/printer_list.cgi; cat foomatic-printermap) |" or die "Can't get print list: $!";

while (<PRINTERS>) {
    if (/make ==/) {
	/.*== "(.*)".*/;
	$current_make = $1;
    } elsif (/=new Option/) {
	/.*"(.*)", *"(.*)".*/;
	my $printer = "$current_make " . $1;
	$printer_list{$2} = $printer;
    } elsif (/^\#gptofoo/) {
	chomp;
	my ($junk, $key, $id) = split;
	$id =~ s,printer/,,;
	my ($string) = sprintf("%-30s %-15s %s\n", $printer_list{$id}, $key,
			       $printer_name{$key});
	push @printer_names, $string;
    }
}

close PRINTERS;

print sort @printer_names;