From f5e1b639cb4407c09b01a10f0a5a48261bb95a6c Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 22 May 2003 17:44:49 +0000 Subject: (build_list) simplify ip parsing --- perl-install/standalone/drakconnect | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect index e0f0d7d75..8381bf2a3 100755 --- a/perl-install/standalone/drakconnect +++ b/perl-install/standalone/drakconnect @@ -169,8 +169,6 @@ my $list = Gtk2::TreeView->new_with_model($tree_model); $list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererPixbuf->new, 'pixbuf' => 0)); each_index { $list->append_column(Gtk2::TreeViewColumn->new_with_attributes($_, Gtk2::CellRendererText->new, 'text' => $::i + 1)) } (N("Interface"), N("IP address"), N("Protocol"), N("Driver"), N("State")); -my $ip_regexp = qr/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - build_list(); my $button_lan = gtksignal_connect(Gtk2::Button->new(N("Configure Local Area Network...")), @@ -294,7 +292,7 @@ sub build_list() { my ($ip, $state); if (-x "/sbin/ifconfig") { local $_ = `LC_ALL=C LANG=C LANGUAGE=C LC_MESSAGES=C /sbin/ifconfig "eth$i"`; - $ip = /inet addr\:$ip_regexp/ ? "$1.$2.$3.$4" : N("Bad Ip"); + $ip = /inet addr:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/o ? $1 : N("Bad Ip"); $_ = `LC_ALL=C LANG=C LANGUAGE=C LC_MESSAGES=C /sbin/ifconfig`; $state = /eth$i/ ? "up" : "down"; } else { -- cgit v1.2.1