diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2008-02-19 16:32:37 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2008-02-19 16:32:37 -0800 |
commit | 582eded822fadc05a1b60656e8c9920399e6a7f9 (patch) | |
tree | e2aa5ec2bdd042d3c71b0842bf98921371192248 | |
parent | 0c60d4dada93f768bf32723daf9acb8814d51e32 (diff) | |
download | vyatta-cfg-quagga-582eded822fadc05a1b60656e8c9920399e6a7f9.tar.gz vyatta-cfg-quagga-582eded822fadc05a1b60656e8c9920399e6a7f9.zip |
Add a check for when the vtysh wrapper is called without any parameters.
-rw-r--r-- | scripts/vyatta-vtysh.pl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/vyatta-vtysh.pl b/scripts/vyatta-vtysh.pl index c1101b6d..3462feb0 100644 --- a/scripts/vyatta-vtysh.pl +++ b/scripts/vyatta-vtysh.pl @@ -61,7 +61,7 @@ sub log_it { } sub parse_cmdline { - my $cmdline; + my $cmdline = ""; foreach my $arg (@ARGV) { if (substr($arg, 0, 2) eq "-n") { @@ -112,6 +112,9 @@ sub send_cmds_to_quagga { return 0; } +sub usage { + print "usage: $0 [-n] -c \"<quagga command>\"\n"; +} # # main @@ -119,6 +122,10 @@ sub send_cmds_to_quagga { my ($cmdline, $rc); $cmdline = parse_cmdline(); log_it($cmdline); +if (! defined($cmdline) or $cmdline eq "") { + usage(); + exit 1; +} $rc = send_cmds_to_quagga($cmdline); exit $rc |