summaryrefslogtreecommitdiffstats
path: root/perl-install/printer
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/printer')
-rw-r--r--perl-install/printer/main.pm123
-rw-r--r--perl-install/printer/office.pm32
-rw-r--r--perl-install/printer/printerdrake.pm9
3 files changed, 81 insertions, 83 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm
index b9e536d61..06329bdfc 100644
--- a/perl-install/printer/main.pm
+++ b/perl-install/printer/main.pm
@@ -191,7 +191,7 @@ sub getinfo($) {
my $printer = {};
my @QUEUES;
- $::prefix=$prefix;
+ $::prefix = $prefix;
# Initialize $printer data structure
resetinfo($printer);
@@ -1007,8 +1007,7 @@ sub configure_queue($) {
$useUSB ||= $_->{queuedata}{connect} =~ /usb/ ||
$_->{DeviceURI} =~ /usb/;
}
- $useUSB ||= ($printer->{currentqueue}{queue}{queuedata}{connect}
- =~ /usb/);
+ $useUSB ||= ($printer->{currentqueue}{queue}{queuedata}{connect} =~ /usb/);
if ($useUSB) {
my $f = "$prefix/etc/sysconfig/usb";
my %usb = getVarsFromSh($f);
@@ -1462,38 +1461,38 @@ sub configure_hpoj {
$_ = `date`;
chomp;
print CONFIG
- "# Added $_ by \"printerdrake\".\n".
- "\n".
- "# The basic format for this file is \"key[+]=value\".\n".
- "# If you say \"+=\" instead of \"=\", then the value is appended to any\n".
- "# value already defined for this key, rather than replacing it.\n".
- "\n".
- "# Comments must start at the beginning of the line. Otherwise, they may\n".
- "# be interpreted as being part of the value.\n".
- "\n".
- "# If you have multiple devices and want to define options that apply to\n".
- "# all of them, then put them in the file /etc/ptal/defaults, which is read\n".
- "# in before this file.\n".
- "\n".
- "# The format version of this file:\n".
- "# ptal-init ignores devices with incorrect/missing versions.\n".
+ "# Added $_ by \"printerdrake\".\n" .
+ "\n" .
+ "# The basic format for this file is \"key[+]=value\".\n" .
+ "# If you say \"+=\" instead of \"=\", then the value is appended to any\n" .
+ "# value already defined for this key, rather than replacing it.\n" .
+ "\n" .
+ "# Comments must start at the beginning of the line. Otherwise, they may\n" .
+ "# be interpreted as being part of the value.\n" .
+ "\n" .
+ "# If you have multiple devices and want to define options that apply to\n" .
+ "# all of them, then put them in the file /etc/ptal/defaults, which is read\n" .
+ "# in before this file.\n" .
+ "\n" .
+ "# The format version of this file:\n" .
+ "# ptal-init ignores devices with incorrect/missing versions.\n" .
"init.version=1\n";
# Write model string.
if ($model_long !~ /\S/) {
print CONFIG
- "\n".
- "# \"printerdrake\" couldn't read the model but added this device anyway:\n".
+ "\n" .
+ "# \"printerdrake\" couldn't read the model but added this device anyway:\n" .
"# ";
} else {
print CONFIG
- "\n".
- "# The device model that was originally detected on this port:\n".
- "# If this ever changes, then you should re-run \"printerdrake\"\n".
+ "\n" .
+ "# The device model that was originally detected on this port:\n" .
+ "# If this ever changes, then you should re-run \"printerdrake\"\n" .
"# to delete and re-configure this device.\n";
if ($bus eq "par") {
print CONFIG
- "# Comment out if you don't care what model is really connected to this\n".
+ "# Comment out if you don't care what model is really connected to this\n" .
"# parallel port.\n";
}
}
@@ -1501,16 +1500,16 @@ sub configure_hpoj {
"init.mlcd.append+=-devidmatch \"$model_long\"\n";
# Write serial-number string.
- if ($serialnumber_long!~/\S/) {
+ if ($serialnumber_long !~ /\S/) {
print CONFIG
- "\n".
- "# The device's serial number is unknown.\n".
+ "\n" .
+ "# The device's serial number is unknown.\n" .
"# ";
} else {
print CONFIG
- "\n".
+ "\n" .
"# The serial number of the device that was originally detected on this port:\n";
- if ($bus=~/^[pu]/) {
+ if ($bus =~ /^[pu]/) {
print CONFIG
"# Comment out if you want to disable serial-number matching.\n";
}
@@ -1518,10 +1517,10 @@ sub configure_hpoj {
print CONFIG
"init.mlcd.append+=-devidmatch \"$serialnumber_long\"\n";
- if ($bus=~/^[pu]/) {
+ if ($bus =~ /^[pu]/) {
print CONFIG
- "\n".
- "# Standard options passed to ptal-mlcd:\n".
+ "\n" .
+ "# Standard options passed to ptal-mlcd:\n" .
"init.mlcd.append+=";
if ($bus eq "usb") {
# Important: don't put more quotes around /dev/usb/lp[0-9]*,
@@ -1530,46 +1529,46 @@ sub configure_hpoj {
} elsif ($bus eq "par") {
print CONFIG "$address_arg -device $device";
}
- print CONFIG "\n".
- "\n".
- "# ptal-mlcd's remote console can be useful for debugging, but may be a\n".
- "# security/DoS risk otherwise. In any case, it's accessible with the\n".
- "# command \"ptal-connect mlc:<XXX>:<YYY> -service PTAL-MLCD-CONSOLE\".\n".
- "# Uncomment the following line if you want to enable this feature for\n".
- "# this device:\n".
- "# init.mlcd.append+=-remconsole\n".
- "\n".
- "# If you need to pass any other command-line options to ptal-mlcd, then\n".
- "# add them to the following line and uncomment the line:\n".
- "# init.mlcd.append+=\n".
- "\n".
- "# By default ptal-printd is started for mlc: devices. If you use CUPS,\n".
- "# then you may not be able to use ptal-printd, and you can uncomment the\n".
- "# following line to disable ptal-printd for this device:\n".
+ print CONFIG "\n" .
+ "\n" .
+ "# ptal-mlcd's remote console can be useful for debugging, but may be a\n" .
+ "# security/DoS risk otherwise. In any case, it's accessible with the\n" .
+ "# command \"ptal-connect mlc:<XXX>:<YYY> -service PTAL-MLCD-CONSOLE\".\n" .
+ "# Uncomment the following line if you want to enable this feature for\n" .
+ "# this device:\n" .
+ "# init.mlcd.append+=-remconsole\n" .
+ "\n" .
+ "# If you need to pass any other command-line options to ptal-mlcd, then\n" .
+ "# add them to the following line and uncomment the line:\n" .
+ "# init.mlcd.append+=\n" .
+ "\n" .
+ "# By default ptal-printd is started for mlc: devices. If you use CUPS,\n" .
+ "# then you may not be able to use ptal-printd, and you can uncomment the\n" .
+ "# following line to disable ptal-printd for this device:\n" .
"# init.printd.start=0\n";
} else {
print CONFIG
- "\n".
- "# By default ptal-printd isn't started for hpjd: devices.\n".
- "# If for some reason you want to start it for this device, then\n".
- "# uncomment the following line:\n".
+ "\n" .
+ "# By default ptal-printd isn't started for hpjd: devices.\n" .
+ "# If for some reason you want to start it for this device, then\n" .
+ "# uncomment the following line:\n" .
"init.printd.start=1\n";
}
print CONFIG
- "\n".
- "# If you need to pass any additional command-line options to ptal-printd,\n".
- "# then add them to the following line and uncomment the line:\n".
+ "\n" .
+ "# If you need to pass any additional command-line options to ptal-printd,\n" .
+ "# then add them to the following line and uncomment the line:\n" .
"# init.printd.append+=\n";
if ($cardreader) {
print CONFIG
- "\n".
- "# Uncomment the following line to enable ptal-photod for this device:\n".
- "init.photod.start=1\n".
- "\n".
- "# If you have more than one photo-card-capable peripheral and you want to\n".
- "# assign particular TCP port numbers and mtools drive letters to each one,\n".
- "# then change the line below to use the \"-portoffset <n>\" option.\n".
+ "\n" .
+ "# Uncomment the following line to enable ptal-photod for this device:\n" .
+ "init.photod.start=1\n" .
+ "\n" .
+ "# If you have more than one photo-card-capable peripheral and you want to\n" .
+ "# assign particular TCP port numbers and mtools drive letters to each one,\n" .
+ "# then change the line below to use the \"-portoffset <n>\" option.\n" .
"init.photod.append+=-maxaltports 26\n";
}
close(CONFIG);
diff --git a/perl-install/printer/office.pm b/perl-install/printer/office.pm
index 01f1476da..ce00489a5 100644
--- a/perl-install/printer/office.pm
+++ b/perl-install/printer/office.pm
@@ -97,7 +97,7 @@ sub configureoffice {
# the "Generic Printer"
my @parameters = $suites{$suite}{param};
$configfilecontent = removeentry(@parameters, $configfilecontent);
- $configfilecontent =addentry($parameters[0], $parameters[1] . $suites{$suite}{perl} . $printer::data::lprcommand{$printer->{SPOOLER}{print_command}}, $configfilecontent);
+ $configfilecontent = addentry($parameters[0], $parameters[1] . $suites{$suite}{perl} . $printer::data::lprcommand{$printer->{SPOOLER}{print_command}}, $configfilecontent);
# Write back Star Office configuration file
return writesofficeconfigfile($configfilename, $configfilecontent);
}
@@ -192,21 +192,21 @@ sub makestarofficeprinterentry {
my ($printer, $queue, $configprefix, $configfile) = @_;
# Set default printer
if ($queue eq $printer->{DEFAULT}) {
- $configfile =removeentry("windows", "device=", $configfile);
- $configfile =addentry("windows",
+ $configfile = removeentry("windows", "device=", $configfile);
+ $configfile = addentry("windows",
"device=$queue,$queue PostScript,$queue",
$configfile);
}
# Make an entry in the "[devices]" section
- $configfile =removeentry("devices", "$queue=", $configfile);
- $configfile =addentry("devices",
+ $configfile = removeentry("devices", "$queue=", $configfile);
+ $configfile = addentry("devices",
"$queue=$queue PostScript,$queue",
$configfile);
# Make an entry in the "[ports]" section
# The "perl" command patches the PostScript output to print the Euro
# symbol correctly.
- $configfile =removeentry("ports", "$queue=", $configfile);
- $configfile =addentry("ports",
+ $configfile = removeentry("ports", "$queue=", $configfile);
+ $configfile = addentry("ports",
"$queue=/usr/bin/perl -p -e \"s=16#80 /euro=16#80 /Euro=\" | /usr/bin/$printer::data::lprcommand{$printer->{SPOOLER}{print_command}} -P $queue",
$configfile);
# Make printer's section
@@ -219,21 +219,21 @@ sub makestarofficeprinterentry {
$pslevel = $1;
$pslevel = "2" if $pslevel eq "3";
} else { $pslevel = "2" }
- $configfile =removeentry("$queue.PostScript.$queue",
+ $configfile = removeentry("$queue.PostScript.$queue",
"Level=", $configfile);
- $configfile =addentry("$queue.PostScript.$queue",
+ $configfile = addentry("$queue.PostScript.$queue",
"Level=$pslevel", $configfile);
# Set Color/BW
my $color = ($ppd =~ /^\s*\*ColorDevice:\s*\"?([Tt]rue)\"?\s*$/m) ? "1" : "0";
- $configfile =removeentry("$queue.PostScript.$queue", "BitmapColor=", $configfile);
- $configfile =addentry("$queue.PostScript.$queue", "BitmapColor=$color", $configfile);
+ $configfile = removeentry("$queue.PostScript.$queue", "BitmapColor=", $configfile);
+ $configfile = addentry("$queue.PostScript.$queue", "BitmapColor=$color", $configfile);
# Set the default paper size
if ($ppd =~ /^\s*\*DefaultPageSize:\s*(\S+)\s*$/m) {
my $papersize = $1;
- $configfile =removeentry("$queue.PostScript.$queue", "PageSize=", $configfile);
- $configfile =removeentry("$queue.PostScript.$queue", "PPD_PageSize=", $configfile);
- $configfile =addentry("$queue.PostScript.$queue", "PageSize=$papersize", $configfile);
- $configfile =addentry("$queue.PostScript.$queue", "PPD_PageSize=$papersize", $configfile);
+ $configfile = removeentry("$queue.PostScript.$queue", "PageSize=", $configfile);
+ $configfile = removeentry("$queue.PostScript.$queue", "PPD_PageSize=", $configfile);
+ $configfile = addentry("$queue.PostScript.$queue", "PageSize=$papersize", $configfile);
+ $configfile = addentry("$queue.PostScript.$queue", "PPD_PageSize=$papersize", $configfile);
}
# Link the PPD file
run_program::rooted($::prefix,
@@ -267,7 +267,7 @@ sub makeopenofficeprinterentry {
$configfile = removeentry($queue, "Comment=", $configfile);
if (($printer->{configured}{$queue}) &&
($printer->{configured}{$queue}{queuedata}{desc})) {
- $configfile =addentry
+ $configfile = addentry
($queue,
"Comment=$printer->{configured}{$queue}{queuedata}{desc}",
$configfile);
diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm
index 6c2fb76fc..c4ef448c1 100644
--- a/perl-install/printer/printerdrake.pm
+++ b/perl-install/printer/printerdrake.pm
@@ -1109,7 +1109,7 @@ sub setup_socket {
join '', ("socket://$remotehost", $remoteport ? (":$remoteport") : ());
#- LPD and LPRng need netcat ('nc') to access to socket printers
- if ((($printer->{SPOOLER} eq 'lpd') || ($printer->{SPOOLER} eq 'lprng'))&&
+ if ((($printer->{SPOOLER} eq 'lpd') || ($printer->{SPOOLER} eq 'lprng')) &&
(!$::testing) &&
(!files_exist((qw(/usr/bin/nc))))) {
$in->do_pkgs->install('nc');
@@ -2068,12 +2068,12 @@ You should make sure that the page size and the ink type/printing mode (if avail
my $j;
for ($j = 0; $j <= $#{$choicelists[$i]}; $j++) {
if ($choicelists[$i][$j] eq $userinputs[$i]) {
- push(@{$printer->{currentqueue}{options}}, $printer->{ARGS}[$i]{name} . "=". $shortchoicelists[$i][$j]);
+ push(@{$printer->{currentqueue}{options}}, $printer->{ARGS}[$i]{name} . "=" . $shortchoicelists[$i][$j]);
}
}
} elsif ($printer->{ARGS}[$i]{type} eq 'bool') {
# boolean option
- push(@{$printer->{currentqueue}{options}}, $printer->{ARGS}[$i]{name} . "=".
+ push(@{$printer->{currentqueue}{options}}, $printer->{ARGS}[$i]{name} . "=" .
(($choicelists[$i][0] eq $userinputs[$i]) ? "1" : "0"));
} else {
# numerical option
@@ -3447,8 +3447,7 @@ What do you want to modify on this printer?",
#- URI)
if ($printer->{configured}{$queue}) {
foreach my $type (qw(file lpd socket smb ncp postpipe)) {
- if ($printer->{currentqueue}{connect}
- =~ /^$type:/) {
+ if ($printer->{currentqueue}{connect} =~ /^$type:/) {
$printer->{TYPE} =
($type eq 'file' ? 'LOCAL' : uc($type));
last;