From c6a6010149afb7f4b77555f8eae14b57ed7efef0 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 20 Nov 2002 14:39:19 +0000 Subject: s/$x ne (0|'')/$x/ --- perl-install/interactive/stdio.pm | 4 ++-- perl-install/standalone/drakTermServ | 14 +++++++------- perl-install/standalone/drakbackup | 34 +++++++++++++++++----------------- perl-install/standalone/drakbug | 2 +- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/perl-install/interactive/stdio.pm b/perl-install/interactive/stdio.pm index 0fa6bf3d7..2abe2d5c9 100644 --- a/perl-install/interactive/stdio.pm +++ b/perl-install/interactive/stdio.pm @@ -69,7 +69,7 @@ ask_fromW_begin: print "$e->{text} $e->{label}\n"; print N("Your choice? (0/1, default `%s') ", ${$e->{val}} || '0'); my $i = readln(); - if ($i ne '') { + if ($i) { to_bool($i) != to_bool(${$e->{val}}) and $common->{callbacks}{changed}->($ind); ${$e->{val}} = $i; } @@ -102,7 +102,7 @@ ask_fromW_begin: print $t; } elsif ($e->{type} eq 'entry') { print "$e->{label} $e->{text}\n"; - print N("Your choice? (default `%s'%s) ", ${$e->{val}}, ${$e->{val}} ne '' ? N(" enter `void' for void entry") : ''); + print N("Your choice? (default `%s'%s) ", ${$e->{val}}, ${$e->{val}} ? N(" enter `void' for void entry") : ''); my $i = readln(); ${$e->{val}} = $i || ${$e->{val}}; ${$e->{val}} = '' if ${$e->{val}} eq 'void'; diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ index 4e717098f..55059bda1 100755 --- a/perl-install/standalone/drakTermServ +++ b/perl-install/standalone/drakTermServ @@ -734,7 +734,7 @@ sub maintain_clients { $c_detail->append($c_det_type); $c_det_type->show(); - if ($clients{$key}{filename} ne '') { + if ($clients{$key}{filename}) { my $c_det_nbi = new_with_label Gtk::TreeItem($clients{$key}{filename}); $c_detail->append($c_det_nbi); $c_det_nbi->show(); @@ -758,7 +758,7 @@ sub maintain_clients { my @images = grep(/\.nbi/, all("/var/lib/tftpboot/")); my $have_nbis = @images; - if ($have_nbis ne 0) { + if ($have_nbis) { unshift(@images, ""); $entry_nbi->set_popdown_strings(@images); $entry_nbi->set_value_in_list(1, 0); @@ -793,7 +793,7 @@ sub maintain_clients { my $mac = $entry_mac->get_text(); my $ip = $entry_ip->get_text(); my $nbi = $entry_nbi->entry->get_text(); - if ($hostname ne '' && $mac ne '' && $ip ne '') { + if ($hostname && $mac && $ip) { my $result = addclient(0, $hostname, $mac, $ip, $nbi, $is_thin); @@ -819,7 +819,7 @@ sub maintain_clients { $c_detail->append($c_det_type); $c_det_type->show(); - if ($nbi ne '') { + if ($nbi) { my $c_det_nbi = new_with_label Gtk::TreeItem($nbi); $c_detail->append($c_det_nbi); $c_det_nbi->show(); @@ -1109,7 +1109,7 @@ sub write_dhcpd_config { print FHANDLE "\toption broadcast-address $broadcast;\n" if $broadcast; print FHANDLE "\toption domain-name \"$domain\";\n" if $domain; - my $pool_string = "\trange dynamic-bootp " . $pool_start . " " . $pool_end . ";\n" if (($pool_start ne '') && ($pool_end ne '')); + my $pool_string = "\trange dynamic-bootp " . $pool_start . " " . $pool_end . ";\n" if $pool_start && $pool_end; print FHANDLE $pool_string if $pool_string; my $ns_string = "\toption domain-name-servers " . $ns1 if $ns1; @@ -1517,8 +1517,8 @@ sub format_client_entry { my $entry = "host $client {\n"; $entry .= "\thardware ethernet\t$ts_clients{$client}{hardware};\n"; $entry .= "\tfixed-address\t\t$ts_clients{$client}{address};\n"; - $entry .= "\t#type\t\t\t$ts_clients{$client}{type};\n" if ($ts_clients{$client}{type} ne ''); - $entry .= "\tfilename\t\t\"$ts_clients{$client}{filename}\";\n" if ($ts_clients{$client}{filename} ne ''); + $entry .= "\t#type\t\t\t$ts_clients{$client}{type};\n" if $ts_clients{$client}{type}; + $entry .= "\tfilename\t\t\"$ts_clients{$client}{filename}\";\n" if $ts_clients{$client}{filename}; $entry .= "}\n"; write_thin_inittab($ts_clients{$client}{address}) if ($ts_clients{$client}{type} eq "thin"); $entry diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup index 99f626588..0d22edf02 100755 --- a/perl-install/standalone/drakbackup +++ b/perl-install/standalone/drakbackup @@ -521,8 +521,8 @@ sub get_cd_info { sub save_conf_file { - write_sitecopyrc() if ($net_proto eq 'webdav'); - write_password_file() if (($net_proto eq 'rsync') && ($passwd_user ne '')); + write_sitecopyrc() if $net_proto eq 'webdav'; + write_password_file() if $net_proto eq 'rsync' && $passwd_user; my @cfg_list = ("SYS_FILES=@sys_files\n", "HOME_FILES=@user_list\n", @@ -759,7 +759,7 @@ sub do_expect { eval { require Expect }; - if ($@ ne '') { + if ($@) { if ($mode eq 'sendkey') { ${$central_widget}->destroy(); check_pkg_needs(); @@ -898,8 +898,8 @@ sub webdav_client { sub rsync_client { $DEBUG and print "file list to send: $_\n " foreach @file_list_to_send_by_ftp; my $rsync_cmd = "rsync -tv $save_path/* "; - $rsync_cmd = $rsync_cmd . "--password-file=$cfg_dir/rsync.user " if ($passwd_user ne ''); - $rsync_cmd = $rsync_cmd . "$login_user\@" if ($login_user ne ''); + $rsync_cmd = $rsync_cmd . "--password-file=$cfg_dir/rsync.user " if $passwd_user; + $rsync_cmd = $rsync_cmd . "$login_user\@" if $login_user; $rsync_cmd = $rsync_cmd . "$host_name\:\:$host_path"; spawn_progress($rsync_cmd, "Running rsync"); return(0); @@ -1026,14 +1026,14 @@ sub get_cd_volname { } sub build_iso { - if (($multi_session) && ($session_offset ne '')) { + if ($multi_session && $session_offset) { $vol_name = get_cd_volname(); } else { $vol_name = "Drakbackup" . $the_time; } #this is safe to change the volname on rewrites, as is seems to get ignored anyway my $command = "mkisofs -r -J -T -v -V '$vol_name' "; - $command .= "-C $session_offset -M $cd_device " if (($multi_session) && ($session_offset ne '')); + $command .= "-C $session_offset -M $cd_device " if $multi_session && $session_offset; $command .= "-o $save_path/drakbackup.iso @file_list_to_send_by_ftp"; spawn_progress($command, "Running mkisofs..."); } @@ -1310,7 +1310,7 @@ sub build_backup_files { } #- should hit this block if running daemon mode only - if ($daemon && ($daemon_media ne '')) { + if ($daemon && $daemon_media) { # ftp_client() if $ftp_daemon; rsync_client() if ($daemon_media eq 'rsync'); ssh_client() if (($daemon_media eq 'ssh') && !($use_expect)); @@ -1337,7 +1337,7 @@ sub build_backup_files { #- consolidate all the other methods under here - interactive and --default should land here if (!$daemon) { - if ($where_net && ($net_proto ne '') && ($net_proto ne 'ftp')) { + if ($where_net && $net_proto && ($net_proto ne 'ftp')) { rsync_client() if ($net_proto eq 'rsync'); ssh_client() if (($net_proto eq 'ssh') && !($use_expect)); do_expect("backup", "") if (($net_proto eq 'ssh') && ($use_expect)); @@ -1372,7 +1372,7 @@ sub build_backup_files { $catalog .= ":HD:localhost:$save_path"; $net_proto = ''; } - $catalog .= ":$net_proto:$login_user\@$host_name:$host_path" if ($net_proto ne ''); + $catalog .= ":$net_proto:$login_user\@$host_name:$host_path" if $net_proto; $catalog .= ":CD:$vol_name:$cd_device" if ($where_cd); $catalog .= ":Tape:$vol_name:$tape_device" if ($where_tape); $catalog .= ":System" if ($backup_sys); @@ -1435,7 +1435,7 @@ sub check_pkg_needs { $extra_pkg = 'perl-Expect' if (($net_proto eq 'ssh') && (($use_expect) || ($xfer_keys))); } $extra_pkg = 'mt-st' if ($where_tape); - if ($extra_pkg ne '') { + if ($extra_pkg) { if (require_rpm($extra_pkg)) { return(0); } else { @@ -1799,7 +1799,7 @@ sub advanced_where_net_types { $entry_net_type->entry->set_text($net_proto); $entry_net_type->entry->editable(0); $button_xfer_keys->signal_connect('clicked', sub { - if (($passwd_user ne '') && ($login_user ne '') && ($host_name ne '')) { + if ($passwd_user && $login_user && $host_name) { do_expect("sendkey", $backup_key); } else { $in->ask_warn('',N("Need hostname, username and password!")); @@ -1979,7 +1979,7 @@ sub advanced_where_cd { $current_widget->(); }); $button_erase_now->signal_connect('clicked', sub { - if ($cd_device ne '') { + if ($cd_device) { erase_cdrw(); } else { $in->ask_warn('',N("No CD device defined!")); @@ -3367,7 +3367,7 @@ sub catalog_restore { ), 0, gtkpack_(new Gtk::HBox(1, 10), 1, gtksignal_connect(new Gtk::Button(N("Restore Selected\nCatalog Entry")), clicked => sub { - if ($cat_entry ne '') { + if ($cat_entry) { my $media_check = restore_catalog_entry($cat_entry, ()); if ($media_check) { ${$central_widget}->destroy(); @@ -3380,7 +3380,7 @@ sub catalog_restore { my $files = @restore_files; #- grab the array before the widget clears it my @passed_files = @restore_files; - if (($cat_entry ne '') && ($files != 0)) { + if ($cat_entry && $files) { my $media_check = restore_catalog_entry($cat_entry, @passed_files); if ($media_check) { ${$central_widget}->destroy(); @@ -3821,7 +3821,7 @@ sub restore_find_media_box { my $message = "Unable to find backups to restore...\n"; $message .= "Verify that $path_to_find_restore is the correct path" if (($where_hd) && ($where_cd)); $message .= " and the CD is in the drive" if ($where_cd); - if (($where_tape) || ($net_proto ne '')) { + if ($where_tape || $net_proto) { $message .= "Backups on unmountable media - Use Catalog to restore"; $mount_media = 0; } @@ -4636,7 +4636,7 @@ sub interactive_mode_box { sub interactive_mode { $interactive = 1; eval { require my_gtk; }; - if ($@ ne '') { + if ($@) { die "Can't load my_gtk...\n"; } else { my_gtk->import(qw(:helpers :wrappers)); diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug index b8e1c3a3e..cd949fdbb 100755 --- a/perl-install/standalone/drakbug +++ b/perl-install/standalone/drakbug @@ -152,7 +152,7 @@ sub update_app { } } - $app_choice ne '' ? $package->set_text("$app_choice") : $package->set_text(N("Not installed")); + $app_choice ? $package->set_text("$app_choice") : $package->set_text(N("Not installed")); } my %packages; -- cgit v1.2.1