script/lsec
changeset 576 158c5a3d0a2a
parent 563 d113b63c55c4
child 643 78929d878b2c
--- a/script/lsec	Tue Feb 20 09:43:23 2007 +0000
+++ b/script/lsec	Tue Feb 20 11:28:15 2007 +0000
@@ -44,28 +44,20 @@
 
 my %opt;
 my $master_index;
-my $master_dir;
 my $term_width;
 
 #------------------------------------------------------------------------------
 
 $term_width = &get_terminal_width;
 &get_options;
-&query_master;
+&query;
 exit 0;
 
 #------------------------------------------------------------------------------
 
-sub query_master
-{
-    $master_dir = "/sys/ethercat" . $master_index;
-    &query_slaves;
-}
-
-#------------------------------------------------------------------------------
-
-sub query_slaves
-{
+sub query
+{
+    my $master_dir;
     my $dirhandle;
     my $entry;
     my @slaves;
@@ -77,6 +69,8 @@
     my $fmt;
     my $cols;
 
+    $master_dir = "/sys/ethercat/master" . $master_index;
+
     unless (opendir $dirhandle, $master_dir) {
 		print "Failed to open directory \"$master_dir\".\n";
 		exit 1;