script/lsec
changeset 576 158c5a3d0a2a
parent 563 d113b63c55c4
child 643 78929d878b2c
equal deleted inserted replaced
575:9a2121b500b1 576:158c5a3d0a2a
    42 use strict;
    42 use strict;
    43 use Getopt::Std;
    43 use Getopt::Std;
    44 
    44 
    45 my %opt;
    45 my %opt;
    46 my $master_index;
    46 my $master_index;
    47 my $master_dir;
       
    48 my $term_width;
    47 my $term_width;
    49 
    48 
    50 #------------------------------------------------------------------------------
    49 #------------------------------------------------------------------------------
    51 
    50 
    52 $term_width = &get_terminal_width;
    51 $term_width = &get_terminal_width;
    53 &get_options;
    52 &get_options;
    54 &query_master;
    53 &query;
    55 exit 0;
    54 exit 0;
    56 
    55 
    57 #------------------------------------------------------------------------------
    56 #------------------------------------------------------------------------------
    58 
    57 
    59 sub query_master
    58 sub query
    60 {
    59 {
    61     $master_dir = "/sys/ethercat" . $master_index;
    60     my $master_dir;
    62     &query_slaves;
       
    63 }
       
    64 
       
    65 #------------------------------------------------------------------------------
       
    66 
       
    67 sub query_slaves
       
    68 {
       
    69     my $dirhandle;
    61     my $dirhandle;
    70     my $entry;
    62     my $entry;
    71     my @slaves;
    63     my @slaves;
    72     my $slave;
    64     my $slave;
    73     my $abs;
    65     my $abs;
    74     my $line;
    66     my $line;
    75     my $ring_cols;
    67     my $ring_cols;
    76     my $adv_cols;
    68     my $adv_cols;
    77     my $fmt;
    69     my $fmt;
    78     my $cols;
    70     my $cols;
       
    71 
       
    72     $master_dir = "/sys/ethercat/master" . $master_index;
    79 
    73 
    80     unless (opendir $dirhandle, $master_dir) {
    74     unless (opendir $dirhandle, $master_dir) {
    81 		print "Failed to open directory \"$master_dir\".\n";
    75 		print "Failed to open directory \"$master_dir\".\n";
    82 		exit 1;
    76 		exit 1;
    83     }
    77     }