lilalo

diff l3-agent @ 116:f45ba4b5dc7f

l3-config added
author igor
date Sun Mar 09 23:04:58 2008 +0200 (2008-03-09)
parents 658b4ea105c1
children 71bd999bcb04
line diff
     1.1 --- a/l3-agent	Sun Mar 09 02:38:56 2008 +0200
     1.2 +++ b/l3-agent	Sun Mar 09 23:04:58 2008 +0200
     1.3 @@ -15,7 +15,7 @@
     1.4  use Time::Local 'timelocal_nocheck';
     1.5  use IO::Socket;
     1.6  
     1.7 -use lib "/usr/local/bin";
     1.8 +use lib "/etc/lilalo";
     1.9  use l3config;
    1.10  
    1.11  
    1.12 @@ -250,9 +250,7 @@
    1.13      my $cline_re2_v3 = qr/$cline_re2_v3_base$/sx;
    1.14  
    1.15  
    1.16 -
    1.17 -    my $vt = Term::VT102->new ( 'cols' => $Config{"terminal_width"}, 
    1.18 -                                'rows' => $Config{"terminal_height"});
    1.19 +    my %vt;     # Хэш виртуальных терминалов. По одному на каждый сеанс
    1.20      my $cline_vt = Term::VT102->new (
    1.21                                  'cols' => $Config{"terminal_width"}, 
    1.22                                  'rows' => $Config{"terminal_height"});
    1.23 @@ -282,6 +280,12 @@
    1.24          $file =~ m@.*/([^/]*)\.script$@;
    1.25          $local_session_id = $1;
    1.26  
    1.27 +        if (not defined($vt{$local_session_id})) {
    1.28 +            $vt{$local_session_id} = Term::VT102->new ( 
    1.29 +                                        'cols' => $Config{"terminal_width"}, 
    1.30 +                                        'rows' => $Config{"terminal_height"});
    1.31 +        }
    1.32 +
    1.33          #Если файл только что появился, 
    1.34          #пытаемся найти и загрузить информацию о соответствующей ему сессии
    1.35          if (!$Script_Files{$file}) {
    1.36 @@ -413,7 +417,7 @@
    1.37                  # Output
    1.38                  if (!$last_cl{"suppress_output"} || $last_cl{"err"}) {
    1.39                      for (my $i=0; $i<$Config{"terminal_height"}; $i++) {
    1.40 -                        my $line= $vt->row_plaintext($i);
    1.41 +                        my $line= $vt{$local_session_id}->row_plaintext($i);
    1.42                          next if !defined ($line) ; #|| $line =~ /^\s*$/;
    1.43                          $line =~ s/\s*$//;
    1.44                          $line .= "\n" unless $line =~ /^\s*$/;
    1.45 @@ -424,7 +428,7 @@
    1.46                      $last_cl{"output"}= "";
    1.47                  }
    1.48  
    1.49 -                $vt->reset();
    1.50 +                $vt{$local_session_id}->reset();
    1.51  
    1.52  
    1.53                  # Save 
    1.54 @@ -538,7 +542,7 @@
    1.55                  # Output
    1.56                  if (!$last_cl{"suppress_output"} || $last_cl{"err"}) {
    1.57                      for (my $i=0; $i<$Config{"terminal_height"}; $i++) {
    1.58 -                        my $line= $vt->row_plaintext($i);
    1.59 +                        my $line= $vt{$local_session_id}->row_plaintext($i);
    1.60                          next if !defined ($line) ; #|| $line =~ /^\s*$/;
    1.61                          $line =~ s/\s*$//;
    1.62                          $line .= "\n" unless $line =~ /^\s*$/;
    1.63 @@ -549,7 +553,7 @@
    1.64                      $last_cl{"output"}= "";
    1.65                  }
    1.66  
    1.67 -                $vt->reset();
    1.68 +                $vt{$local_session_id}->reset();
    1.69  
    1.70  
    1.71                  # Changing encoding 
    1.72 @@ -575,7 +579,7 @@
    1.73              $last_output_length+=length($_);
    1.74              #if (!$cl{"suppress_output"} || $last_output_length < 5000) {
    1.75              if ($last_output_length < 50000) {
    1.76 -                $vt->process("$_"."\n") 
    1.77 +                $vt{$local_session_id}->process("$_"."\n") 
    1.78              }
    1.79              else
    1.80              {