summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2008-02-19 16:32:37 -0800
committerStig Thormodsrud <stig@vyatta.com>2008-02-19 16:32:37 -0800
commit582eded822fadc05a1b60656e8c9920399e6a7f9 (patch)
treee2aa5ec2bdd042d3c71b0842bf98921371192248 /scripts
parent0c60d4dada93f768bf32723daf9acb8814d51e32 (diff)
downloadvyatta-cfg-quagga-582eded822fadc05a1b60656e8c9920399e6a7f9.tar.gz
vyatta-cfg-quagga-582eded822fadc05a1b60656e8c9920399e6a7f9.zip
Add a check for when the vtysh wrapper is called without any parameters.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vyatta-vtysh.pl9
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