/[cwmp]/google/trunk/scripts/tcli.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /google/trunk/scripts/tcli.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 126 by dpavlin, Fri Oct 26 16:22:23 2007 UTC revision 130 by dpavlin, Fri Oct 26 18:12:10 2007 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  use Expect;  use Expect;
5  use Net::Telnet;  use Net::Telnet;
6    use Data::Dump qw/dump/;
7    
8  my $modem = '10.0.0.138';  my $modem = '10.0.0.138';
9    $modem = shift @ARGV if $#ARGV > 1;
10    
11  my @commands = (  my @commands = (
12  ':system config led=flash',  ':system config led=flash',
13  );  );
14    
15    warn "ARGV = ",dump( $ARGV );
16    
17    sub ask {
18            my ( $prompt, $default ) = @_;
19            warn "## ask $prompt [default]";
20            print "$prompt [$default] ";
21            my $in = <STDIN>;
22            chomp($in);
23            $in = $default unless length($in) > 1;
24            return $in;
25    }
26    
27  while(<>) {  while(<>) {
28          chomp;          chomp;
29          next if (/^#/ || /^\s*$/);          next if (/^#/ || /^\s*$/);
30          push @commands, $_;          my $l = $_;
31            warn "--$_--";
32            $l =~ s/ask\(([^|\)]+)(?:\|([^\)]+))?\)/ask($1,$2)/eg;
33            warn "++ $l\n";
34            push @commands, $l;
35  }  }
36    
37  push @commands, ':system config led=off';  push @commands, ':system config led=off';

Legend:
Removed from v.126  
changed lines
  Added in v.130

  ViewVC Help
Powered by ViewVC 1.1.26