- fixed two argument invocation (modem, script)
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 30 Oct 2007 14:45:17 +0000 (14:45 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 30 Oct 2007 14:45:17 +0000 (14:45 +0000)
- added usage when called without args

git-svn-id: https://perl-cwmp.googlecode.com/svn/trunk@180 836a5e1a-633d-0410-964b-294494ad4392

scripts/tcli.pl

index eede562..037b0d1 100755 (executable)
@@ -5,15 +5,15 @@ use Expect;
 use Net::Telnet;
 use Data::Dump qw/dump/;
 
+die "usage: $0 [modem] commands\n" unless @ARGV;
+
 my $modem = '10.0.0.138';
-$modem = shift @ARGV if $#ARGV > 1;
+$modem = shift @ARGV if $#ARGV >= 1;
 
 my @commands = (
 ':system config led=flash',
 );
 
-warn "ARGV = ",dump( $ARGV );
-
 sub ask {
        my ( $prompt, $default ) = @_;
        warn "## ask $prompt [default]";
@@ -38,6 +38,8 @@ push @commands, ':system config led=off';
 
 my $debug = 0;
 
+warn "## connecting to $modem\n";
+
 my $telnet = new Net::Telnet( $modem ) or die "Cannot telnet to $modem: $!\n";
 my $exp = Expect->exp_init($telnet);
 $exp->debug( $debug );