diff options
Diffstat (limited to 'perl-install')
40 files changed, 387 insertions, 400 deletions
diff --git a/perl-install/Xconfig/xfreeX.pm b/perl-install/Xconfig/xfreeX.pm index ca2f91423..5853342f9 100644 --- a/perl-install/Xconfig/xfreeX.pm +++ b/perl-install/Xconfig/xfreeX.pm @@ -284,7 +284,7 @@ sub add_Section { } sub remove_Section { my ($raw_X, $Section, $when) = @_; - @$raw_X = grep { $_->{name} ne $Section || ($when && $when->($_->{l})) } @$raw_X; + @$raw_X = grep { $_->{name} ne $Section || $when && $when->($_->{l}) } @$raw_X; $raw_X; } sub get_Sections { diff --git a/perl-install/any.pm b/perl-install/any.pm index 9fa757230..e183f46f1 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -128,7 +128,7 @@ sub setupBootloader { $boot : fsedit::get_root($fstab, 'boot')->{device}); } } else { - $in->set_help(arch() =~ /sparc/ ? "setupSILOGeneral" : arch() =~ /ppc/ ? 'setupYabootGeneral' :"setupBootloader") unless $::isStandalone; #- TO MERGE ? + $in->set_help(arch() =~ /sparc/ ? "setupSILOGeneral" : arch() =~ /ppc/ ? 'setupYabootGeneral' : "setupBootloader") unless $::isStandalone; #- TO MERGE ? my @silo_install_lang = (N("First sector of drive (MBR)"), N("First sector of boot partition")); my $silo_install_lang = $silo_install_lang[$b->{use_partition}]; diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index e13f250aa..81737f4c8 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -631,7 +631,7 @@ sub install_yaboot { if ($_->{type} eq "image") { my $of_dev = ''; - if (($boot !~ /$_->{root}/) && $boot) { + if ($boot !~ /$_->{root}/ && $boot) { $of_dev = get_of_dev($boot); print F "$_->{type}=$of_dev," . substr($_->{kernel_or_dev}, 5); } else { @@ -640,7 +640,7 @@ sub install_yaboot { } print F "\tlabel=", substr($_->{label}, 0, 15); #- lilo doesn't handle more than 15 char long labels print F "\troot=$_->{root}"; - if (($boot !~ /$_->{root}/) && $boot) { + if ($boot !~ /$_->{root}/ && $boot) { print F "\tinitrd=$of_dev," . substr($_->{initrd}, 5) if $_->{initrd}; } else { print F "\tinitrd=$of_dev,$_->{initrd}" if $_->{initrd}; @@ -732,8 +732,8 @@ sub install_silo { } log::l("Installing boot loader..."); $::testing and return; - run_program::rooted($::prefix, "silo", "2>", "/tmp/.error", $silo->{use_partition} ? ("-t") : ()) or - run_program::rooted_or_die($::prefix, "silo", "2>", "/tmp/.error", "-p", "2", $silo->{use_partition} ? ("-t") : ()); + run_program::rooted($::prefix, "silo", "2>", "/tmp/.error", $silo->{use_partition} ? "-t" : ()) or + run_program::rooted_or_die($::prefix, "silo", "2>", "/tmp/.error", "-p", "2", $silo->{use_partition} ? "-t" : ()); unlink "$::prefix/tmp/.error"; #- try writing in the prom. diff --git a/perl-install/bootlook.pm b/perl-install/bootlook.pm index 2eba6b460..58cd29cf7 100644 --- a/perl-install/bootlook.pm +++ b/perl-install/bootlook.pm @@ -117,8 +117,8 @@ if (member( $cur_res, qw( 785 788 791 794))) { #- and check that lilo is the correct loader $no_bootsplash ||= chomp_(`detectloader -q`) ne 'LILO'; my @thms; -my @lilo_thms = (($themes{'default'}) ?() :qw(default)); -my @boot_thms = (($themes{'default'}) ?() :qw(default)); +my @lilo_thms = ($themes{'default'} ? () : qw(default)); +my @boot_thms = ($themes{'default'} ? () : qw(default)); chdir($themes{'path'}); #- we must change directory for correct @thms assignement foreach (all('.')) { if (-d $themes{'path'} . $_ && m/^[^.]/) { @@ -156,8 +156,8 @@ $B_create->signal_connect(clicked => sub { $combo{'thms'}->entry->signal_connect(changed => sub { my $thm_txt = $combo{'thms'}->entry->get_text(); - $combo{'lilo'}->entry->set_text(member($thm_txt, @lilo_thms) ? $thm_txt : ($themes{'default'} || 'default')); - $combo{'boot'}->entry->set_text(member($thm_txt, @boot_thms) ? $thm_txt : ($themes{'default'} || 'default')); + $combo{'lilo'}->entry->set_text(member($thm_txt, @lilo_thms) ? $thm_txt : $themes{'default'} || 'default'); + $combo{'boot'}->entry->set_text(member($thm_txt, @boot_thms) ? $thm_txt : $themes{'default'} || 'default'); }); @@ -376,7 +376,7 @@ sub parse_etc_passwd { do { @user_info = getpwent(); ($uname, $uid) = @user_info[0,2]; - push (@usernames, $uname) if ($uid > 500) and !($uname eq "nobody"); + push (@usernames, $uname) if $uid > 500 and !($uname eq "nobody"); } while @user_info; } @@ -408,7 +408,7 @@ sub isXlaunched { } sub updateInit { - my $runlevel = ($x_mode) ? 5 : 3; + my $runlevel = $x_mode ? 5 : 3; substInFile { s/^id:\d:initdefault:\s*$/id:$runlevel:initdefault:\n/ } "/etc/inittab"; } diff --git a/perl-install/commands.pm b/perl-install/commands.pm index f871cf6ea..f5cc2f44c 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -54,7 +54,7 @@ sub grep_ { @_ == 0 || $h and die "usage: grep <regexp> [files...]\n"; my $r = shift; $r = qr/$r/i if $i; - @ARGV = @_; (/$r/ ? $v || print : $v && print) while <>; + @ARGV = @_; (/$r/ xor $v) and print while <>; } sub tr_ { @@ -193,11 +193,11 @@ sub rights { if (vec(pack("S", $_[0]), $i, 1)) { my ($val, $place) = $i >= 9 ? @{$rights[$i]} : ($rights[$i], $i); my $old = \substr($r, 8 - $place, 1); - $$old = ($$old eq '-' && $i >= 9) ? uc $val : $val; + $$old = $$old eq '-' && $i >= 9 ? uc $val : $val; } } my @types = split //, "_pc_d_b_-_l_s"; - $types[$_[0] >> 12 & 0xf] . $r; + $types[($_[0] >> 12) & 0xf] . $r; } sub displaySize { @@ -268,14 +268,14 @@ sub dd { $h{$1} = $2; } local (*IF, *OF); my ($tmp, $nb, $read); - ref $h{if} eq 'GLOB' ? *IF = $h{if} : sysopen(IF, $h{if}, 0) || die "error: can't open file $h{if}\n"; - ref $h{of} eq 'GLOB' ? *OF = $h{of} : sysopen(OF, $h{of}, 0x41) || die "error: can't open file $h{of}\n"; + ref $h{if} eq 'GLOB' ? (*IF = $h{if}) : sysopen(IF, $h{if}, 0) || die "error: can't open file $h{if}\n"; + ref $h{of} eq 'GLOB' ? (*OF = $h{of}) : sysopen(OF, $h{of}, 0x41) || die "error: can't open file $h{of}\n"; $h{bs} = removeXiBSuffix($h{bs}); for ($nb = 0; !$h{count} || $nb < $h{count}; $nb++) { printf "\r%02.1d%%", 100 * $nb / $h{count} if $h{count} && $percent; - $read = sysread(IF, $tmp, $h{bs}) or $h{count} ? die "error: can't read block $nb\n" : last; + $read = sysread(IF, $tmp, $h{bs}) or ($h{count} ? die "error: can't read block $nb\n" : last); syswrite(OF, $tmp) or die "error: can't write block $nb\n"; $read < $h{bs} and $read = 1, last; } @@ -473,9 +473,9 @@ $dev, $size, $used, $free, $use, $mntpoint $use = int(100 * ($size - $free) / $size); $used = $size - $free; if ($h) { - $used = int ($used / 1024) . "M"; - $size = int ($size / 1024) . "M"; - $free = int ($free / 1024) . "M"; + $used = int($used / 1024 . "M"); + $size = int($size / 1024 . "M"); + $free = int($free / 1024 . "M"); } write DF if $size; } diff --git a/perl-install/crypto.pm b/perl-install/crypto.pm index eae03336d..c44723e14 100644 --- a/perl-install/crypto.pm +++ b/perl-install/crypto.pm @@ -44,7 +44,7 @@ use ftp; %mirrors = (); -sub mirror2text { $mirrors{$_[0]} && ($mirrors{$_[0]}[0] . '|' . $_[0]) } +sub mirror2text { $mirrors{$_[0]} && $mirrors{$_[0]}[0] . '|' . $_[0] } sub mirrors { unless (keys %mirrors) { #- contact the following URL to retrieve list of mirror. diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 3ad4c31b6..23a867c2f 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -286,7 +286,7 @@ sub getIDE() { my $type = ${{ disk => 'hd', cdrom => 'cdrom', tape => 'tape', floppy => 'fd' }}{$t} or next; my $info = chomp_(cat_("$d/model")) || "(none)"; - my $num = ord (($d =~ /(.)$/)[0]) - ord 'a'; + my $num = ord(($d =~ /(.)$/)[0]) - ord 'a'; my ($vendor, $model) = map { if_($info =~ /^$_(-|\s)*(.*)/, $eide_hds{$_}, $2); } keys %eide_hds; @@ -640,23 +640,20 @@ sub whatUsbport() { # Extract the printer data from the ID string my ($manufacturer, $model, $serialnumber, $description) = ("", "", "", ""); - if (($idstr =~ /MFG:([^;]+);/) || - ($idstr =~ /MANUFACTURER:([^;]+);/)) { + if ($idstr =~ /MFG:([^;]+);/ || $idstr =~ /MANUFACTURER:([^;]+);/) { $manufacturer = $1; $manufacturer =~ s/Hewlett[-\s_]Packard/HP/; $manufacturer =~ s/HEWLETT[-\s_]PACKARD/HP/; } # For HP's multi-function devices the real model name is in the "SKU" # field. So use this field with priority for $model when it exists. - if (($idstr =~ /MDL:([^;]+);/) || - ($idstr =~ /MODEL:([^;]+);/)) { + if ($idstr =~ /MDL:([^;]+);/ || $idstr =~ /MODEL:([^;]+);/) { $model ||= $1; } if ($idstr =~ /SKU:([^;]+);/) { $model = $1; } - if (($idstr =~ /DES:([^;]+);/) || - ($idstr =~ /DESCRIPTION:([^;]+);/)) { + if ($idstr =~ /DES:([^;]+);/ || $idstr =~ /DESCRIPTION:([^;]+);/) { $description = $1; $description =~ s/Hewlett[-\s_]Packard/HP/; $description =~ s/HEWLETT[-\s_]PACKARD/HP/; @@ -665,7 +662,7 @@ sub whatUsbport() { $serialnumber = $1; } # Was there a manufacturer and a model in the string? - if (($manufacturer eq "") || ($model eq "")) { + if ($manufacturer eq "" || $model eq "") { next; } # No description field? Make one out of manufacturer and model. diff --git a/perl-install/devices.pm b/perl-install/devices.pm index 32c52904c..20e5c157b 100644 --- a/perl-install/devices.pm +++ b/perl-install/devices.pm @@ -27,7 +27,7 @@ sub size($) { for ($high = 1; $high > 0 && &$valid_offset($high); $high *= 2) { $low = $high } while ($low < $high - 1) { - $mid = int ($low + $high) / 2; + $mid = int(($low + $high) / 2); &$valid_offset($mid) ? $low : $high = $mid; } $low + 1; diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm index f8852466c..bbbcc6bdc 100644 --- a/perl-install/diskdrake/hd_gtk.pm +++ b/perl-install/diskdrake/hd_gtk.pm @@ -95,7 +95,7 @@ sub main { if $::isStandalone; $in->ask_warn('', N("If you plan to use aboot, be carefull to leave a free space (2048 sectors is enough) -at the beginning of the disk")) if (arch() eq 'alpha') and !$::isEmbedded; +at the beginning of the disk")) if arch() eq 'alpha' and !$::isEmbedded; $w->main; } diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 0c07e5d9a..f60807af0 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -396,8 +396,8 @@ sub mount_options_help { my $prev_tp = $tp; $tp = /^\.(TP|RE)/; my ($s) = /^\.B (.*)/; - if ($prev_tp && $s eq '\-o' .. /X^/) { - if (my $v = $prev_tp && $s =~ /^[a-z]/i .. $tp) { + if (($prev_tp && $s eq '\-o') .. /X^/) { + if (my $v = ($prev_tp && $s =~ /^[a-z]/i) .. $tp) { if ($v == 1) { $s = $short{$s} || $s; $option = exists $help{$s} && !$help{$s} ? $s : ''; diff --git a/perl-install/ftp.pm b/perl-install/ftp.pm index f9a046e2d..3123edc34 100644 --- a/perl-install/ftp.pm +++ b/perl-install/ftp.pm @@ -56,7 +56,7 @@ sub getFile { eval { $$retr->close if $$retr }; $@ and rewindGetFile(); #- in case Timeout got us on "->close" $$retr = $ftp->retr($f) and return $$retr; - ($ftp->code == 550) and log::l("FTP: 550 file unavailable"), return; + $ftp->code == 550 and log::l("FTP: 550 file unavailable"), return; rewindGetFile(); log::l("ftp get failed, sleeping before trying again"); sleep 1; diff --git a/perl-install/harddrake/data.pm b/perl-install/harddrake/data.pm index 25909bb2d..479623d9d 100644 --- a/perl-install/harddrake/data.pm +++ b/perl-install/harddrake/data.pm @@ -11,7 +11,7 @@ my @devices = detect_devices::probeall(1); # Update me each time you handle one more devices class (aka configurator) sub unknown { - grep { ($_->{media_type} !~ /tape|SERIAL_(USB|SMBUS)|Printer|DISPLAY|MULTIMEDIA_(VIDEO|AUDIO|OTHER)|STORAGE_(IDE|SCSI|OTHER)|BRIDGE|NETWORK/) && ($_->{driver} ne '^(scanner|usbvideo)$') && $_->{type} ne 'network' && $_->{driver} !~ /Mouse:USB|class\|Mouse/ } @devices; + grep { $_->{media_type} !~ /tape|SERIAL_(USB|SMBUS)|Printer|DISPLAY|MULTIMEDIA_(VIDEO|AUDIO|OTHER)|STORAGE_(IDE|SCSI|OTHER)|BRIDGE|NETWORK/ && $_->{driver} ne '^(scanner|usbvideo)$' && $_->{type} ne 'network' && $_->{driver} !~ /Mouse:USB|class\|Mouse/ } @devices; } @@ -28,7 +28,7 @@ our @tree = ["DVDROM", "DVD-ROM", "cd.png", "", sub { grep { ! detect_devices::isBurner($_) } detect_devices::dvdroms() }, 0 ], ["TAPE", "Tape", "tape.png", "", \&detect_devices::tapes, 0 ], ["VIDEO", "Videocard", "video.png", "$sbindir/XFdrake", sub { grep { $_->{driver} =~ /^(Card|Server):/ || $_->{media_type} =~ /DISPLAY_VGA/ } @devices }, 1 ], - ["TV", "Tvcard", "tv.png", "/usr/bin/XawTV", sub { grep { ($_->{media_type} =~ /MULTIMEDIA_VIDEO/ && $_->{bus} eq 'PCI') || $_->{driver} eq 'usbvision' } @devices }, 0 ], + ["TV", "Tvcard", "tv.png", "/usr/bin/XawTV", sub { grep { $_->{media_type} =~ /MULTIMEDIA_VIDEO/ && $_->{bus} eq 'PCI' || $_->{driver} eq 'usbvision' } @devices }, 0 ], ["MULTIMEDIA_OTHER", "Other MultiMedia devices", "multimedia.png", "", sub { grep { $_->{media_type} =~ /MULTIMEDIA_OTHER/ } @devices }, 0 ], ["AUDIO", "Soundcard", "sound.png", "$sbindir/draksound", sub { grep { $_->{media_type} =~ /MULTIMEDIA_AUDIO/ } @devices }, 0 ], ["WEBCAM", "Webcam", "webcam.png", "", sub { grep { $_->{media_type} =~ /MULTIMEDIA_VIDEO/ && $_->{bus} ne 'PCI' } @devices }, 0 ], diff --git a/perl-install/harddrake/ui.pm b/perl-install/harddrake/ui.pm index b6e6da7b2..34c9a670d 100644 --- a/perl-install/harddrake/ui.pm +++ b/perl-install/harddrake/ui.pm @@ -148,7 +148,7 @@ sub detect { if (exists $_->{bus} && $_->{bus} eq 'ide') { $_->{channel} = $_->{channel} ? N("secondary") : N("primary"); delete $_->{info}; - } elsif ((exists $_->{id}) && ($_->{bus} ne 'PCI')) { + } elsif ((exists $_->{id}) && $_->{bus} ne 'PCI') { # SCSI detection incoherency: my $i = $_; $_->{bus_location} = join ':', map { sprintf("%lx", $i->{$_}) } qw(bus id); @@ -226,7 +226,7 @@ sub new { foreach my $i (sort keys %$current_device) { if ($fields{$i}[0]) { $text->insert("", $text->style->black, "", $fields{$i}[0] . ": "); - $text->insert("", ($i eq 'driver' && $current_device->{$i} eq 'unknown') ? $wcolor : $color, + $text->insert("", $i eq 'driver' && $current_device->{$i} eq 'unknown' ? $wcolor : $color, "", "$current_device->{$i}\n\n"); } else { print "Skip \"$i\" field => \"$current_device->{$i}\"\n\n" } } diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 8e94b6bbe..a5a185759 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -379,7 +379,7 @@ sub setDefaultPackages { $o->{compssUsersChoice}{USB} = 1 if modules::get_probeall("usb-interface"); $o->{compssUsersChoice}{PCMCIA} = 1 if detect_devices::hasPCMCIA(); $o->{compssUsersChoice}{HIGH_SECURITY} = 1 if $o->{security} > 3; - $o->{compssUsersChoice}{BIGMEM} = 1 if !$::oem && (availableRamMB() > 800) && (arch() !~ /ia64/); + $o->{compssUsersChoice}{BIGMEM} = 1 if !$::oem && availableRamMB() > 800 && arch() !~ /ia64/; $o->{compssUsersChoice}{SMP} = 1 if detect_devices::hasSMP(); $o->{compssUsersChoice}{CDCOM} = 1 if grep { $_->{descr} =~ /commercial/i } values %{$o->{packages}{mediums}}; $o->{compssUsersChoice}{'3D'} = 1 if @@ -963,7 +963,7 @@ sub generate_automatic_stage1_params { adsluser => 'adslu', adslpass => 'adslp', hostname => 'hos', domain => 'dom', server => 'ser', directory => 'dir', user => 'use', pass => 'pas', disk => 'dis', partition => 'par'); - 'automatic='.join(',', map { (/^([^:]+)(:.*)/ && $aliases{$1}) ? $aliases{$1}.$2 : $_ } @ks); + 'automatic='.join(',', map { /^([^:]+)(:.*)/ && $aliases{$1} ? $aliases{$1}.$2 : $_ } @ks); } sub guess_mount_point { diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 40e6cdb35..e29efddf0 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -48,8 +48,8 @@ sub new($$) { unless (-d "/var/log") { mkdir("/var/log") } local $SIG{CHLD} = sub { $ok = 0 if waitpid(-1, c::WNOHANG()) > 0 }; unless (fork) { - exec $_[0], (arch() =~ /^sparc/ || arch() eq "ppc" ? () : ("-kb")), "-dpms", "-s", "240", - ($_[0] =~ /Xpmac/ ? $xpmac_opts !~ /ofonly/ ? ("-mode", "17", "-depth", "32") : ("-mach64") :()), + exec $_[0], (arch() =~ /^sparc/ || arch() eq "ppc" ? () : "-kb"), "-dpms", "-s", "240", + ($_[0] =~ /Xpmac/ ? $xpmac_opts !~ /ofonly/ ? ("-mode", "17", "-depth", "32") : "-mach64" : ()), ($_[0] =~ /Xsun/ || $_[0] =~ /Xpmac/ ? ("-fp", "/usr/X11R6/lib/X11/fonts:unscaled") : ("-allowMouseOpenFail", "-xf86config", $f)) or exit 1; } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 8490e72f3..0514093ff 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -1063,7 +1063,7 @@ sub configurePrinter { #- try to determine if a question should be asked to the user or #- if he is autorized to configure multiple queues. - my $ask_multiple_printer = ($::expert || $clicked) && 2 || ($o && printer::detect::local_detect()); + my $ask_multiple_printer = ($::expert || $clicked) && 2 || $o && printer::detect::local_detect(); $ask_multiple_printer-- or return; #- install packages needed for printer::getinfo() @@ -1074,9 +1074,9 @@ sub configurePrinter { my $printer = $o->{printer} ||= {}; eval { add2hash($printer, printer::main::getinfo($o->{prefix})) }; - $printer->{PAPERSIZE} = (($o->{lang} =~ /^en_US/) || - ($o->{lang} =~ /^en_CA/) || - ($o->{lang} =~ /^fr_CA/)) ? 'Letter' : 'A4'; + $printer->{PAPERSIZE} = ($o->{lang} =~ /^en_US/ || + $o->{lang} =~ /^en_CA/ || + $o->{lang} =~ /^fr_CA/) ? 'Letter' : 'A4'; printer::printerdrake::main($printer, $o, $ask_multiple_printer, sub { install_interactive::upNetwork($o, 'pppAvoided') }); } @@ -1156,7 +1156,7 @@ sub addUser { push @{$o->{users}}, { password => 'mandrake', realname => 'default', icon => 'automagic' } if !member('mandrake', map { $_->{name} } @{$o->{users}}); } - if (($o->{security} >= 1 || $clicked)) { + if ($o->{security} >= 1 || $clicked) { any::ask_users($o->{prefix}, $o, $o->{users}, $o->{security}); } any::get_autologin($o->{prefix}, $o); diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm index 53d7d72c2..b4c09afe6 100644 --- a/perl-install/interactive/gtk.pm +++ b/perl-install/interactive/gtk.pm @@ -115,7 +115,7 @@ sub create_clist { $l[($j + $curr) % @l] =~ /$start_reg$word/i and last; } $j == @l ? - $starting_word = '' : + ($starting_word = '') : $select->(($j + $curr) % @l); $timeout = Gtk->timeout_add($forgetTime, sub { $timeout = $starting_word = ''; 0 }); diff --git a/perl-install/interactive/newt.pm b/perl-install/interactive/newt.pm index b15b92a57..2f5f18791 100644 --- a/perl-install/interactive/newt.pm +++ b/perl-install/interactive/newt.pm @@ -144,7 +144,7 @@ sub ask_fromW_real { } @{$e->{list}}; }; } else { - $w = Newt::Component::Entry(-1, -1, '', 20, ($e->{hidden} && 1 << 11) | 1 << 2); + $w = Newt::Component::Entry(-1, -1, '', 20, ($e->{hidden} && 1 << 11) | (1 << 2)); $get = sub { $w->EntryGetValue }; $set = sub { $w->EntrySet($_[0], 1) }; } diff --git a/perl-install/interactive/stdio.pm b/perl-install/interactive/stdio.pm index 1952cc0e5..0fa6bf3d7 100644 --- a/perl-install/interactive/stdio.pm +++ b/perl-install/interactive/stdio.pm @@ -74,7 +74,7 @@ ask_fromW_begin: ${$e->{val}} = $i; } } elsif ($e->{type} =~ /list/) { - ($e->{text} || $e->{label}) and print "=> $e->{label} $e->{text}\n"; + $e->{text} || $e->{label} and print "=> $e->{label} $e->{text}\n"; my $n = 0; my $size = 0; my $def_n = 0; foreach (@{$e->{list}}) { $n++; @@ -95,7 +95,7 @@ ask_fromW_begin: print N("Button `%s': %s", $e->{label}, may_apply($e->{format}, ${$e->{val}})), " $e->{text}\n"; print N("Do you want to click on this button?"); my $i = readln(); - ($i && $i !~ /^n/i) and $e->{clicked_may_quit}(), $common->{callbacks}{changed}->($ind); + $i && $i !~ /^n/i and $e->{clicked_may_quit}(), $common->{callbacks}{changed}->($ind); } elsif ($e->{type} eq 'label') { my $t = $format_label->($e); push @labels, $t; diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 2f991a988..8ac168de8 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -65,7 +65,7 @@ sub new { $style->font(Gtk::Gdk::Font->fontset_load(N("-adobe-utopia-regular-r-*-*-25-*-*-*-p-*-iso8859-*,*-r-*"))); my $w = $style->font->string_width($::Wizard_title); $draw1->signal_connect(expose_event => sub { - for (my $i = 0; $i < (540/$y1); $i++) { + for (my $i = 0; $i < 540/$y1; $i++) { $draw1->window->draw_pixmap($draw1->style->bg_gc('normal'), $im_up, 0, 0, 0, $y1*$i, $x1, $y1); @@ -77,7 +77,7 @@ sub new { } }); $draw2->signal_connect(expose_event => sub { - for (my $i = 0; $i < (300/$y2); $i++) { + for (my $i = 0; $i < 300/$y2; $i++) { $draw2->window->draw_pixmap($draw2->style->bg_gc('normal'), $im_left, 0, 0, 0, $y2*$i, $x2, $y2); @@ -363,7 +363,7 @@ sub ask_browse_tree_info { 0, my $l = new Gtk::HBox(0,15), 0, gtkpack(new Gtk::HBox(0,10), my $go = gtksignal_connect(new Gtk::Button($common->{ok}), "clicked" => sub { $w->{retval} = 1; Gtk->main_quit }), - $common->{cancel} ? (gtksignal_connect(new Gtk::Button($common->{cancel}), "clicked" => sub { $w->{retval} = 0; Gtk->main_quit })) : (), + $common->{cancel} ? gtksignal_connect(new Gtk::Button($common->{cancel}), "clicked" => sub { $w->{retval} = 0; Gtk->main_quit }) : (), ) )); gtkpack__($l, my $toolbar = new Gtk::Toolbar('horizontal', 'icons')); diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index 79884887a..1594aba32 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -133,12 +133,12 @@ sub write_interface_conf { if ($hwaddr) { chomp $hwaddr; $hwaddr =~ s/.*link\/ether\s([0-9a-z:]+)\s.*/$1/ } $hwaddr and $intf->{HWADDR} = undef; add2hash($intf, { - BROADCAST => join('.', mapn { int $_[0] | ~int $_[1] & 255 } \@ip, \@mask), - NETWORK => join('.', mapn { int $_[0] & $_[1] } \@ip, \@mask), + BROADCAST => join('.', mapn { int($_[0]) | ((~int($_[1])) & 255) } \@ip, \@mask), + NETWORK => join('.', mapn { int($_[0]) & $_[1] } \@ip, \@mask), ONBOOT => bool2yesno(!member($intf->{DEVICE}, map { $_->{device} } detect_devices::probeall())), if_($::o->{miscellaneous}{track_network_id}, HWADDR => $hwaddr) }); - setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR), ($intf->{wireless_eth}) ? qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV) : ()); + setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR), $intf->{wireless_eth} ? qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV) : ()); } sub add2hosts { diff --git a/perl-install/network/smb.pm b/perl-install/network/smb.pm index d1f2128bf..06bd70609 100644 --- a/perl-install/network/smb.pm +++ b/perl-install/network/smb.pm @@ -92,7 +92,7 @@ sub find_exports { s/^\t//; /NT_STATUS_/ and die $_; my ($name, $type, $comment) = unpack "A15 A10 A*", $_; - if ($name eq '---------' && $type eq '----' && $comment eq '-------' .. /^$/) { + if (($name eq '---------' && $type eq '----' && $comment eq '-------') .. /^$/) { push @l, { name => $name, type => $type, comment => $comment, server => $server } if $type eq 'Disk' && $name !~ /\$$/ && $name !~ /NETLOGON|SYSVOL/; } diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index 88cacba9d..53dc1b5ff 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -53,8 +53,8 @@ sub ask_connect_now { my $netc = {}; $up = connected(); } - my $m = $up ? (N("The system is now connected to Internet.") . - if_($::isInstall, N("For security reason, it will be disconnected now."))) : + my $m = $up ? N("The system is now connected to Internet.") . + if_($::isInstall, N("For security reason, it will be disconnected now.")) : N("The system doesn't seem to be connected to internet. Try to reconfigure your connection."); if ($::isWizard) { diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm index 3518e6738..b5f16df87 100644 --- a/perl-install/partition_table/dos.pm +++ b/perl-install/partition_table/dos.pm @@ -42,7 +42,7 @@ sub CHS2rawCHS { $h = $hd->{geom}{heads} - 1; $s = $hd->{geom}{sectors}; } - ($c & 0xff, $h, $s | ($c >> 2 & 0xc0)); + ($c & 0xff, $h, $s | (($c >> 2) & 0xc0)); } # returns (cylinder, head, sector) diff --git a/perl-install/partition_table/mac.pm b/perl-install/partition_table/mac.pm index 7fd442d8f..cf5ca8a37 100644 --- a/perl-install/partition_table/mac.pm +++ b/perl-install/partition_table/mac.pm @@ -206,7 +206,7 @@ sub write($$$;$) { # Find the partition map. my @partstowrite; my $part = $pt->[0]; - (defined $part->{isMap}) or die "the first partition is not the partition map"; + defined $part->{isMap} or die "the first partition is not the partition map"; push @partstowrite, $part; # Now go thru the partitions, sort and fill gaps. diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 21d03a920..6f48312f1 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -743,7 +743,7 @@ sub rpmDbOpen { if ($rebuild_needed) { if (my $pid = fork()) { waitpid $pid, 0; - ($? & 0xff00) and die "rebuilding of rpm database failed"; + $? & 0xff00 and die "rebuilding of rpm database failed"; } else { log::l("rebuilding rpm database"); my $rebuilddb_dir = "$prefix/var/lib/rpmrebuilddb.$$"; diff --git a/perl-install/printer/cups.pm b/perl-install/printer/cups.pm index 1de54edf2..c932f1f81 100644 --- a/perl-install/printer/cups.pm +++ b/perl-install/printer/cups.pm @@ -16,8 +16,8 @@ sub get_remote_queues { while ($line = <F>) { if ($line =~ m/^\s*device\s+for\s+([^:\s]+):\s*(\S+)\s*$/) { my $queuename = $1; - if (($2 =~ m!^ipp://([^/:]+)[:/]!) && - (!$printer->{configured}{$queuename})) { + if ($2 =~ m!^ipp://([^/:]+)[:/]! && + !$printer->{configured}{$queuename}) { my $server = $1; push (@printerlist, "$queuename|$server"); } diff --git a/perl-install/printer/detect.pm b/perl-install/printer/detect.pm index e26c0914a..6aa03db11 100644 --- a/perl-install/printer/detect.pm +++ b/perl-install/printer/detect.pm @@ -125,7 +125,7 @@ sub getIPsInLocalNetworks { # ... for a local network (eth = ethernet, # vmnet = VMWare, # ethernet card connected to ISP excluded)? - $dev_is_localnet = (($dev =~ /^eth/) || ($dev =~ /^vmnet/)); + $dev_is_localnet = ($dev =~ /^eth/ || $dev =~ /^vmnet/); # delete previous address $current_bcast = ""; } @@ -185,8 +185,8 @@ sub getSMBPrinterShares { $insharelist = 1; } elsif ($l =~ /^\s*Server\s+Comment\s*$/i) { $insharelist = 0; - } elsif (($l =~ /^\s*(\S+)\s+Printer\s*(.*)$/i) && - ($insharelist)) { + } elsif ($l =~ /^\s*(\S+)\s+Printer\s*(.*)$/i && + $insharelist) { my $name = $1; my $description = $2; $description =~ s/^(\s*)//; @@ -217,8 +217,8 @@ sub getSNMPModel { }; while (my $l = <F>) { chomp $l; - if (($l =~ /^\s*Manufacturer:\s*(\S.*)$/i) && - ($l =~ /^\s*Vendor:\s*(\S.*)$/i)) { + if ($l =~ /^\s*Manufacturer:\s*(\S.*)$/i && + $l =~ /^\s*Vendor:\s*(\S.*)$/i) { $manufacturer = $1; $manufacturer =~ s/Hewlett[-\s_]Packard/HP/; $manufacturer =~ s/HEWLETT[-\s_]PACKARD/HP/; @@ -236,7 +236,7 @@ sub getSNMPModel { # Was there a manufacturer and a model in the output? # If not, get them from the description - if (($manufacturer eq "") || ($model eq "")) { + if ($manufacturer eq "" || $model eq "") { if ($description =~ /^\s*(\S*)\s+(\S.*)$/) { $manufacturer = $1 if $manufacturer eq ""; $model = $2 if $model eq ""; @@ -272,9 +272,9 @@ sub network_running { "/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 + if ($line !~ /^lo\s+/ && # The loopback device can have been # started by the spooler's startup script - ($line =~ /^(\S+)\s+/)) { # In this line starts an entry for a + $line =~ /^(\S+)\s+/) { # In this line starts an entry for a # running network close F; return 1; diff --git a/perl-install/printer/gimp.pm b/perl-install/printer/gimp.pm index d9264fd81..c292e583c 100644 --- a/perl-install/printer/gimp.pm +++ b/perl-install/printer/gimp.pm @@ -79,7 +79,7 @@ sub addcupsremoteto { return 1 if $#configfilenames < 0; my @printerlist = printer::cups::get_remote_queues(); my $ppdfile = ""; - if (($printer->{SPOOLER} eq "cups") && + if ($printer->{SPOOLER} eq "cups" && ((-x "$::prefix/usr/bin/curl") || (-x "$::prefix/usr/bin/wget"))) { foreach my $listentry (@printerlist) { next if !($listentry =~ /^([^\|]+)\|([^\|]+)$/); @@ -101,8 +101,7 @@ sub addcupsremoteto { } # Does the file exist and is it not an error message? if ((-r "$::prefix/etc/foomatic/$queue.ppd") && - (cat_("$::prefix/etc/foomatic/$queue.ppd") =~ - /^\*PPD-Adobe/)) { + cat_("$::prefix/etc/foomatic/$queue.ppd") =~ /^\*PPD-Adobe/) { $ppdfile = "/etc/foomatic/$queue.ppd"; } else { unlink "$::prefix/etc/foomatic/$queue.ppd"; @@ -224,11 +223,11 @@ sub findconfigfiles { chomp; if (/^([^:]+):[^:]*:([^:]+):([^:]+):[^:]*:([^:]+):[^:]*$/) { my ($username, $uid, $gid, $homedir) = ($1, $2, $3, $4); - if ((($uid == 0) || ($uid >= 500)) && ($username ne "nobody")) { + if (($uid == 0 || $uid >= 500) && $username ne "nobody") { foreach my $file (@configfilenames) { my $dir = "$homedir/$file"; $dir =~ s,/[^/]*$,,; - next if (-f $dir) && (! -d $dir); + next if (-f $dir) && ! -d $dir; if (! -d "$::prefix$dir") { mkdir_p("$::prefix$dir") or next; set_permissions("$::prefix$dir", "$uid.$gid") or next; diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index a6aa3e035..f9e712aa9 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -143,7 +143,7 @@ sub spooler_in_security_level { # Was the current spooler already added to the current security level? my ($spooler, $level) = @_; my $sp; - $sp = (($spooler eq "lpr") || ($spooler eq "lprng")) ? "lpd" : $spooler; + $sp = $spooler eq "lpr" || $spooler eq "lprng" ? "lpd" : $spooler; my $file = "$::prefix/etc/security/msec/server.$level"; if (-f $file) { local *F; @@ -162,7 +162,7 @@ sub spooler_in_security_level { sub add_spooler_to_security_level { my ($spooler, $level) = @_; my $sp; - $sp = (($spooler eq "lpr") || ($spooler eq "lprng")) ? "lpd" : $spooler; + $sp = $spooler eq "lpr" || $spooler eq "lprng" ? "lpd" : $spooler; my $file = "$::prefix/etc/security/msec/server.$level"; if (-f $file) { local *F; @@ -268,7 +268,7 @@ sub read_configured_queues($) { for ($i = 0; $i < $N; $i++) { $printer->{configured}{$QUEUES[$i]{queuedata}{queue}} = $QUEUES[$i]; - if ((!$QUEUES[$i]{make}) || (!$QUEUES[$i]{model})) { + if (!$QUEUES[$i]{make} || !$QUEUES[$i]{model}) { if ($printer->{SPOOLER} eq "cups") { $printer->{OLD_QUEUE} = $QUEUES[$i]{queuedata}{queue}; my $descr = get_descr_from_ppd($printer); @@ -323,7 +323,7 @@ sub make_menuentry { my $spooler = $shortspooler_inv{$printer->{SPOOLER}}{short_name}; my $connect = $printer->{configured}{$queue}{queuedata}{connect}; my $localremote; - if (($connect =~ m!^file:!) || ($connect =~ m!^ptal:/mlc:!)) { + if ($connect =~ m!^file:! || $connect =~ m!^ptal:/mlc:!) { $localremote = N("Local Printers"); } else { $localremote = N("Remote Printers"); @@ -356,13 +356,13 @@ sub make_menuentry { $connection = N(" on LPD server \"%s\", printer \"%s\"", $2, $1); } elsif ($connect =~ m!^socket://([^/:]+):([^/:]+)/?$!) { $connection = N(", TCP/IP host \"%s\", port %s", $1, $2); - } elsif (($connect =~ m!^smb://([^/\@]+)/([^/\@]+)/?$!) || - ($connect =~ m!^smb://.*/([^/\@]+)/([^/\@]+)/?$!) || - ($connect =~ m!^smb://.*\@([^/\@]+)/([^/\@]+)/?$!)) { + } elsif ($connect =~ m!^smb://([^/\@]+)/([^/\@]+)/?$! || + $connect =~ m!^smb://.*/([^/\@]+)/([^/\@]+)/?$! || + $connect =~ m!^smb://.*\@([^/\@]+)/([^/\@]+)/?$!) { $connection = N(" on SMB/Windows server \"%s\", share \"%s\"", $1, $2); - } elsif (($connect =~ m!^ncp://([^/\@]+)/([^/\@]+)/?$!) || - ($connect =~ m!^ncp://.*/([^/\@]+)/([^/\@]+)/?$!) || - ($connect =~ m!^ncp://.*\@([^/\@]+)/([^/\@]+)/?$!)) { + } elsif ($connect =~ m!^ncp://([^/\@]+)/([^/\@]+)/?$! || + $connect =~ m!^ncp://.*/([^/\@]+)/([^/\@]+)/?$! || + $connect =~ m!^ncp://.*\@([^/\@]+)/([^/\@]+)/?$!) { $connection = N(" on Novell server \"%s\", printer \"%s\"", $1, $2); } elsif ($connect =~ m!^postpipe:(.+)$!) { $connection = N(", using command %s", $1); @@ -490,7 +490,7 @@ sub read_printer_db(;$) { } #- Load CUPS driver database if CUPS is used as spooler - if (($spooler) && ($spooler eq "cups") && ($::expert)) { + if ($spooler && $spooler eq "cups" && $::expert) { #&$install('cups-drivers') unless $::testing; #my $w; @@ -570,7 +570,7 @@ sub read_cups_options ($) { # Remove page size info $comment =~ s/,\s*size:\s*[0-9\.]+x[0-9\.]+in$//; $args[$i]{vals}[$j]{comment} = $comment; - } elsif (($line =~ /^\s*$/) && ($#{$args[$i]{vals}} > -1)) { + } elsif ($line =~ /^\s*$/ && $#{$args[$i]{vals}} > -1) { $inchoices = 0; $inoption = 0; } @@ -652,8 +652,8 @@ sub read_cups_printer_list { if ($line =~ m/^\s*device\s+for\s+([^:\s]+):\s*(\S+)\s*$/) { my $queuename = $1; my $comment = ""; - if (($2 =~ m!^ipp://([^/:]+)[:/]!) && - (!$printer->{configured}{$queuename})) { + if ($2 =~ m!^ipp://([^/:]+)[:/]! && + !$printer->{configured}{$queuename}) { $comment = N("(on %s)", $1); } else { $comment = N("(on this machine)"); @@ -679,15 +679,15 @@ sub get_cups_remote_queues { if ($line =~ m/^\s*device\s+for\s+([^:\s]+):\s*(\S+)\s*$/) { my $queuename = $1; my $comment = ""; - if (($2 =~ m!^ipp://([^/:]+)[:/]!) && - (!$printer->{configured}{$queuename})) { + if ($2 =~ m!^ipp://([^/:]+)[:/]! && + !$printer->{configured}{$queuename}) { $comment = N("On CUPS server \"%s\"", $1); my $sep = "!"; push (@printerlist, ($::expert ? N("CUPS") . $sep : "") . N("Remote Printers") . "$sep$queuename: $comment" . ($queuename eq $printer->{DEFAULT} ? - N(" (Default)") : (""))); + N(" (Default)") : "")); } } } @@ -703,7 +703,7 @@ sub set_cups_autoconf { my @file_content = cat_($file); # Remove all valid "CUPS_CONFIG" lines - (/^\s*CUPS_CONFIG/ and $_ = "") foreach @file_content; + /^\s*CUPS_CONFIG/ and $_ = "" foreach @file_content; # Insert the new "CUPS_CONFIG" line if ($autoconf) { @@ -839,13 +839,13 @@ sub get_descr_from_ppd { my $lang = $ppd{LanguageVersion}; # Remove manufacturer's name from the beginning of the model name - if (($make) && ($model =~ /^$make[\s\-]+([^\s\-].*)$/)) { + if ($make && $model =~ /^$make[\s\-]+([^\s\-].*)$/) { $model = $1; } # Put out the resulting description string uc($make) . '|' . $model . '|' . $driver . - ($lang && (" (" . lc(substr($lang, 0, 2)) . ")")); + ($lang && " (" . lc(substr($lang, 0, 2)) . ")"); } sub poll_ppd_base { @@ -912,9 +912,8 @@ sub configure_queue($) { run_program::rooted($::prefix, "foomatic-configure", "-q", "-s", $printer->{currentqueue}{spooler}, "-n", $printer->{currentqueue}{queue}, - (($printer->{currentqueue}{queue} ne - $printer->{OLD_QUEUE}) && - ($printer->{configured}{$printer->{OLD_QUEUE}}) ? + ($printer->{currentqueue}{queue} ne $printer->{OLD_QUEUE} && + $printer->{configured}{$printer->{OLD_QUEUE}} ? ("-C", $printer->{OLD_QUEUE}) : ()), "-c", $printer->{currentqueue}{connect}, "-p", $printer->{currentqueue}{printer}, @@ -932,7 +931,7 @@ sub configure_queue($) { # $printer->{Accepting} eq 'Yes' ? ("-E") : (), "-E", "-v", $printer->{currentqueue}{connect}, - ($printer->{currentqueue}{ppd} ne '1') ? + $printer->{currentqueue}{ppd} ne '1' ? ("-m", $printer->{currentqueue}{ppd}) : (), $printer->{currentqueue}{desc} ? ("-D", $printer->{currentqueue}{desc}) : (), @@ -949,9 +948,8 @@ sub configure_queue($) { } # Copy the old queue's PPD file to the new queue when it is renamed, # to conserve the option settings - if (($printer->{currentqueue}{queue} ne - $printer->{OLD_QUEUE}) && - ($printer->{configured}{$printer->{OLD_QUEUE}})) { + if ($printer->{currentqueue}{queue} ne $printer->{OLD_QUEUE} && + $printer->{configured}{$printer->{OLD_QUEUE}}) { system("cp -f $::prefix/etc/cups/ppd/$printer->{OLD_QUEUE}.ppd $::prefix/etc/cups/ppd/$printer->{currentqueue}{queue}.ppd"); } } else { @@ -1058,7 +1056,7 @@ sub restart_queue($) { last }; /lpr|lprng/ && do { #- restart lpd. - foreach (("/var/spool/lpd/$queue/lock", "/var/spool/lpd/lpd.lock")) { + foreach ("/var/spool/lpd/$queue/lock", "/var/spool/lpd/lpd.lock") { my $pidlpd = (cat_("$::prefix$_"))[0]; kill 'TERM', $pidlpd if $pidlpd; unlink "$::prefix$_"; @@ -1121,7 +1119,7 @@ sub help_output { open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . sprintf($spoolers{$spooler}{help}, $queue); my $helptext = join("", <F>); close F; - $helptext = "Option list not available!\n" if $spooler eq 'lpq' && (!$helptext || ($helptext eq "")); + $helptext = "Option list not available!\n" if $spooler eq 'lpq' && (!$helptext || $helptext eq ""); return $helptext; } @@ -1169,13 +1167,12 @@ sub get_copiable_queues { if (m!^\s*</queue>\s*$!) { # entry completed $inentry = 0; - if (($entry->{foomatic}) && - ($entry->{spooler} eq $oldspooler)) { + if ($entry->{foomatic} && $entry->{spooler} eq $oldspooler) { # Is the connection type supported by the new # spooler? - if (($newspooler eq "cups" && ($entry->{connect} =~ /^(file|ptal|lpd|socket|smb|ipp):/)) || - (($newspooler =~ /^(lpd|lprng)$/) && ($entry->{connect} =~ /^(file|ptal|lpd|socket|smb|ncp|postpipe):/)) || - ($newspooler eq "pdq" && $entry->{connect} =~ /^(file|ptal|lpd|socket):/)) { + if ($newspooler eq "cups" && $entry->{connect} =~ /^(file|ptal|lpd|socket|smb|ipp):/ || + $newspooler =~ /^(lpd|lprng)$/ && $entry->{connect} =~ /^(file|ptal|lpd|socket|smb|ncp|postpipe):/ || + $newspooler eq "pdq" && $entry->{connect} =~ /^(file|ptal|lpd|socket):/) { push(@queuelist, $entry->{name}); } } @@ -1285,9 +1282,9 @@ sub configure_hpoj { my $port = $2; if ($device =~ /usb/) { $bus = "usb"; - } elsif (($device =~ /par/) || - ($device =~ /\/dev\/lp/) || - ($device =~ /printers/)) { + } elsif ($device =~ /par/ || + $device =~ /\/dev\/lp/ || + $device =~ /printers/) { $bus = "par"; $address_arg = printer::detect::parport_addr($device); $address_arg =~ /^\s*-base\s+(\S+)/; @@ -1311,9 +1308,9 @@ sub configure_hpoj { # so in the case of the model name auto-detection having failed leave # the port number or the host name as model name. my $searchunknown = N("Unknown model"); - if (($_->{val}{MODEL}) && - ($_->{val}{MODEL} !~ /$searchunknown/i) && - ($_->{val}{MODEL} !~ /^\s*$/)) { + if ($_->{val}{MODEL} && + $_->{val}{MODEL} !~ /$searchunknown/i && + $_->{val}{MODEL} !~ /^\s*$/) { $model = $_->{val}{MODEL}; } $serialnumber = $_->{val}{SERIALNUMBER}; @@ -1340,9 +1337,9 @@ sub configure_hpoj { chomp $model_long; # If SNMP or local port auto-detection failed but HPOJ # auto-detection succeeded, fill in model name here. - if ((!$_->{val}{MODEL}) || - ($_->{val}{MODEL} =~ /$searchunknown/i) || - ($_->{val}{MODEL} =~ /^\s*$/)) { + if (!$_->{val}{MODEL} || + $_->{val}{MODEL} =~ /$searchunknown/i || + $_->{val}{MODEL} =~ /^\s*$/) { if ($model_long =~ /:([^:;]+);/) { $_->{val}{MODEL} = $1; } @@ -1644,7 +1641,7 @@ sub removelocalprintersfromapplications { sub setcupslink { my ($printer) = @_; - return 1 if !$::isInstall || ($printer->{SPOOLER} ne "cups") || -d "/etc/cups/ppd"; + return 1 if !$::isInstall || $printer->{SPOOLER} ne "cups" || -d "/etc/cups/ppd"; system("ln -sf $::prefix/etc/cups /etc/cups"); return 1; } diff --git a/perl-install/printer/office.pm b/perl-install/printer/office.pm index f870c4dac..a933fca29 100644 --- a/perl-install/printer/office.pm +++ b/perl-install/printer/office.pm @@ -47,7 +47,7 @@ sub configureoffice { # Load Star Office printer config file my $configfilecontent = readsofficeconfigfile($configfilename); # Update remote CUPS queues - if (0 && ($printer->{SPOOLER} eq "cups") && + if (0 && $printer->{SPOOLER} eq "cups" && ((-x "$::prefix/usr/bin/curl") || (-x "$::prefix/usr/bin/wget"))) { my @printerlist = printer::cups::get_remote_queues(); foreach my $listentry (@printerlist) { @@ -113,7 +113,7 @@ sub add_cups_remote_to_office { # Load Star Office printer config file my $configfilecontent = readsofficeconfigfile($configfilename); # Update remote CUPS queues - if (($printer->{SPOOLER} eq "cups") && + if ($printer->{SPOOLER} eq "cups" && ((-x "$::prefix/usr/bin/curl") || (-x "$::prefix/usr/bin/wget"))) { my @printerlist = printer::cups::get_remote_queues(); foreach my $listentry (@printerlist) { @@ -136,8 +136,7 @@ sub add_cups_remote_to_office { } # Does the file exist and is it not an error message? if ((-r "$::prefix/etc/foomatic/$queue.ppd") && - (cat_("$::prefix/etc/foomatic/$queue.ppd") =~ - /^\*PPD-Adobe/)) { + cat_("$::prefix/etc/foomatic/$queue.ppd") =~ /^\*PPD-Adobe/) { $configfilecontent = $suites{$suite}{make}($printer, $queue, $configprefix, @@ -225,7 +224,7 @@ sub makestarofficeprinterentry { $configfile = addentry("$queue.PostScript.$queue", "Level=$pslevel", $configfile); # Set Color/BW - my $color = ($ppd =~ /^\s*\*ColorDevice:\s*\"?([Tt]rue)\"?\s*$/m) ? "1" : "0"; + 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); # Set the default paper size @@ -266,8 +265,8 @@ sub makeopenofficeprinterentry { $configfile); # "Comment" line $configfile = removeentry($queue, "Comment=", $configfile); - if (($printer->{configured}{$queue}) && - ($printer->{configured}{$queue}{queuedata}{desc})) { + if ($printer->{configured}{$queue} && + $printer->{configured}{$queue}{queuedata}{desc}) { $configfile = addentry ($queue, "Comment=$printer->{configured}{$queue}{queuedata}{desc}", @@ -279,8 +278,8 @@ sub makeopenofficeprinterentry { } # "Location" line $configfile = removeentry($queue, "Location=", $configfile); - if (($printer->{configured}{$queue}) && - ($printer->{configured}{$queue}{queuedata}{loc})) { + if ($printer->{configured}{$queue} && + $printer->{configured}{$queue}{queuedata}{loc}) { $configfile = addentry ($queue, "Location=$printer->{configured}{$queue}{queuedata}{loc}", diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm index 5eab8b77f..65516c4e1 100644 --- a/perl-install/printer/printerdrake.pm +++ b/perl-install/printer/printerdrake.pm @@ -107,7 +107,7 @@ Normally, CUPS is automatically configured according to your network environment # We have clicked "OK" $retvalue = 1; # Set BrowsePoll line - if (($server ne $oldserver) || ($port ne $oldport)) { + if ($server ne $oldserver || $port ne $oldport) { $server && $port and $server = "$server:$port"; if ($server) { @cupsd_conf = @@ -210,7 +210,7 @@ sub first_time_dialog { # configure networking. my $havelocalnetworks = (check_network($printer, $in, $upNetwork, 1) && - (printer::detect::getIPsInLocalNetworks() != ())); + printer::detect::getIPsInLocalNetworks() != ()); # Finish building the dialog text my $question = ($havelocalnetworks ? @@ -244,8 +244,8 @@ sub wizard_welcome { undef $printer->{AUTODETECTNETWORK}; undef $printer->{AUTODETECTSMB}; } else { - $havelocalnetworks = ((check_network($printer, $in, $upNetwork, 1)) && - (printer::detect::getIPsInLocalNetworks() != ())); + $havelocalnetworks = (check_network($printer, $in, $upNetwork, 1) && + printer::detect::getIPsInLocalNetworks() != ()); if (!$havelocalnetworks) { undef $printer->{AUTODETECTNETWORK}; undef $printer->{AUTODETECTSMB}; @@ -319,10 +319,10 @@ If you have printer(s) connected to this machine, Please plug it/them in on this ]); $printer->{AUTODETECTLOCAL} = $autodetectlocal ? 1 : undef; $printer->{AUTODETECTNETWORK} = $autodetectnetwork ? 1 : undef; - $printer->{AUTODETECTSMB} = ($autodetectsmb && ($printer->{SPOOLER} ne "pdq")) ? 1 : undef; + $printer->{AUTODETECTSMB} = $autodetectsmb && $printer->{SPOOLER} ne "pdq" ? 1 : undef; } }; - return ($@ =~ /wizcancel/) ? 0 : $ret; + return $@ =~ /wizcancel/ ? 0 : $ret; } } @@ -345,8 +345,8 @@ sub setup_local_autoscan { my $queue = $printer->{OLD_QUEUE}; my $expert_or_modify = ($::expert || !$printer->{NEW}); my $do_auto_detect = - (($expert_or_modify && - $printer->{AUTODETECT}) || + ($expert_or_modify && + $printer->{AUTODETECT} || (!$expert_or_modify && ($printer->{AUTODETECTLOCAL} || $printer->{AUTODETECTNETWORK} || @@ -362,9 +362,9 @@ sub setup_local_autoscan { my $menuentries = {}; $in->set_help('setupLocal') if $::isInstall; if ($do_auto_detect) { - if ((!$::testing) && - (!$expert_or_modify) && ($printer->{AUTODETECTSMB}) && - (!files_exist((qw(/usr/bin/smbclient))))) { + if (!$::testing && + !$expert_or_modify && $printer->{AUTODETECTSMB} && + !files_exist((qw(/usr/bin/smbclient)))) { $in->do_pkgs->install('samba-client'); } my $w = $in->wait_message(N("Printer auto-detection"), N("Detecting devices...")); @@ -468,15 +468,15 @@ sub setup_local_autoscan { for (my $i = 0; $i <= $#prefixes; $i++) { my $firstinlist = ($first =~ m!^$prefixes[$i]!); my $secondinlist = ($second =~ m!^$::prefixes[$i]!); - if (($firstinlist) && (!$secondinlist)) { return -1 }; - if (($secondinlist) && (!$firstinlist)) { return 1 }; + if ($firstinlist && !$secondinlist) { return -1 }; + if ($secondinlist && !$firstinlist) { return 1 }; } return $first cmp $second; } keys(%{$menuentries}); my $menuchoice = ""; my $oldmenuchoice = ""; - if (($printer->{configured}{$queue}) && - ($printer->{currentqueue}{connect} =~ m/^file:/)) { + if ($printer->{configured}{$queue} && + $printer->{currentqueue}{connect} =~ m/^file:/) { # Non-HP or HP print-only device (HPOJ not used) $device = $printer->{currentqueue}{connect}; $device =~ s/^file://; @@ -486,8 +486,8 @@ sub setup_local_autoscan { last; } } - } elsif (($printer->{configured}{$queue}) && - ($printer->{currentqueue}{connect} =~ m!^ptal:/mlc:!)) { + } elsif ($printer->{configured}{$queue} && + $printer->{currentqueue}{connect} =~ m!^ptal:/mlc:!) { # HP multi-function device (controlled by HPOJ) my $ptaldevice = $printer->{currentqueue}{connect}; $ptaldevice =~ s!^ptal:/mlc:!!; @@ -505,16 +505,16 @@ sub setup_local_autoscan { $device = ""; foreach my $p (keys %{$menuentries}) { my $menumakemodel = lc($p); - if (($menumakemodel =~ /$make/) && - ($menumakemodel =~ /$model/)) { + if ($menumakemodel =~ /$make/ && + $menumakemodel =~ /$model/) { $menuchoice = $p; $device = $menuentries->{$p}; last; } } } - } elsif (($printer->{configured}{$queue}) && - ($printer->{currentqueue}{connect} =~ m!^(socket|smb):/!)) { + } elsif ($printer->{configured}{$queue} && + $printer->{currentqueue}{connect} =~ m!^(socket|smb):/!) { # Ethernet-(TCP/Socket)-connected printer or printer on Windows server $device = $printer->{currentqueue}{connect}; foreach my $p (keys %{$menuentries}) { @@ -524,7 +524,7 @@ sub setup_local_autoscan { } } } else { $device = "" } - if (($menuchoice eq "") && (@menuentrieslist > -1)) { + if ($menuchoice eq "" && @menuentrieslist > -1) { $menuchoice = $menuentrieslist[0]; $oldmenuchoice = $menuchoice; $device = $menuentries->{$menuchoice} if $device eq ""; @@ -563,10 +563,10 @@ sub setup_local_autoscan { N("Available printers")), messages => (($do_auto_detect ? ($::expert ? - (($#menuentrieslist == 0) ? + ($#menuentrieslist == 0 ? N("The following printer was auto-detected, if it is not the one you want to configure, enter a device name/file name in the input line") : N("Here is a list of all auto-detected printers. Please choose the printer you want to set up or enter a device name/file name in the input line")) : - (($#menuentrieslist == 0) ? + ($#menuentrieslist == 0 ? N("The following printer was auto-detected. The configuration of the printer will work fully automatically. If your printer was not correctly detected or if you prefer a customized printer configuration, turn on \"Manual configuration\".") : N("Here is a list of all auto-detected printers. Please choose the printer you want to set up. The configuration of the printer will work fully automatically. If your printer was not correctly detected or if you prefer a customized printer configuration, turn on \"Manual configuration\"."))) : ($::expert ? @@ -597,7 +597,7 @@ sub setup_local_autoscan { { val => \$menuchoice, list => \@menuentrieslist, not_edit => !$::expert, format => \&translate, sort => 0, allow_empty_list => 1, type => 'list' }, - (((!$::expert) && ($do_auto_detect) && ($printer->{NEW})) ? + ((!$::expert && $do_auto_detect && $printer->{NEW}) ? { text => N("Manual configuration"), type => 'bool', val => \$manualconf } : ()), ] @@ -613,9 +613,9 @@ sub setup_local_autoscan { } #- LPD and LPRng need netcat ('nc') to access to socket printers - if ((($printer->{SPOOLER} eq 'lpd') || ($printer->{SPOOLER} eq 'lprng')) && - (!$::testing) && ($device =~ /^socket:/) && - (!files_exist((qw(/usr/bin/nc))))) { + if (($printer->{SPOOLER} eq 'lpd' || $printer->{SPOOLER} eq 'lprng') && + !$::testing && $device =~ /^socket:/ && + !files_exist((qw(/usr/bin/nc)))) { $in->do_pkgs->install('nc'); } @@ -637,8 +637,8 @@ sub setup_lpd { $in->set_help('setupLPD') if $::isInstall; my ($uri, $remotehost, $remotequeue); my $queue = $printer->{OLD_QUEUE}; - if (($printer->{configured}{$queue}) && - ($printer->{currentqueue}{connect} =~ m/^lpd:/)) { + if ($printer->{configured}{$queue} && + $printer->{currentqueue}{connect} =~ m/^lpd:/) { $uri = $printer->{currentqueue}{connect}; $uri =~ m!^\s*lpd://([^/]+)/([^/]+)/?\s*$!; $remotehost = $1; @@ -670,8 +670,8 @@ complete => sub { #- LPD does not support filtered queues to a remote LPD server by itself #- It needs an additional program as "rlpr" - if (($printer->{SPOOLER} eq 'lpd') && (!$::testing) && - (!files_exist((qw(/usr/bin/rlpr))))) { + if ($printer->{SPOOLER} eq 'lpd' && !$::testing && + !files_exist((qw(/usr/bin/rlpr)))) { $in->do_pkgs->install('rlpr'); } @@ -679,9 +679,9 @@ complete => sub { # printer) my $modelinfo = printer::detect::getSNMPModel($remotehost); my $auto_hpoj; - if ((defined($modelinfo)) && - ($modelinfo->{MANUFACTURER} ne "") && - ($modelinfo->{MODEL} ne "")) { + if (defined($modelinfo) && + $modelinfo->{MANUFACTURER} ne "" && + $modelinfo->{MODEL} ne "") { $in->ask_warn('', N("Detected model: %s %s", $modelinfo->{MANUFACTURER}, $modelinfo->{MODEL})); $auto_hpoj = 1; @@ -710,8 +710,8 @@ sub setup_smb { $in->set_help('setupSMB') if $::isInstall; my ($uri, $smbuser, $smbpassword, $workgroup, $smbserver, $smbserverip, $smbshare); my $queue = $printer->{OLD_QUEUE}; - if (($printer->{configured}{$queue}) && - ($printer->{currentqueue}{connect} =~ m/^smb:/)) { + if ($printer->{configured}{$queue} && + $printer->{currentqueue}{connect} =~ m/^smb:/) { $uri = $printer->{currentqueue}{connect}; $uri =~ m!^\s*smb://(.*)$!; my $parameters = $1; @@ -756,8 +756,8 @@ sub setup_smb { my $oldmenuchoice = ""; if ($printer->{AUTODETECT}) { $autodetect = 1; - if ((!$::testing) && - (!files_exist((qw(/usr/bin/smbclient))))) { + if (!$::testing && + !files_exist((qw(/usr/bin/smbclient)))) { $in->do_pkgs->install('samba-client'); } my $w = $in->wait_message(N("Printer auto-detection"), N("Scanning network...")); @@ -776,17 +776,17 @@ sub setup_smb { $share, $server); } $menuentries->{$menustr} = $p->{port}; - if (($server eq $smbserver) && - ($share eq $smbshare)) { + if ($server eq $smbserver && + $share eq $smbshare) { $menuchoice = $menustr; } } @menuentrieslist = sort { $menuentries->{$a} cmp $menuentries->{$b}; } keys(%{$menuentries}); - if (($printer->{configured}{$queue}) && - ($printer->{currentqueue}{connect} =~ m/^smb:/) && - ($menuchoice eq "")) { + if ($printer->{configured}{$queue} && + $printer->{currentqueue}{connect} =~ m/^smb:/ && + $menuchoice eq "") { my $menustr; if ($printer->{currentqueue}{make}) { $menustr = "$printer->{currentqueue}{make} $printer->{currentqueue}{model}"; @@ -882,11 +882,11 @@ Do you really want to continue setting up this printer as you are doing now?"), #- build a suitable URI. $printer->{currentqueue}{connect} = join '', ("smb://", ($smbuser && ($smbuser . - ($smbpassword && ":$smbpassword") . "@")), ($workgroup && ("$workgroup/")), + ($smbpassword && ":$smbpassword") . "@")), ($workgroup && "$workgroup/"), ($smbserver || $smbserverip), "/$smbshare"); - if ((!$::testing) && - (!files_exist((qw(/usr/bin/smbclient))))) { + if (!$::testing && + !files_exist((qw(/usr/bin/smbclient)))) { $in->do_pkgs->install('samba-client'); } $printer->{SPOOLER} eq 'cups' and printer::main::restart_queue($printer); @@ -903,8 +903,8 @@ sub setup_ncp { $in->set_help('setupNCP') if $::isInstall; my ($uri, $ncpuser, $ncppassword, $ncpserver, $ncpqueue); my $queue = $printer->{OLD_QUEUE}; - if (($printer->{configured}{$queue}) && - ($printer->{currentqueue}{connect} =~ m/^ncp:/)) { + if ($printer->{configured}{$queue} && + $printer->{currentqueue}{connect} =~ m/^ncp:/) { $uri = $printer->{currentqueue}{connect}; my $parameters = $uri =~ m!^\s*ncp://(.*)$!; # Get the user's login and password from the URI @@ -955,8 +955,8 @@ complete => sub { ($ncppassword && ":$ncppassword") . "@")), "$ncpserver/$ncpqueue"); - if ((!$::testing) && - (!files_exist((qw(/usr/bin/nprint))))) { + if (!$::testing && + !files_exist((qw(/usr/bin/nprint)))) { $in->do_pkgs->install('ncpfs'); } @@ -974,8 +974,8 @@ sub setup_socket { my ($hostname, $port, $uri, $remotehost,$remoteport); my $queue = $printer->{OLD_QUEUE}; - if (($printer->{configured}{$queue}) && - ($printer->{currentqueue}{connect} =~ m!^(socket:|ptal:/hpjd:)!)) { + if ($printer->{configured}{$queue} && + $printer->{currentqueue}{connect} =~ m!^(socket:|ptal:/hpjd:)!) { $uri = $printer->{currentqueue}{connect}; if ($uri =~ m!^ptal:!) { if ($uri =~ m!^ptal:/hpjd:([^/:]+):([0-9]+)/?\s*$!) { @@ -1016,17 +1016,17 @@ sub setup_socket { $menustr = N("Host \"%s\", port %s", $host, $port); } $menuentries->{$menustr} = $p->{port}; - if (($host eq $remotehost) && - ($host eq $remotehost)) { + if ($host eq $remotehost && + $host eq $remotehost) { $menuchoice = $menustr; } } @menuentrieslist = sort { $menuentries->{$a} cmp $menuentries->{$b}; } keys(%{$menuentries}); - if (($printer->{configured}{$queue}) && - ($printer->{currentqueue}{connect} =~ m!^(socket:|ptal:/hpjd:)!) && - ($menuchoice eq "")) { + if ($printer->{configured}{$queue} && + $printer->{currentqueue}{connect} =~ m!^(socket:|ptal:/hpjd:)! && + $menuchoice eq "") { my $menustr; if ($printer->{currentqueue}{make}) { $menustr = "$printer->{currentqueue}{make} $printer->{currentqueue}{model}"; @@ -1095,12 +1095,12 @@ sub setup_socket { #- make the Foomatic URI $printer->{currentqueue}{connect} = - join '', ("socket://$remotehost", $remoteport ? (":$remoteport") : ()); + 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')) && - (!$::testing) && - (!files_exist((qw(/usr/bin/nc))))) { + if (($printer->{SPOOLER} eq 'lpd' || $printer->{SPOOLER} eq 'lprng') && + !$::testing && + !files_exist((qw(/usr/bin/nc)))) { $in->do_pkgs->install('nc'); } @@ -1110,9 +1110,9 @@ sub setup_socket { $modelinfo = printer::detect::getSNMPModel($remotehost); } my $auto_hpoj; - if ((defined($modelinfo)) && - ($modelinfo->{MANUFACTURER} ne "") && - ($modelinfo->{MODEL} ne "")) { + if (defined($modelinfo) && + $modelinfo->{MANUFACTURER} ne "" && + $modelinfo->{MODEL} ne "") { $auto_hpoj = 1; } else { $auto_hpoj = 0; @@ -1156,49 +1156,49 @@ complete => sub { ); # Non-local printer, check network and abort if no network available - if (($printer->{currentqueue}{connect} !~ m!^(file|ptal):/!) && - (!check_network($printer, $in, $upNetwork, 0))) { return 0 }; + if ($printer->{currentqueue}{connect} !~ m!^(file|ptal):/! && + !check_network($printer, $in, $upNetwork, 0)) { return 0 }; # If the chosen protocol needs additional software, install it. # LPD does not support filtered queues to a remote LPD server by itself # It needs an additional program as "rlpr" - if (($printer->{currentqueue}{connect} =~ /^lpd:/) && - ($printer->{SPOOLER} eq 'lpd') && (!$::testing) && - (!files_exist((qw(/usr/bin/rlpr))))) { + if ($printer->{currentqueue}{connect} =~ /^lpd:/ && + $printer->{SPOOLER} eq 'lpd' && !$::testing && + !files_exist(qw(/usr/bin/rlpr))) { $in->do_pkgs->install('rlpr'); } - if (($printer->{currentqueue}{connect} =~ /^smb:/) && - (!$::testing) && - (!files_exist((qw(/usr/bin/smbclient))))) { + if ($printer->{currentqueue}{connect} =~ /^smb:/ && + !$::testing && + !files_exist((qw(/usr/bin/smbclient)))) { $in->do_pkgs->install('samba-client'); } - if (($printer->{currentqueue}{connect} =~ /^ncp:/) && - (!$::testing) && - (!files_exist((qw(/usr/bin/nprint))))) { + if ($printer->{currentqueue}{connect} =~ /^ncp:/ && + !$::testing && + !files_exist((qw(/usr/bin/nprint)))) { $in->do_pkgs->install('ncpfs'); } #- LPD and LPRng need netcat ('nc') to access to socket printers - if (($printer->{currentqueue}{connect} =~ /^socket:/) && - (($printer->{SPOOLER} eq 'lpd') || ($printer->{SPOOLER} eq 'lprng')) && - (!$::testing) && - (!files_exist((qw(/usr/bin/nc))))) { + if ($printer->{currentqueue}{connect} =~ /^socket:/ && + ($printer->{SPOOLER} eq 'lpd' || $printer->{SPOOLER} eq 'lprng') && + !$::testing && + !files_exist((qw(/usr/bin/nc)))) { $in->do_pkgs->install('nc'); } - if (($printer->{currentqueue}{connect} =~ m!^socket://([^:/]+)!) || - ($printer->{currentqueue}{connect} =~ m!^lpd://([^:/]+)!) || - ($printer->{currentqueue}{connect} =~ m!^http://([^:/]+)!) || - ($printer->{currentqueue}{connect} =~ m!^ipp://([^:/]+)!)) { + if ($printer->{currentqueue}{connect} =~ m!^socket://([^:/]+)! || + $printer->{currentqueue}{connect} =~ m!^lpd://([^:/]+)! || + $printer->{currentqueue}{connect} =~ m!^http://([^:/]+)! || + $printer->{currentqueue}{connect} =~ m!^ipp://([^:/]+)!) { # Auto-detect printer model (works if host is an ethernet-connected # printer) my $remotehost = $1; my $modelinfo = printer::detect::getSNMPModel($remotehost); my $auto_hpoj; - if ((defined($modelinfo)) && - ($modelinfo->{MANUFACTURER} ne "") && - ($modelinfo->{MODEL} ne "")) { + if (defined($modelinfo) && + $modelinfo->{MANUFACTURER} ne "" && + $modelinfo->{MODEL} ne "") { $in->ask_warn('', N("Detected model: %s %s", $modelinfo->{MANUFACTURER}, $modelinfo->{MODEL})); @@ -1226,8 +1226,8 @@ sub setup_postpipe { my $uri; my $commandline; my $queue = $printer->{OLD_QUEUE}; - if (($printer->{configured}{$queue}) && - ($printer->{currentqueue}{connect} =~ m/^postpipe:/)) { + if ($printer->{configured}{$queue} && + $printer->{currentqueue}{connect} =~ m/^postpipe:/) { $uri = $printer->{currentqueue}{connect}; $uri =~ m!^\s*postpipe:\"(.*)\"$!; $commandline = $1; @@ -1264,25 +1264,25 @@ sub setup_common { my $ptaldevice = ""; my $isHPOJ = 0; - if (($device =~ /^\/dev\//) || ($device =~ /^socket:\/\//)) { + if ($device =~ /^\/dev\// || $device =~ /^socket:\/\//) { # Ask user whether he has a multi-function device when he didn't # do auto-detection or when auto-detection failed my $searchunknown = N("Unknown model"); - if ((!$do_auto_detect) || - ($makemodel =~ /$searchunknown/i) || - ($makemodel =~ /^\s*$/)) { + if (!$do_auto_detect || + $makemodel =~ /$searchunknown/i || + $makemodel =~ /^\s*$/) { local $::isWizard = 0; $isHPOJ = $in->ask_yesorno(N("Add a new printer"), N("Is your printer a multi-function device from HP or Sony (OfficeJet, PSC, LaserJet 1100/1200/1220/3200/3300 with scanner, Sony IJP-V100), an HP PhotoSmart or an HP LaserJet 2200?"), 0); } - if (($makemodel =~ /HP\s+(OfficeJet|PSC|PhotoSmart|LaserJet\s+(1200|1220|2200|3200|33.0))/i) || - ($makemodel =~ /Sony\s+IJP[\s\-]+V[\s\-]+100/i) || - ($isHPOJ)) { + if ($makemodel =~ /HP\s+(OfficeJet|PSC|PhotoSmart|LaserJet\s+(1200|1220|2200|3200|33.0))/i || + $makemodel =~ /Sony\s+IJP[\s\-]+V[\s\-]+100/i || + $isHPOJ) { # Install HPOJ package - if ((!$::testing) && - (!files_exist((qw(/usr/sbin/ptal-mlcd + if (!$::testing && + !files_exist((qw(/usr/sbin/ptal-mlcd /usr/sbin/ptal-init - /usr/bin/xojpanel))))) { + /usr/bin/xojpanel)))) { my $w = $in->wait_message(N("Printerdrake"), N("Installing HPOJ package...")); $in->do_pkgs->install('hpoj', 'xojpanel'); @@ -1295,19 +1295,18 @@ sub setup_common { if ($ptaldevice) { # Configure scanning with SANE on the MF device - if (($makemodel !~ /HP\s+PhotoSmart/i) && - ($makemodel !~ /HP\s+LaserJet\s+2200/i)) { + if ($makemodel !~ /HP\s+PhotoSmart/i && + $makemodel !~ /HP\s+LaserJet\s+2200/i) { # Install SANE - if ((!$::testing) && - (!files_exist((qw(/usr/bin/scanimage + if (!$::testing && + !files_exist((qw(/usr/bin/scanimage /usr/bin/xscanimage /usr/bin/xsane /etc/sane.d/dll.conf /usr/lib/libsane-hpoj.so.1), - (files_exist - ('/usr/bin/gimp') ? + (files_exist('/usr/bin/gimp') ? '/usr/bin/xsane-gimp' : - ()))))) { + ())))) { my $w = $in->wait_message( N("Printerdrake"), N("Installing SANE packages...")); @@ -1320,17 +1319,17 @@ sub setup_common { printer::main::config_sane(); } # Configure photo card access with mtools and MToolsFM - if ((($makemodel =~ /HP\s+PhotoSmart/i) || - ($makemodel =~ /HP\s+PSC\s*9[05]0/i) || - ($makemodel =~ /HP\s+PSC\s*22\d\d/i) || - ($makemodel =~ /HP\s+OfficeJet\s+D\s*1[45]5/i)) && - ($makemodel !~ /HP\s+PhotoSmart\s+7150/i)) { + if (($makemodel =~ /HP\s+PhotoSmart/i || + $makemodel =~ /HP\s+PSC\s*9[05]0/i || + $makemodel =~ /HP\s+PSC\s*22\d\d/i || + $makemodel =~ /HP\s+OfficeJet\s+D\s*1[45]5/i) && + $makemodel !~ /HP\s+PhotoSmart\s+7150/i) { # Install mtools and MToolsFM - if ((!$::testing) && - (!files_exist(qw(/usr/bin/mdir + if (!$::testing && + !files_exist(qw(/usr/bin/mdir /usr/bin/mcopy /usr/bin/MToolsFM - )))) { + ))) { my $w = $in->wait_message( N("Printerdrake"), N("Installing mtools packages...")); @@ -1376,12 +1375,12 @@ sub setup_common { } #- if CUPS is the spooler, make sure that CUPS knows the device - if (($printer->{SPOOLER} eq "cups") && - ($device !~ /^lpd:/) && - ($device !~ /^smb:/) && - ($device !~ /^socket:/) && - ($device !~ /^http:/) && - ($device !~ /^ipp:/)) { + if ($printer->{SPOOLER} eq "cups" && + $device !~ /^lpd:/ && + $device !~ /^smb:/ && + $device !~ /^socket:/ && + $device !~ /^http:/ && + $device !~ /^ipp:/) { my $w = $in->wait_message(N("Printerdrake"), N("Making printer port available for CUPS...")); printer::main::assure_device_is_available_for_cups($ptaldevice || $device); } @@ -1397,7 +1396,7 @@ sub setup_common { my $descr = ""; foreach (@autodetected) { $device eq $_->{port} or next; - if (($_->{val}{MANUFACTURER}) && ($_->{val}{MODEL})) { + if ($_->{val}{MANUFACTURER} && $_->{val}{MODEL}) { $descr = "$_->{val}{MANUFACTURER}|$_->{val}{MODEL}"; } else { $descr = $_->{val}{DESCRIPTION}; @@ -1434,14 +1433,14 @@ sub setup_common { my $searchterm = $descr; $searchterm =~ s/\|/\\\|/; my $lsearchterm = length($searchterm); - if (($lsearchterm > $matchlength) && - ($entry =~ m!$searchterm!i)) { + if ($lsearchterm > $matchlength && + $entry =~ m!$searchterm!i) { $matchlength = $lsearchterm; $printer->{DBENTRY} = $entry; } my $ldbmakemodel = length($dbmakemodel); - if (($ldbmakemodel > $matchlength) && - ($descr =~ m!$dbmakemodel!i)) { + if ($ldbmakemodel > $matchlength && + $descr =~ m!$dbmakemodel!i) { $matchlength = $ldbmakemodel; $printer->{DBENTRY} = $entry; } @@ -1454,14 +1453,14 @@ sub setup_common { # guess. $printer->{DBENTRY} =~ /^([^\|]+)\|/; my $guessedmake = lc($1); - if (($descr !~ /$guessedmake/i) && - (($guessedmake ne "hp") || - ($descr !~ /Hewlett[\s-]+Packard/i))) + if ($descr !~ /$guessedmake/i && + ($guessedmake ne "hp" || + $descr !~ /Hewlett[\s-]+Packard/i)) { $printer->{DBENTRY} = "" }; } #- Pre-fill the "Description" field with the printer's model name - if ((!$printer->{currentqueue}{desc}) && ($descr)) { + if (!$printer->{currentqueue}{desc} && $descr) { $printer->{currentqueue}{desc} = $descr; $printer->{currentqueue}{desc} =~ s/\|/ /g; } @@ -1488,11 +1487,11 @@ sub choose_printer_name { return (1,0); } local $::isWizard = 0; - if (($printer->{configured}{$printer->{currentqueue}{queue}}) - && ($printer->{currentqueue}{queue} ne $default) && - (!$in->ask_yesorno('', N("The printer \"%s\" already exists,\ndo you really want to overwrite its configuration?", + if ($printer->{configured}{$printer->{currentqueue}{queue}} + && $printer->{currentqueue}{queue} ne $default && + !$in->ask_yesorno('', N("The printer \"%s\" already exists,\ndo you really want to overwrite its configuration?", $printer->{currentqueue}{queue}), - 0))) { + 0)) { return (1,0); # Let the user correct the name } return 0; @@ -1543,8 +1542,8 @@ sub get_db_entry { $printer->{DBENTRY} = "$make|$model"; } $printer->{OLD_CHOICE} = $printer->{DBENTRY}; - } elsif (($printer->{SPOOLER} eq "cups") && ($::expert) && - ($printer->{configured}{$queue}{queuedata}{ppd})) { + } elsif ($printer->{SPOOLER} eq "cups" && $::expert && + $printer->{configured}{$queue}{queuedata}{ppd}) { # Do we have a native CUPS driver or a PostScript PPD file? $printer->{DBENTRY} = printer::main::get_descr_from_ppd($printer) || $printer->{DBENTRY}; $printer->{OLD_CHOICE} = $printer->{DBENTRY}; @@ -1555,8 +1554,8 @@ sub get_db_entry { my $make = uc($printer->{configured}{$queue}{queuedata}{make}); my $model = $printer->{configured}{$queue}{queuedata}{model}; foreach my $key (keys %printer::main::thedb) { - if ((($::expert) && ($key =~ /^$make\|$model\|.*\(recommended\)$/)) || - ((!$::expert) && ($key =~ /^$make\|$model$/))) { + if ($::expert && $key =~ /^$make\|$model\|.*\(recommended\)$/ || + !$::expert && $key =~ /^$make\|$model$/) { $printer->{DBENTRY} = $key; } } @@ -1567,13 +1566,13 @@ sub get_db_entry { $model =~ s/PostScript//; $model =~ s/Series//; foreach my $key (keys %printer::main::thedb) { - if ((($::expert) && ($key =~ /^$make\|$model\|.*\(recommended\)$/)) || - ((!$::expert) && ($key =~ /^$make\|$model$/))) { + if ($::expert && $key =~ /^$make\|$model\|.*\(recommended\)$/ || + !$::expert && $key =~ /^$make\|$model$/) { $printer->{DBENTRY} = $key; } } } - if (($printer->{DBENTRY} eq "") && ($make ne "")) { + if ($printer->{DBENTRY} eq "" && $make ne "") { # Exact match with cleaned-up model did not work, try a best match my $matchstr = "$make|$model"; $printer->{DBENTRY} = bestMatchSentence($matchstr, keys %printer::main::thedb); @@ -1581,16 +1580,16 @@ sub get_db_entry { # guess. $printer->{DBENTRY} =~ /^([^\|]+)\|/; my $guessedmake = lc($1); - if (($matchstr !~ /$guessedmake/i) && - (($guessedmake ne "hp") || - ($matchstr !~ /Hewlett[\s-]+Packard/i))) + if ($matchstr !~ /$guessedmake/i && + ($guessedmake ne "hp" || + $matchstr !~ /Hewlett[\s-]+Packard/i)) { $printer->{DBENTRY} = "" }; } # Set the OLD_CHOICE to a non-existing value $printer->{OLD_CHOICE} = "XXX"; } } else { - if (($::expert) && ($printer->{DBENTRY} !~ /(recommended)/)) { + if ($::expert && $printer->{DBENTRY} !~ /(recommended)/) { my ($make, $model) = $printer->{DBENTRY} =~ /^([^\|]+)\|([^\|]+)\|/; foreach my $key (keys %printer::main::thedb) { if ($key =~ /^$make\|$model\|.*\(recommended\)$/) { @@ -1663,11 +1662,11 @@ sub get_printer_info { my $queue = $printer->{OLD_QUEUE}; my $oldchoice = $printer->{OLD_CHOICE}; my $newdriver = 0; - if ((!$printer->{configured}{$queue}) || # New queue or - (($oldchoice) && ($printer->{DBENTRY}) && # make/model/driver changed - (($oldchoice ne $printer->{DBENTRY}) || - ($printer->{currentqueue}{driver} ne - $printer::main::thedb{$printer->{DBENTRY}}{driver})))) { + if (!$printer->{configured}{$queue} || # New queue or + ($oldchoice && $printer->{DBENTRY} && # make/model/driver changed + ($oldchoice ne $printer->{DBENTRY} || + $printer->{currentqueue}{driver} ne + $printer::main::thedb{$printer->{DBENTRY}}{driver}))) { delete($printer->{currentqueue}{printer}); delete($printer->{currentqueue}{ppd}); $printer->{currentqueue}{foomatic} = 0; @@ -1679,13 +1678,13 @@ sub get_printer_info { } # Use the "printer" and not the "foomatic" field to identify a Foomatic # queue because in a new queue "foomatic" is not set yet. - if (($printer->{currentqueue}{printer}) || # We have a Foomatic queue - ($printer->{currentqueue}{ppd})) { # We have a CUPS+PPD queue + if ($printer->{currentqueue}{printer} || # We have a Foomatic queue + $printer->{currentqueue}{ppd}) { # We have a CUPS+PPD queue if ($printer->{currentqueue}{printer}) { # Foomatic queue? # In case of a new queue "foomatic" was not set yet $printer->{currentqueue}{foomatic} = 1; # Now get the options for this printer/driver combo - if (($printer->{configured}{$queue}) && ($printer->{configured}{$queue}{queuedata}{foomatic})) { + if ($printer->{configured}{$queue} && $printer->{configured}{$queue}{queuedata}{foomatic}) { # The queue was already configured with Foomatic ... if (!$newdriver) { # ... and the user didn't change the printer/driver @@ -1709,9 +1708,9 @@ sub get_printer_info { ($pagesize = $ENV{LANG}) || ($pagesize = $ENV{LANGUAGE}) || ($pagesize = $ENV{LC_ALL})) { - if (($pagesize =~ /^en_CA/) || - ($pagesize =~ /^fr_CA/) || - ($pagesize =~ /^en_US/)) { + if ($pagesize =~ /^en_CA/ || + $pagesize =~ /^fr_CA/ || + $pagesize =~ /^en_US/) { $pagesize = "Letter"; } else { $pagesize = "A4"; @@ -1822,8 +1821,8 @@ The first command can be given by any normal user, the second must be given as r # Now get the options from this PPD file if ($printer->{configured}{$queue}) { # The queue was already configured - if ((!$printer->{DBENTRY}) || (!$oldchoice) || - ($printer->{DBENTRY} eq $oldchoice)) { + if (!$printer->{DBENTRY} || !$oldchoice || + $printer->{DBENTRY} eq $oldchoice) { # ... and the user didn't change the printer/driver $printer->{ARGS} = printer::main::read_cups_options($queue); } else { @@ -1928,8 +1927,8 @@ sub setup_options { "Option30" ); $in->set_help('setupOptions') if $::isInstall; - if (($printer->{currentqueue}{printer}) || # We have a Foomatic queue - ($printer->{currentqueue}{ppd})) { # We have a CUPS+PPD queue + if ($printer->{currentqueue}{printer} || # We have a Foomatic queue + $printer->{currentqueue}{ppd}) { # We have a CUPS+PPD queue # Set up the widgets for the option dialog my @widgets; my @userinputs; @@ -2019,7 +2018,7 @@ sub setup_options { } # Do not show the options setup dialog when installing a new printer # in recommended mode without "Manual configuration" turned on. - if ((!$printer->{NEW}) or ($::expert) or ($printer->{MANUAL})) { + if (!$printer->{NEW} or $::expert or $printer->{MANUAL}) { return 0 if !$in->ask_from( $windowtitle, N("Printer default settings @@ -2029,7 +2028,7 @@ You should make sure that the page size and the ink type/printing mode (if avail complete => sub { my $i; for ($i = 0; $i <= $#{$printer->{ARGS}}; $i++) { - if (($printer->{ARGS}[$i]{type} eq 'int') || ($printer->{ARGS}[$i]{type} eq 'float')) { + if ($printer->{ARGS}[$i]{type} eq 'int' || $printer->{ARGS}[$i]{type} eq 'float') { if ($printer->{ARGS}[$i]{type} eq 'int' && $userinputs[$i] !~ /^[\-\+]?[0-9]+$/) { $in->ask_warn('', N("Option %s must be an integer number!", $printer->{ARGS}[$i]{comment})); return (1, $i); @@ -2063,7 +2062,7 @@ You should make sure that the page size and the ink type/printing mode (if avail } elsif ($printer->{ARGS}[$i]{type} eq 'bool') { # boolean option push(@{$printer->{currentqueue}{options}}, $printer->{ARGS}[$i]{name} . "=" . - (($choicelists[$i][0] eq $userinputs[$i]) ? "1" : "0")); + ($choicelists[$i][0] eq $userinputs[$i] ? "1" : "0")); } else { # numerical option push(@{$printer->{currentqueue}{options}}, $printer->{ARGS}[$i]{name} . "=" . $userinputs[$i]); @@ -2076,9 +2075,9 @@ You should make sure that the page size and the ink type/printing mode (if avail sub setasdefault { my ($printer, $in) = @_; $in->set_help('setupAsDefault') if $::isInstall; - if (($printer->{DEFAULT} eq '') || # We have no default printer, + if ($printer->{DEFAULT} eq '' || # We have no default printer, # so set the current one as default - ($in->ask_yesorno('', N("Do you want to set this printer (\"%s\")\nas the default printer?", $printer->{QUEUE}), 0))) { # Ask the user + $in->ask_yesorno('', N("Do you want to set this printer (\"%s\")\nas the default printer?", $printer->{QUEUE}), 0)) { # Ask the user $printer->{DEFAULT} = $printer->{QUEUE}; printer::default::set_printer($printer); } @@ -2104,7 +2103,7 @@ sub print_testpages { { title => N("Test pages"), messages => N("Please select the test pages you want to print. Note: the photo test page can take a rather long time to get printed and on laser printers with too low memory it can even not come out. In most cases it is enough to print the standard test page."), - cancel => ((!$printer->{NEW}) ? + cancel => (!$printer->{NEW} ? N("Cancel") : ($::isWizard ? N("<- Previous") : N("No test pages"))), ok => ($::isWizard ? N("Next ->") : N("Print")), @@ -2194,8 +2193,8 @@ Note: the photo test page can take a rather long time to get printed and on lase my $asciitestpage = "/usr/share/printer-testpages/testpage.asc"; my @testpages; # Install the filter to convert the photo test page to PS - if (($printer->{SPOOLER} ne "cups") && ($photo) && (!$::testing) && - (!files_exist((qw(/usr/bin/convert))))) { + if ($printer->{SPOOLER} ne "cups" && $photo && !$::testing && + !files_exist((qw(/usr/bin/convert)))) { $in->do_pkgs->install('ImageMagick'); } # set up list of pages to print @@ -2239,10 +2238,8 @@ sub printer_help { my $scanning = ""; my $photocard = ""; if ($printer->{configured}{$queue}) { - if (($printer->{configured}{$queue}{queuedata}{model} eq - N("Unknown model")) || - ($printer->{configured}{$queue}{queuedata}{model} eq - N("Raw printer"))) { + if ($printer->{configured}{$queue}{queuedata}{model} eq "Unknown model" || + $printer->{configured}{$queue}{queuedata}{model} eq N("Raw printer")) { $raw = 1; } # Information about scanning with HP's multi-function devices @@ -2350,8 +2347,8 @@ sub scanner_help { my ($makemodel, $deviceuri) = @_; if ($deviceuri =~ m!^ptal:/(.*)$!) { my $ptaldevice = $1; - if (($makemodel !~ /HP\s+PhotoSmart/i) && - ($makemodel !~ /HP\s+LaserJet\s+2200/i)) { + if ($makemodel !~ /HP\s+PhotoSmart/i && + $makemodel !~ /HP\s+LaserJet\s+2200/i) { # Models with built-in scanner return N("Your multi-function device was configured automatically to be able to scan. Now you can scan with \"scanimage\" (\"scanimage -d hp:%s\" to specify the scanner when you have more than one) from the command line or with the graphical interfaces \"xscanimage\" or \"xsane\". If you are using the GIMP, you can also scan by choosing the appropriate point in the \"File\"/\"Acquire\" menu. Call also \"man scanimage\" on the command line to get more information. @@ -2368,11 +2365,11 @@ sub photocard_help { my ($makemodel, $deviceuri) = @_; if ($deviceuri =~ m!^ptal:/(.*)$!) { my $ptaldevice = $1; - if ((($makemodel =~ /HP\s+PhotoSmart/i) || - ($makemodel =~ /HP\s+PSC\s*9[05]0/i) || - ($makemodel =~ /HP\s+PSC\s*22\d\d/i) || - ($makemodel =~ /HP\s+OfficeJet\s+D\s*1[45]5/i)) && - ($makemodel !~ /HP\s+PhotoSmart\s+7150/i)) { + if (($makemodel =~ /HP\s+PhotoSmart/i || + $makemodel =~ /HP\s+PSC\s*9[05]0/i || + $makemodel =~ /HP\s+PSC\s*22\d\d/i || + $makemodel =~ /HP\s+OfficeJet\s+D\s*1[45]5/i) && + $makemodel !~ /HP\s+PhotoSmart\s+7150/i) { # Models with built-in photo card drives return N("Your printer was configured automatically to give you access to the photo card drives from your PC. Now you can access your photo cards using the graphical program \"MtoolsFM\" (Menu: \"Applications\" -> \"File tools\" -> \"MTools File Manager\") or the command line utilities \"mtools\" (enter \"man mtools\" on the command line for more info). You find the card's file system under the drive letter \"p:\", or subsequent drive letters when you have more than one HP printer with photo card drives. In \"MtoolsFM\" you can switch between drive letters with the field at the upper-right corners of the file lists.", $ptaldevice); @@ -2410,7 +2407,7 @@ sub copy_queues_from { # queues of LPD when one uses LPRng and vice versa, but these queues # do not work. So automatically transfer all queues when switching # between LPD and LPRng. - if (($oldspooler =~ /^lp/) && ($newspooler =~ /^lp/)) { + if ($oldspooler =~ /^lp/ && $newspooler =~ /^lp/) { $noninteractive = 1; } } @@ -2441,9 +2438,8 @@ Mark the printers which you want to transfer and click if (shift(@queuesselected)) { my $oldqueue = $_; my $newqueue = $_; - if ((!$printer->{configured}{$newqueue}) || - ($noninteractive) || - ($in->ask_from_( + if (!$printer->{configured}{$newqueue} || $noninteractive || + $in->ask_from_( { title => N("Transfer printer configuration"), messages => N("A printer named \"%s\" already exists under %s. Click \"Transfer\" to overwrite it. @@ -2456,17 +2452,17 @@ You can also type a new name or skip this printer.", $in->ask_warn('', N("Name of printer should contain only letters, numbers and the underscore")); return (1,0); } - if (($printer->{configured}{$newqueue}) - && ($newqueue ne $oldqueue) && - (!$in->ask_yesorno('', N("The printer \"%s\" already exists,\ndo you really want to overwrite its configuration?", + if ($printer->{configured}{$newqueue} + && $newqueue ne $oldqueue && + !$in->ask_yesorno('', N("The printer \"%s\" already exists,\ndo you really want to overwrite its configuration?", $newqueue), - 0))) { + 0)) { return (1,0); # Let the user correct the name } return 0; } } }, - [{label => N("New printer name"),val => \$newqueue }]))) { + [{label => N("New printer name"),val => \$newqueue }])) { { my $w = $in->wait_message(N("Printerdrake"), N("Transferring %s...", $oldqueue)); @@ -2477,10 +2473,10 @@ You can also type a new name or skip this printer.", if ($oldqueue eq $printer->{DEFAULT}) { # Make the former default printer the new default # printer if the user does not reject - if (($noninteractive) || - ($in->ask_yesorno( + if ($noninteractive || + $in->ask_yesorno( N("Transfer printer configuration"), - N("You have transferred your former default printer (\"%s\"), Should it be also the default printer under the new printing system %s?", $oldqueue, $newspoolerstr), 1))) { + N("You have transferred your former default printer (\"%s\"), Should it be also the default printer under the new printing system %s?", $oldqueue, $newspoolerstr), 1)) { $printer->{DEFAULT} = $newqueue; printer::default::set_printer($printer); } @@ -2528,8 +2524,8 @@ sub check_network { # (otherwise the network is not configured yet and drakconnect has to be # started) - if ((!files_exist("/etc/sysconfig/network-scripts/drakconnect_conf")) && - (!$dontconfigure)) { + if (!files_exist("/etc/sysconfig/network-scripts/drakconnect_conf") && + !$dontconfigure) { my $go_on = 0; while (!$go_on) { my $choice = N("Configure the network now"); @@ -2570,7 +2566,7 @@ sub check_network { if (printer::detect::network_running()) { return 1 } # The network is configured now, start it. - if ((!start_network($in, $upNetwork)) && (!$dontconfigure)) { + if (!start_network($in, $upNetwork) && !$dontconfigure) { $in->ask_warn(N("Configuration of a remote printer"), ($::isInstall ? N("The network configuration done during the installation cannot be started now. Please check whether the network gets accessable after booting your system and correct the configuration using the Mandrake Control Center, section \"Network & Internet\"/\"Connection\", and afterwards set up the printer, also using the Mandrake Control Center, section \"Hardware\"/\"Printer\"") : @@ -2614,7 +2610,7 @@ sub security_check { if ($spooler eq "pdq") { return 1 } # Exit silently in medium or lower security levels - if ((!$security) || ($security < 4)) { return 1 } + if (!$security || $security < 4) { return 1 } # Exit silently if the current spooler is already activated for the current # security level @@ -2634,7 +2630,7 @@ Do you really want to configure printing on this machine?", $securitystr))) { printer::main::add_spooler_to_security_level($spooler, $security); my $service; - if (($spooler eq "lpr") || ($spooler eq "lprng")) { + if ($spooler eq "lpr" || $spooler eq "lprng") { $service = "lpd"; } else { $service = $spooler; @@ -2682,13 +2678,13 @@ sub install_spooler { { my $w = $in->wait_message(N("Printerdrake"), N("Checking installed software...")); - if ((!$::testing) && - (!files_exist((qw(/usr/lib/cups/cgi-bin/printers.cgi + if (!$::testing && + !files_exist((qw(/usr/lib/cups/cgi-bin/printers.cgi /sbin/ifconfig /usr/bin/xpp), ($::expert ? "/usr/share/cups/model/postscript.ppd.gz" : ()) - )))) { + ))) { $in->do_pkgs->install(('cups', 'net-tools', 'xpp', ($::expert ? 'cups-drivers' : ()))); } @@ -2725,19 +2721,19 @@ sub install_spooler { my $w = $in->wait_message(N("Printerdrake"), N("Checking installed software...")); # "lpr" conflicts with "LPRng", remove "LPRng" - if ((!$::testing) && - (files_exist((qw(/usr/lib/filters/lpf))))) { + if (!$::testing && + files_exist((qw(/usr/lib/filters/lpf)))) { my $w = $in->wait_message(N("Printerdrake"), N("Removing LPRng...")); $in->do_pkgs->remove_nodeps('LPRng'); } - if ((!$::testing) && - (!files_exist((qw(/usr/sbin/lpf + if (!$::testing && + !files_exist((qw(/usr/sbin/lpf /usr/sbin/lpd /sbin/ifconfig /usr/bin/gpr /usr/bin/a2ps - /usr/bin/convert))))) { + /usr/bin/convert)))) { $in->do_pkgs->install(('lpr', 'net-tools', 'gpr', 'a2ps', 'ImageMagick')); } # Start the network (especially during installation), so the @@ -2764,19 +2760,19 @@ sub install_spooler { my $w = $in->wait_message(N("Printerdrake"), N("Checking installed software...")); # "LPRng" conflicts with "lpr", remove "lpr" - if ((!$::testing) && - (files_exist((qw(/usr/sbin/lpf))))) { + if (!$::testing && + files_exist((qw(/usr/sbin/lpf)))) { my $w = $in->wait_message(N("Printerdrake"), N("Removing LPD...")); $in->do_pkgs->remove_nodeps('lpr'); } - if ((!$::testing) && - (!files_exist((qw(/usr/lib/filters/lpf + if (!$::testing && + !files_exist((qw(/usr/lib/filters/lpf /usr/sbin/lpd /sbin/ifconfig /usr/bin/gpr /usr/bin/a2ps - /usr/bin/convert))))) { + /usr/bin/convert)))) { $in->do_pkgs->install('LPRng', 'net-tools', 'gpr', 'a2ps', 'ImageMagick'); } # Start the network (especially during installation), so the @@ -2805,9 +2801,9 @@ sub install_spooler { { my $w = $in->wait_message(N("Printerdrake"), N("Checking installed software...")); - if ((!$::testing) && - (!files_exist((qw(/usr/bin/pdq - /usr/X11R6/bin/xpdq))))) { + if (!$::testing && + !files_exist((qw(/usr/bin/pdq + /usr/X11R6/bin/xpdq)))) { $in->do_pkgs->install('pdq'); } # Start the network (especially during installation), so the @@ -2886,10 +2882,10 @@ sub configure_queue { sub install_foomatic { my ($in) = @_; - if ((!$::testing) && - (!files_exist((qw(/usr/bin/foomatic-configure + if (!$::testing && + !files_exist((qw(/usr/bin/foomatic-configure /usr/lib/perl5/vendor_perl/5.8.0/Foomatic/DB.pm) - )))) { + ))) { my $w = $in->wait_message(N("Printerdrake"), N("Installing Foomatic...")); $in->do_pkgs->install('foomatic'); @@ -2926,8 +2922,8 @@ sub main { { my $w = $in->wait_message(N("Printerdrake"), N("Checking installed software...")); - if ((!$::testing) && - (!files_exist((qw(/usr/bin/foomatic-configure + if (!$::testing && + !files_exist((qw(/usr/bin/foomatic-configure /usr/lib/perl5/vendor_perl/5.8.0/Foomatic/DB.pm /usr/bin/escputil /usr/share/printer-testpages/testprint.ps @@ -2936,7 +2932,7 @@ sub main { ), (files_exist("/usr/bin/gimp") ? "/usr/lib/gimp/1.2/plug-ins/print" : ()) - )))) { + ))) { $in->do_pkgs->install('foomatic', 'printer-utils', 'printer-testpages', 'nmap', 'scli', if_($in->do_pkgs->is_installed('gimp'), 'gimpprint')); } @@ -2947,7 +2943,7 @@ sub main { } # If we have chosen a spooler, install it and mark it as default spooler - if (($printer->{SPOOLER}) && ($printer->{SPOOLER} ne '')) { + if ($printer->{SPOOLER} && $printer->{SPOOLER} ne '') { if (!install_spooler($printer, $in, $upNetwork)) { return } printer::default::set_spooler($printer); } @@ -2968,8 +2964,8 @@ sub main { # dialog should leave the program $continue = 0; # Get the default printer - if (defined($printer->{SPOOLER}) && ($printer->{SPOOLER} ne '') && - ((!defined($printer->{DEFAULT})) || ($printer->{DEFAULT} eq ''))) { + if (defined($printer->{SPOOLER}) && $printer->{SPOOLER} ne '' && + (!defined($printer->{DEFAULT}) || $printer->{DEFAULT} eq '')) { my $w = $in->wait_message(N("Printerdrake"), N("Preparing Printerdrake...")); $printer->{DEFAULT} = printer::default::get_printer($printer); @@ -3025,9 +3021,9 @@ sub main { # have a local network, to suppress some buttons in the # recommended mode my $havelocalnetworks_or_expert = - (($::expert) || - (check_network($printer, $in, $upNetwork, 1) && - (printer::detect::getIPsInLocalNetworks() != ()))); + ($::expert || + check_network($printer, $in, $upNetwork, 1) && + printer::detect::getIPsInLocalNetworks() != ()); # Show a queue list window when there is at least one queue, # when we are in expert mode, or when we are not in the # installation. @@ -3045,9 +3041,9 @@ sub main { # is shown directly after having done an operation. $menushown = 1; # Initialize the cursor position - if (($cursorpos eq "::") && - ($printer->{DEFAULT}) && - ($printer->{DEFAULT} ne "")) { + if ($cursorpos eq "::" && + $printer->{DEFAULT} && + $printer->{DEFAULT} ne "") { if ($printer->{configured}{$printer->{DEFAULT}}) { $cursorpos = $printer->{configured}{$printer->{DEFAULT}}{queuedata}{menuentry} . N(" (Default)"); @@ -3061,7 +3057,7 @@ sub main { my @printerlist = ((sort((map { $printer->{configured}{$_}{queuedata}{menuentry} . ($_ eq $printer->{DEFAULT} ? - N(" (Default)") : ("")) } + N(" (Default)") : "") } keys(%{$printer->{configured} || {}})), ($printer->{SPOOLER} eq "cups" ? @@ -3077,7 +3073,7 @@ sub main { { title => N("Printerdrake"), messages => ($noprinters ? "" : - (($printer->{SPOOLER} eq "cups") ? + ($printer->{SPOOLER} eq "cups" ? N("The following printers are configured. Double-click on a printer to change its settings; to make it the default printer; to view information about it; or to make a printer on a remote CUPS server available for Star Office/OpenOffice.org/GIMP.") : N("The following printers are configured. Double-click on a printer to change its settings; to make it the default printer; or to view information about it."))), cancel => (""), @@ -3097,8 +3093,7 @@ sub main { 1; }, val => N("Add a new printer") }, - ((($printer->{SPOOLER} eq "cups") && - ($havelocalnetworks_or_expert)) ? + ($printer->{SPOOLER} eq "cups" && $havelocalnetworks_or_expert ? ({ clicked_may_quit => sub { # Save the cursor position @@ -3142,7 +3137,7 @@ sub main { printer::main::set_usermode(!$::expert); # make sure that the "cups-drivers" package gets # installed when switching into expert mode - if (($::expert) && ($printer->{SPOOLER} eq "cups")) { + if ($::expert && $printer->{SPOOLER} eq "cups") { install_spooler($printer, $in, $upNetwork); } # Read printer database for the new user mode @@ -3220,9 +3215,9 @@ sub main { #- Do all the configuration steps for a new queue step_0: #if ((!$::expert) && (!$::isEmbedded) && (!$::isInstall) && - if ((!$::isEmbedded) && (!$::isInstall) && + if (!$::isEmbedded && !$::isInstall && #if ((!$::isInstall) && - ($in->isa('interactive::gtk'))) { + $in->isa('interactive::gtk')) { $continue = 1; # Enter wizard mode $::Wizard_pix_up = "wiz_printerdrake.png"; @@ -3251,14 +3246,14 @@ sub main { goto step_0; }; step_3: - if (($::expert) or ($printer->{MANUAL}) or - ($printer->{MORETHANONE})) { + if ($::expert or $printer->{MANUAL} or + $printer->{MORETHANONE}) { choose_printer_name($printer, $in) or goto step_2; } get_db_entry($printer, $in); step_3_9: - if ((!$::expert) and (!$printer->{MANUAL})) { + if (!$::expert and !$printer->{MANUAL}) { is_model_correct($printer, $in) or do { goto step_3 if $printer->{MORETHANONE}; goto step_2; @@ -3267,8 +3262,8 @@ sub main { step_4: # Remember DB entry for "Previous" button in wizard my $dbentry = $printer->{DBENTRY}; - if (($::expert) or ($printer->{MANUAL}) or - ($printer->{MANUALMODEL})) { + if ($::expert or $printer->{MANUAL} or + $printer->{MANUALMODEL}) { choose_model($printer, $in) or do { # Restore DB entry $printer->{DBENTRY} = $dbentry; @@ -3319,16 +3314,16 @@ sub main { setup_printer_connection($printer, $in, $upNetwork) or next; #- Cancelling one of the following dialogs should #- restart printerdrake - if (($::expert) or ($printer->{MANUAL}) or - ($printer->{MORETHANONE})) { + if ($::expert or $printer->{MANUAL} or + $printer->{MORETHANONE}) { choose_printer_name($printer, $in) or next; } get_db_entry($printer, $in); - if ((!$::expert) and (!$printer->{MANUAL})) { + if (!$::expert and !$printer->{MANUAL}) { is_model_correct($printer, $in) or next; } - if (($::expert) or ($printer->{MANUAL}) or - ($printer->{MANUALMODEL})) { + if ($::expert or $printer->{MANUAL} or + $printer->{MANUALMODEL}) { choose_model($printer, $in) or next; } get_printer_info($printer, $in) or next; @@ -3395,14 +3390,14 @@ What do you want to modify on this printer?", ($::expert ? N("Printer manufacturer, model, driver") : N("Printer manufacturer, model")), - (($printer->{configured}{$queue}{queuedata}{make} ne - "") && - (($printer->{configured}{$queue}{queuedata}{model} ne - N("Unknown model")) && - ($printer->{configured}{$queue}{queuedata}{model} ne - N("Raw printer"))) ? + ($printer->{configured}{$queue}{queuedata}{make} ne + "" && + ($printer->{configured}{$queue}{queuedata}{model} ne + N("Unknown model") && + $printer->{configured}{$queue}{queuedata}{model} ne + N("Raw printer")) ? N("Printer options") : ())) : ()), - (($queue ne $printer->{DEFAULT}) ? + ($queue ne $printer->{DEFAULT} ? N("Set this printer as the default") : ()), ($printer->{configured}{$queue} ? () : (N("Add this printer to Star Office/OpenOffice.org/GIMP"), @@ -3465,8 +3460,8 @@ What do you want to modify on this printer?", } $queue = $printer->{QUEUE}; } - } elsif (($modify eq N("Printer manufacturer, model, driver")) || - ($modify eq N("Printer manufacturer, model"))) { + } elsif ($modify eq N("Printer manufacturer, model, driver") || + $modify eq N("Printer manufacturer, model")) { get_db_entry($printer, $in); choose_model($printer, $in) && get_printer_info($printer, $in) && @@ -3533,7 +3528,7 @@ What do you want to modify on this printer?", # Make sure that the cursor is still at the same position # in the main menu when one has modified something on the # current printer - if (($printer->{QUEUE}) && ($printer->{QUEUE} ne "")) { + if ($printer->{QUEUE} && $printer->{QUEUE} ne "") { if ($printer->{configured}{$printer->{QUEUE}}) { $cursorpos = $printer->{configured}{$printer->{QUEUE}}{queuedata}{menuentry} . @@ -3544,8 +3539,8 @@ What do you want to modify on this printer?", my $s2 = $s1; $s2 =~ s/\(/\\\(/; $s2 =~ s/\)/\\\)/; - if (($printer->{QUEUE} eq $printer->{DEFAULT}) && - ($cursorpos !~ /$s2/)) { + if ($printer->{QUEUE} eq $printer->{DEFAULT} && + $cursorpos !~ /$s2/) { $cursorpos .= $s1; } } diff --git a/perl-install/resize_fat/dir_entry.pm b/perl-install/resize_fat/dir_entry.pm index b39c72094..424860b86 100644 --- a/perl-install/resize_fat/dir_entry.pm +++ b/perl-install/resize_fat/dir_entry.pm @@ -21,7 +21,7 @@ sub get_cluster($) { } sub set_cluster($$) { my ($entry, $val) = @_; - $entry->{first_cluster} = $val & (1 << 16) - 1; + $entry->{first_cluster} = $val & ((1 << 16) - 1); $entry->{first_cluster_high} = $val >> 16 if $resize_fat::isFAT32; } diff --git a/perl-install/resize_fat/main.pm b/perl-install/resize_fat/main.pm index 216739faf..3e82c71a3 100644 --- a/perl-install/resize_fat/main.pm +++ b/perl-install/resize_fat/main.pm @@ -121,13 +121,13 @@ sub resize { $size >= $min or die "Minimum filesystem size is $min sectors"; $size <= $max or die "Maximum filesystem size is $max sectors"; - log::l("resize_fat: Partition size will be " . ($size * $SECTORSIZE >> 20) . "Mb (well exactly ${size} sectors)"); + log::l("resize_fat: Partition size will be " . (($size * $SECTORSIZE) >> 20) . "Mb (well exactly ${size} sectors)"); my $new_data_size = $size * $SECTORSIZE - $fs->{cluster_offset}; my $new_nb_clusters = divide($new_data_size, $fs->{cluster_size}); my $used_size = used_size($fs); - log::l("resize_fat: Break point for moving files is " . ($used_size * $SECTORSIZE >> 20) . " Mb ($used_size sectors)"); + log::l("resize_fat: Break point for moving files is " . (($used_size * $SECTORSIZE) >> 20) . " Mb ($used_size sectors)"); if ($size < $used_size) { log::l("resize_fat: Allocating new clusters"); resize_fat::fat::allocate_remap($fs, $new_nb_clusters); diff --git a/perl-install/run_program.pm b/perl-install/run_program.pm index 07a966cc6..6d5a36c30 100644 --- a/perl-install/run_program.pm +++ b/perl-install/run_program.pm @@ -45,7 +45,7 @@ sub raw { return 1 if $root && $<; - $root ? $root .= '/' : ($root = ''); + $root ? ($root .= '/') : ($root = ''); install_any::check_prog(ref $name ? $name->[0] : $name) if !$root && $::isInstall; diff --git a/perl-install/scanner.pm b/perl-install/scanner.pm index 565a7d460..93fe714c0 100755 --- a/perl-install/scanner.pm +++ b/perl-install/scanner.pm @@ -181,7 +181,7 @@ sub updateScannerDBfromSane { mfg => sub { $mfg = $val; $name = undef },#bug when a new mfg comes. should called $fs->{ $name }(); but ?? model => sub { unless ($name) { $name = $val; next } - $name = (member($mfg, keys %$sane2DB)) ? + $name = member($mfg, keys %$sane2DB) ? (ref $sane2DB->{$mfg}) ? $sane2DB->{$mfg}($name) : "$sane2DB->{ $mfg }|$name" : "$mfg|$name"; if (member($name, keys %$scanner::scannerDB)) { print "#[$name] already in ScannerDB!\n"; diff --git a/perl-install/steps.pm b/perl-install/steps.pm index ee6530ee0..a62c6da43 100644 --- a/perl-install/steps.pm +++ b/perl-install/steps.pm @@ -27,7 +27,7 @@ use common; summary => [ N_("Summary"), 1, 0, '', "installPackages", 'summary' ], configureServices => [ N_("Configure services"), 1, 1, '!$::expert', "installPackages", 'services' ], setupBootloader => [ N_("Install bootloader"), 1, 0, '', "installPackages", 'bootloader' ], -if_((arch() !~ /alpha/) && (arch() !~ /ppc/), +if_(arch() !~ /alpha/ && arch() !~ /ppc/, createBootdisk => [ N_("Create a bootdisk"), 1, 0, '', "installPackages", 'bootdisk' ], ), configureX => [ N_("Configure X"), 1, 1, '', ["formatPartitions", "setupBootloader"], 'X' ], diff --git a/perl-install/swap.pm b/perl-install/swap.pm index 171c2ea1d..7b7c51586 100644 --- a/perl-install/swap.pm +++ b/perl-install/swap.pm @@ -23,7 +23,7 @@ my $signature_page = "\0" x $pagesize; my $V0_MAX_PAGES = 8 * $pagesize - 10; my $V1_OLD_MAX_PAGES = int 0x7fffffff / $pagesize - 1; my $V1_MAX_PAGES = $V1_OLD_MAX_PAGES; #- (1 << 24) - 1; -my $MAX_BADPAGES = int ($pagesize - 1024 - 128 * $sizeof_int - 10) / $sizeof_int; +my $MAX_BADPAGES = int(($pagesize - 1024 - 128 * $sizeof_int - 10) / $sizeof_int); my $signature_format_v1 = "x1024 I I I I125"; #- bootbits, version, last_page, nr_badpages, padding 1; @@ -75,7 +75,7 @@ sub make($;$) { $version = 1; } - $nbpages >= 10 or die "swap area needs to be at least " . (10 * $pagesize / 1024) . "kB"; + $nbpages >= 10 or die "swap area needs to be at least " . 10 * $pagesize / 1024 . "kB"; -b $devicename or $checkBlocks = 0; my $rdev = (stat $devicename)[6]; @@ -89,7 +89,7 @@ sub make($;$) { if ($nbpages > $maxpages) { $nbpages = $maxpages; - log::l("warning: truncating swap area to " . ($nbpages * $pagesize / 1024) . "kB"); + log::l("warning: truncating swap area to " . $nbpages * $pagesize / 1024 . "kB"); } if ($checkBlocks) { @@ -110,7 +110,7 @@ sub make($;$) { MDK::Common::DataStructure::strcpy($signature_page, $version == 0 ? "SWAP-SPACE" : "SWAPSPACE2", $pagesize - 10); - my $offset = ($version == 0) ? 0 : 1024; + my $offset = $version == 0 ? 0 : 1024; sysseek(F, $offset, 0) or die "unable to rewind swap-device: $!"; syswrite(F, substr($signature_page, $offset)) or die "unable to write signature page: $!"; diff --git a/perl-install/ugtk.pm b/perl-install/ugtk.pm index d615421b7..9f7498636 100644 --- a/perl-install/ugtk.pm +++ b/perl-install/ugtk.pm @@ -48,7 +48,7 @@ sub gtkpack__ { gtkpowerpack(0, 1, @_) } sub gtkpack2 { gtkpowerpack(1, 0, @_) } sub gtkpack2_ { gtkpowerpack('arg', 0, @_) } sub gtkpack2__ { gtkpowerpack(0, 0, @_) } -sub gtkpack3 { gtkpowerpack($a ?1 :0, 0, @_) } +sub gtkpack3 { gtkpowerpack($a ? 1 : 0, 0, @_) } sub gtkput { $_[0]->put(gtkshow($_[1]), $_[2], $_[3]); $_[0] } sub gtkpixmap { new Gtk::Pixmap(gdkpixmap(@_)) } sub gtkresize { $_[0]->window->resize($_[1], $_[2]); $_[0] } @@ -718,7 +718,7 @@ sub gtkpowerpack { elsif (!ref($_[0])) { $RefDefaultAttrs = {}; foreach ("expand", "fill", "padding", "pack_end") { - !ref($_[0]) ? $RefDefaultAttrs->{$_} = shift : last + !ref($_[0]) ? ($RefDefaultAttrs->{$_} = shift) : last } } my $box = shift; diff --git a/perl-install/unused/scsi.pm b/perl-install/unused/scsi.pm index bd0df92b1..1755ee255 100644 --- a/perl-install/unused/scsi.pm +++ b/perl-install/unused/scsi.pm @@ -64,7 +64,7 @@ sub ideGetDevices { my $type = ${{ disk => 'hd', cdrom => 'cdrom', tape => 'tape', floppy => 'fd' }}{$t} or next; my ($info) = chomp_(cat_("$d/model")); $info ||= "(none)"; - my $num = ord (($d =~ /(.)$/)[0]) - ord 'a'; + my $num = ord(($d =~ /(.)$/)[0]) - ord 'a'; push @idi, { type => $type, device => basename($d), info => $info, bus => $num/2, id => $num%2 }; } [ @idi ]; |