From 582eded822fadc05a1b60656e8c9920399e6a7f9 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Tue, 19 Feb 2008 16:32:37 -0800 Subject: Add a check for when the vtysh wrapper is called without any parameters. --- scripts/vyatta-vtysh.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 \"\"\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 -- cgit v1.2.3