summaryrefslogtreecommitdiffstats
path: root/perl-install/printer
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-11-06 10:37:18 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-11-06 10:37:18 +0000
commit9f0124c4939104748f33559a2efc017d6f41b369 (patch)
treef53cd6bf4a4ede7c2bd49aba78576ac112cd9da5 /perl-install/printer
parentd11b94c6f82a12bd0cc74843a5a5af59e82aeb56 (diff)
downloaddrakx-9f0124c4939104748f33559a2efc017d6f41b369.tar
drakx-9f0124c4939104748f33559a2efc017d6f41b369.tar.gz
drakx-9f0124c4939104748f33559a2efc017d6f41b369.tar.bz2
drakx-9f0124c4939104748f33559a2efc017d6f41b369.tar.xz
drakx-9f0124c4939104748f33559a2efc017d6f41b369.zip
escaped strings fixes
Diffstat (limited to 'perl-install/printer')
-rw-r--r--perl-install/printer/detect.pm20
-rw-r--r--perl-install/printer/main.pm53
-rw-r--r--perl-install/printer/office.pm8
-rw-r--r--perl-install/printer/printerdrake.pm34
4 files changed, 58 insertions, 57 deletions
diff --git a/perl-install/printer/detect.pm b/perl-install/printer/detect.pm
index 8455fe06e..e1583e311 100644
--- a/perl-install/printer/detect.pm
+++ b/perl-install/printer/detect.pm
@@ -186,7 +186,7 @@ sub whatNetPrinter {
# delays caused by machines blocking their ports with a firewall
local *F;
open F, ($::testing ? "" : "chroot $::prefix/ ") .
- "/bin/sh -c \"export LC_ALL=C; nmap -r -P0 --host_timeout 400 --initial_rtt_timeout 200 -p $portlist $hostlist\" |"
+ qq(/bin/sh -c "export LC_ALL=C; nmap -r -P0 --host_timeout 400 --initial_rtt_timeout 200 -p $portlist $hostlist" |)
or return @res;
my ($host, $ip, $port, $modelinfo) = ("", "", "", "");
while (my $line = <F>) {
@@ -252,7 +252,7 @@ sub getNetworkInterfaces() {
local *IFCONFIG_OUT;
open IFCONFIG_OUT, ($::testing ? "" : "chroot $::prefix/ ") .
- "/bin/sh -c \"export LC_ALL=C; ifconfig\" |" or return ();
+ '/bin/sh -c "export LC_ALL=C; ifconfig" |' or return ();
while (my $readline = <IFCONFIG_OUT>) {
# New entry ...
if ($readline =~ /^(\S+)\s/) {
@@ -283,7 +283,7 @@ sub getIPsOfLocalMachine() {
local *IFCONFIG_OUT;
open IFCONFIG_OUT, ($::testing ? "" : "chroot $::prefix/ ") .
- "/bin/sh -c \"export LC_ALL=C; ifconfig\" |" or return ();
+ '/bin/sh -c "export LC_ALL=C; ifconfig" |' or return ();
while (my $readline = <IFCONFIG_OUT>) {
# New entry ...
if ($readline =~ /^(\S+)\s/) {
@@ -325,7 +325,7 @@ sub getIPsInLocalNetworks() {
local *IFCONFIG_OUT;
open IFCONFIG_OUT, ($::testing ? "" : "chroot $::prefix/ ") .
- "/bin/sh -c \"export LC_ALL=C; ifconfig\" |" or return ();
+ '/bin/sh -c "export LC_ALL=C; ifconfig" |' or return ();
while (my $readline = <IFCONFIG_OUT>) {
# New entry ...
if ($readline =~ /^(\S+)\s/) {
@@ -357,7 +357,7 @@ sub getIPsInLocalNetworks() {
foreach my $bcast (@local_bcasts) {
local *F;
open F, ($::testing ? "" : "chroot $::prefix/ ") .
- "/bin/sh -c \"export LC_ALL=C; ping -w 1 -b -n $bcast | cut -f 4 -d ' ' | sed s/:// | egrep '^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+' | uniq | sort\" |"
+ qq(/bin/sh -c "export LC_ALL=C; ping -w 1 -b -n $bcast | cut -f 4 -d ' ' | sed s/:// | egrep '^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+' | uniq | sort" |)
or next;
local $_;
while (<F>) { chomp; push @addresses, $_ }
@@ -365,7 +365,7 @@ sub getIPsInLocalNetworks() {
if (-x "/usr/bin/nmblookup") {
local *F;
open F, ($::testing ? "" : "chroot $::prefix/ ") .
- "/bin/sh -c \"export LC_ALL=C; nmblookup -B $bcast \\* | cut -f 1 -d ' ' | egrep '^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+' | uniq | sort\" |"
+ qq(/bin/sh -c "export LC_ALL=C; nmblookup -B $bcast \\* | cut -f 1 -d ' ' | egrep '^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+' | uniq | sort" |)
or next;
local $_;
while (<F>) {
@@ -384,7 +384,7 @@ sub getSMBPrinterShares {
# SMB request to auto-detect shares
local *F;
open F, ($::testing ? "" : "chroot $::prefix/ ") .
- "/bin/sh -c \"export LC_ALL=C; smbclient -N -L $host\" |" or return ();
+ qq(/bin/sh -c "export LC_ALL=C; smbclient -N -L $host" |) or return ();
my $insharelist = 0;
my @shares;
while (my $l = <F>) {
@@ -416,7 +416,7 @@ sub getSNMPModel {
# SNMP request to auto-detect model
local *F;
open F, ($::testing ? $::prefix : "chroot $::prefix/ ") .
- "/bin/sh -c \"scli -v 1 -c 'show printer info' $host\" |" or
+ qq(/bin/sh -c "scli -v 1 -c 'show printer info' $host" |) or
return { CLASS => 'PRINTER',
MODEL => N("Unknown Model"),
MANUFACTURER => "",
@@ -477,8 +477,8 @@ sub network_running() {
# If the network is not running return 0, otherwise 1.
local *F;
open F, ($::testing ? $::prefix : "chroot $::prefix/ ") .
- "/bin/sh -c \"export LC_ALL=C; /sbin/ifconfig\" |" or
- die "Could not run \"ifconfig\"!";
+ '/bin/sh -c "export LC_ALL=C; /sbin/ifconfig" |' or
+ die 'Could not run "ifconfig"!';
while (my $line = <F>) {
if ($line !~ /^lo\s+/ && # The loopback device can have been
# started by the spooler's startup script
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm
index 9fd9997c3..ddadb605d 100644
--- a/perl-install/printer/main.pm
+++ b/perl-install/printer/main.pm
@@ -126,8 +126,8 @@ sub assure_device_is_available_for_cups {
for ($i = 0; $i < $maxattempts; $i++) {
local *F;
open F, ($::testing ? $::prefix : "chroot $::prefix/ ") .
- "/bin/sh -c \"export LC_ALL=C; /usr/sbin/lpinfo -v\" |" or
- die "Could not run \"lpinfo\"!";
+ '/bin/sh -c "export LC_ALL=C; /usr/sbin/lpinfo -v" |' or
+ die 'Could not run "lpinfo"!';
while (my $line = <F>) {
if ($line =~ /$sdevice/) { # Found a line containing the device
# name, so CUPS knows it.
@@ -2265,7 +2265,7 @@ sub configure_hpoj {
if ($bus ne "hpjd") {
# Stop ptal-mlcd daemon for locally connected devices
local *F;
- if (open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . "ps auxwww | grep \"ptal-mlcd $bus:probe\" | grep -v grep | ") {
+ if (open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . qq(ps auxwww | grep "ptal-mlcd $bus:probe" | grep -v grep | )) {
my $line = <F>;
if ($line =~ /^\s*\S+\s+(\d+)\s+/) {
my $pid = $1;
@@ -2326,34 +2326,35 @@ sub configure_hpoj {
# Write file header.
my $date = chomp_(`date`);
print CONFIG
- "# Added $date 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=2\n";
+qq(
+# Added $date by "printerdrake"
+
+# The basic format for this file is "key[+]=value".
+# If you say "+=" instead of "=", then the value is appended to any
+# value already defined for this key, rather than replacing it.
+
+# Comments must start at the beginning of the line. Otherwise, they may
+# be interpreted as being part of the value.
+
+# If you have multiple devices and want to define options that apply to
+# all of them, then put them in the file /etc/ptal/defaults, which is read
+# in before this file.
+
+# The format version of this file:
+# ptal-init ignores devices with incorrect/missing versions.
+init.version=2\n");
# Write model string.
if ($model_long !~ /\S/) {
print CONFIG
"\n" .
- "# \"printerdrake\" couldn't read the model but added this device anyway:\n" .
+ qq(# "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" .
+ qq(# 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
@@ -2362,7 +2363,7 @@ sub configure_hpoj {
}
}
print CONFIG
- "init.mlcd.append+=-devidmatch \"$model_long\"\n";
+ qq(init.mlcd.append+=-devidmatch "$model_long"\n);
# Write serial-number string.
if ($serialnumber_long !~ /\S/) {
@@ -2380,7 +2381,7 @@ sub configure_hpoj {
}
}
print CONFIG
- "init.mlcd.append+=-devidmatch \"$serialnumber_long\"\n";
+ qq(init.mlcd.append+=-devidmatch "$serialnumber_long"\n);
if ($bus =~ /^[pu]/) {
print CONFIG
@@ -2398,7 +2399,7 @@ sub configure_hpoj {
"\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" .
+ qq(# 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" .
@@ -2433,7 +2434,7 @@ sub configure_hpoj {
"\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" .
+ qq(# then change the line below to use the "-portoffset <n>" option.\n) .
"init.photod.append+=-maxaltports 26\n";
}
close(CONFIG);
@@ -2466,7 +2467,7 @@ sub usbdevice() {
# device numbers
local *F;
open F, ($::testing ? "" : "chroot $::prefix/ ") .
- "/bin/sh -c \"export LC_ALL=C; lsusb -vv 2> /dev/null\" |"
+ '/bin/sh -c "export LC_ALL=C; lsusb -vv 2> /dev/null" |'
or return undef;
my ($bus, $device, $model, $serial) = ("", "", "", "");
my $found = 0;
diff --git a/perl-install/printer/office.pm b/perl-install/printer/office.pm
index eccde17b5..4a6ae02b5 100644
--- a/perl-install/printer/office.pm
+++ b/perl-install/printer/office.pm
@@ -20,7 +20,7 @@ our $suites = {
'remove' => \&removeopenofficeprinterentry,
'file_name' => '^(.*)/share/psprint/psprint.conf$',
'param' => ["Generic Printer", "Command="],
- 'perl' => "/usr/bin/perl -p -e \"s=/euro /unused=/Euro /unused=\" | /usr/bin/",
+ 'perl' => '/usr/bin/perl -p -e "s=/euro /unused=/Euro /unused=" | /usr/bin/',
'files' => ["/usr/lib/office6*/share/psprint/psprint.conf",
"/usr/local/lib/office6*/share/psprint/psprint.conf",
"/usr/local/office6*/share/psprint/psprint.conf",
@@ -31,7 +31,7 @@ our $suites = {
'remove' => \&removestarofficeprinterentry,
'file_name' => '^(.*)/share/xp3/Xpdefaults$',
'param' => ["ports", "default_queue="],
- 'perl' => "/usr/bin/perl -p -e \"s=16#80 /euro=16#80 /Euro=\" | /usr/bin/",
+ 'perl' => '/usr/bin/perl -p -e "s=16#80 /euro=16#80 /Euro=" | /usr/bin/',
'files' => ["/usr/lib/*/share/xp3/Xpdefaults",
"/usr/local/lib/*/share/xp3/Xpdefaults",
"/usr/local/*/share/xp3/Xpdefaults",
@@ -216,7 +216,7 @@ sub makestarofficeprinterentry {
# symbol correctly.
$configfile = removeentry("ports", "$queue=", $configfile);
$configfile = addentry("ports",
- "$queue=/usr/bin/perl -p -e \"s=16#80 /euro=16#80 /Euro=\" | /usr/bin/" . $spoolers{$printer->{SPOOLER}}{print_command} . " -P $queue",
+ qq($queue=/usr/bin/perl -p -e "s=16#80 /euro=16#80 /Euro=" | /usr/bin/) . $spoolers{$printer->{SPOOLER}}{print_command} . " -P $queue",
$configfile);
# Make printer's section
$configfile = addsection("$queue,PostScript,$queue", $configfile);
@@ -270,7 +270,7 @@ sub makeopenofficeprinterentry {
# symbol correctly.
$configfile = removeentry($queue, "Command=", $configfile);
$configfile = addentry($queue,
- "Command=/usr/bin/perl -p -e \"s=/euro /unused=/Euro /unused=\" | /usr/bin/" . $spoolers{$printer->{SPOOLER}}{print_command} . " -P $queue",
+ qq(Command=/usr/bin/perl -p -e "s=/euro /unused=/Euro /unused=" | /usr/bin/) . $spoolers{$printer->{SPOOLER}}{print_command} . " -P $queue",
$configfile);
# "Comment" line
$configfile = removeentry($queue, "Comment=", $configfile);
diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm
index 80bf1360a..5a85d2467 100644
--- a/perl-install/printer/printerdrake.pm
+++ b/perl-install/printer/printerdrake.pm
@@ -224,7 +224,7 @@ N("Examples for correct IPs:\n") .
return (1,1);
}
if ($hostchoice eq $menu[0]) {
- $address = "\@LOCAL";
+ $address = '@LOCAL';
} elsif ($hostchoice eq $menu[-1]) {
$address = $ip;
} else {
@@ -1245,7 +1245,7 @@ sub setup_smb {
$smbserver = $1;
$smbshare = $2;
} else {
- die "The \"smb://\" URI must at least contain the server name and the share name!\n";
+ die qq(The "smb://" URI must at least contain the server name and the share name!\n);
}
if (network::is_ip($smbserver)) {
$smbserverip = $smbserver;
@@ -1433,7 +1433,7 @@ sub setup_ncp {
$ncpserver = $1;
$ncpqueue = $2;
} else {
- die "The \"ncp://\" URI must at least contain the server name and the share name!\n";
+ die qq(The "ncp://" URI must at least contain the server name and the share name!\n);
}
}
@@ -1652,7 +1652,7 @@ list => [ $printer->{currentqueue}{connect},
"ncp://",
"socket://",
"file:/",
- "postpipe:\"\"",
+ 'postpipe:""',
], not_edit => 0 }, ],
complete => sub {
unless ($printer->{currentqueue}{connect} =~ /[^:]+:.+/) {
@@ -1732,7 +1732,7 @@ sub setup_postpipe {
if ($printer->{configured}{$queue} &&
$printer->{currentqueue}{connect} =~ m/^postpipe:/) {
$uri = $printer->{currentqueue}{connect};
- $commandline = $1 if $uri =~ m!^\s*postpipe:\"(.*)\"$!;
+ $commandline = $1 if $uri =~ m!^\s*postpipe:"(.*)"$!;
} else {
$commandline = "";
}
@@ -3701,7 +3701,7 @@ sub mainwindow_interactive {
sub {
# Save the cursor position
$cursorpos = $menuchoice;
- $menuchoice = "\@addprinter";
+ $menuchoice = '@addprinter';
1;
},
val => N("Add a new printer") },
@@ -3711,7 +3711,7 @@ sub mainwindow_interactive {
sub {
# Save the cursor position
$cursorpos = $menuchoice;
- $menuchoice = "\@refresh";
+ $menuchoice = '@refresh';
1;
},
val => ($#printerlist < 0 ?
@@ -3721,7 +3721,7 @@ sub mainwindow_interactive {
sub {
# Save the cursor position
$cursorpos = $menuchoice;
- $menuchoice = "\@cupsconfig";
+ $menuchoice = '@cupsconfig';
1;
},
val => N("CUPS configuration") }) : ()),
@@ -3733,7 +3733,7 @@ sub mainwindow_interactive {
sub {
# Save the cursor position
$cursorpos = $menuchoice;
- $menuchoice = "\@spooler";
+ $menuchoice = '@spooler';
1;
},
val => N("Change the printing system") } :
@@ -3742,18 +3742,18 @@ sub mainwindow_interactive {
sub {
# Save the cursor position
$cursorpos = $menuchoice;
- $menuchoice = "\@usermode";
+ $menuchoice = '@usermode';
1
},
val => ($printer->{expert} ? N("Normal Mode") :
N("Expert Mode")) },
{ clicked_may_quit =>
- sub { $menuchoice = "\@quit"; 1 },
+ sub { $menuchoice = '@quit'; 1 },
val => ($::isEmbedded || $::isInstall ?
N("Done") : N("Quit")) },
]);
# Toggle expert mode and standard mode
- if ($menuchoice eq "\@usermode") {
+ if ($menuchoice eq '@usermode') {
$printer->{expert} = printer::main::set_usermode(!$printer->{expert});
# Read printer database for the new user mode
%printer::main::thedb = ();
@@ -3777,19 +3777,19 @@ sub mainwindow_interactive {
next;
}
# Refresh printer list
- next if $menuchoice eq "\@refresh";
+ next if $menuchoice eq '@refresh';
# Configure CUPS
- if ($menuchoice eq "\@cupsconfig") {
+ if ($menuchoice eq '@cupsconfig') {
config_cups($printer, $in, $upNetwork);
next;
}
# Call function to switch to another spooler
- if ($menuchoice eq "\@spooler") {
+ if ($menuchoice eq '@spooler') {
$printer->{SPOOLER} = setup_default_spooler($printer, $in, $upNetwork) || $printer->{SPOOLER};
next;
}
# Add a new print queue
- if ($menuchoice eq "\@addprinter") {
+ if ($menuchoice eq '@addprinter') {
$newcursorpos = add_printer($printer, $in, $upNetwork);
}
# Edit an existing print queue
@@ -3803,7 +3803,7 @@ sub mainwindow_interactive {
$newcursorpos = 1;
}
#- Close printerdrake
- $menuchoice eq "\@quit" and last;
+ $menuchoice eq '@quit' and last;
if ($newcursorpos) {
# Set the cursor onto the current menu entry