summaryrefslogtreecommitdiffstats
path: root/perl-install/printer
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2003-03-02 22:15:54 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2003-03-02 22:15:54 +0000
commit55971b9830f5e0f0442d12dc382a4525a19bbd11 (patch)
tree479f63544a3fc77ba7a1c16a5a29d25844822342 /perl-install/printer
parent7e9254859e3b4fb132d0eac0f77922caf66808ef (diff)
downloaddrakx-55971b9830f5e0f0442d12dc382a4525a19bbd11.tar
drakx-55971b9830f5e0f0442d12dc382a4525a19bbd11.tar.gz
drakx-55971b9830f5e0f0442d12dc382a4525a19bbd11.tar.bz2
drakx-55971b9830f5e0f0442d12dc382a4525a19bbd11.tar.xz
drakx-55971b9830f5e0f0442d12dc382a4525a19bbd11.zip
Fixed auto-configuration for printers in the GIMP to work with Foomatic 3.0.
Diffstat (limited to 'perl-install/printer')
-rw-r--r--perl-install/printer/gimp.pm18
1 files changed, 11 insertions, 7 deletions
diff --git a/perl-install/printer/gimp.pm b/perl-install/printer/gimp.pm
index db7d50470..61a3db1e2 100644
--- a/perl-install/printer/gimp.pm
+++ b/perl-install/printer/gimp.pm
@@ -180,7 +180,7 @@ sub makeprinterentry {
# GhostScript + Foomatic driver
$gimpprintqueue = 1;
$ppd =~
- /'idx'\s*=>\s*'ev\/gimp-print-((escp2|pcl|bjc|lexmark)\-\S*)'/im;
+ /\-sModel=((escp2|pcl|bjc|lexmark)\-[^\s\"\']*)/im;
$gimpprintdriver = $1;
}
if ($gimpprintqueue) {
@@ -260,6 +260,7 @@ sub addentry {
my $sectionfound = 0;
my $entryinserted = 0;
my @lines = split("\n", $filecontent);
+ while ($lines[-1] !~ /\S/) { pop @lines; }
foreach (@lines) {
if (!$sectionfound) {
$sectionfound = 1 if /^\s*Printer\s*:\s*($section)\s*$/;
@@ -272,23 +273,25 @@ sub addentry {
}
}
push(@lines, $entry) if $sectionfound && !$entryinserted;
- return join("\n", @lines);
+ return join("\n", @lines) . "\n";
}
sub addprinter {
my ($section, $filecontent) = @_;
my @lines = split("\n", $filecontent);
+ while ($lines[-1] !~ /\S/) { pop @lines; }
foreach (@lines) {
# section already there, nothing to be done
return $filecontent if /^\s*Printer\s*:\s*($section)\s*$/;
}
- return $filecontent . "\nPrinter: $section";
+ return $filecontent . "\nPrinter: $section\n";
}
sub removeentry {
my ($section, $entry, $filecontent) = @_;
my $sectionfound;
- my @lines = split("\n", $filecontent);
+ my @lines = split(/^/, $filecontent);
+ while ($lines[-1] !~ /\S/) { pop @lines; }
foreach (@lines) {
if (!$sectionfound) {
$sectionfound = /^\s*Printer\s*:\s*($section)\s*$/;
@@ -300,13 +303,14 @@ sub removeentry {
}
}
}
- return join "\n", @lines;
+ return join "", @lines;
}
sub removeprinter {
my ($section, $filecontent) = @_;
my $sectionfound;
- my @lines = split("\n", $filecontent);
+ my @lines = split(/^/, $filecontent);
+ while ($lines[-1] !~ /\S/) { pop @lines; }
foreach (@lines) {
if (!$sectionfound) {
if (/^\s*Printer\s*:\s*($section)\s*$/) {
@@ -318,7 +322,7 @@ sub removeprinter {
$_ = "";
}
}
- return join "\n", @lines;
+ return join "", @lines;
}
sub isprinterconfigured {