summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-20 20:49:01 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-20 20:49:01 -0700
commit0d5eba684254f37950583badc6d84b38b283afed (patch)
treec7985ca5697a6130cbfe9b54e2eefc05168f583f /scripts
parentfa0ba2ecb40898257a1e18b176db187fe0baebf1 (diff)
downloadvyatta-cfg-0d5eba684254f37950583badc6d84b38b283afed.tar.gz
vyatta-cfg-0d5eba684254f37950583badc6d84b38b283afed.zip
Fix vyatta-interfaces
Extra comma in options hash list! Get rid of perl function prototype for usage. Perl Best Practices and other books recommend against them. Move up exit to avoid surprises in later code.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-interfaces.pl27
1 files changed, 12 insertions, 15 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index d647e96..8fc5226 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -48,7 +48,7 @@ my $dhcp_daemon = '/sbin/dhclient';
my ($eth_update, $eth_delete, $addr, $dev, $mac, $mac_update, $op_dhclient);
my ($check_name, $show_names, $intf_cli_path, $vif_name, $warn_name);
-sub usage() {
+sub usage {
print "Usage: $0 --dev=<interface> --check=<type>\n";
print " $0 --dev=<interface> --warn\n";
print " $0 --dev=<interface> --valid-mac=<aa:aa:aa:aa:aa:aa>\n";
@@ -69,18 +69,19 @@ GetOptions("eth-addr-update=s" => \$eth_update,
"check=s" => \$check_name,
"show=s" => \$show_names,
"vif=s" => \$vif_name,
- "warn", => \$warn_name,
+ "warn" => \$warn_name,
) or usage();
-if ($eth_update) { update_eth_addrs($eth_update, $dev); }
-if ($eth_delete) { delete_eth_addrs($eth_delete, $dev); }
-if ($addr) { is_valid_addr($addr, $dev); }
-if ($mac) { is_valid_mac($mac, $dev); }
-if ($mac_update) { update_mac($mac_update, $dev); }
-if ($op_dhclient) { op_dhcp_command($op_dhclient, $dev); }
-if ($check_name) { is_valid_name($check_name, $dev); }
-if ($warn_name) { exists_name($dev); }
-if ($show_names) { show_interfaces($show_names); }
+update_eth_addrs($eth_update, $dev) if ($eth_update);
+delete_eth_addrs($eth_delete, $dev) if ($eth_delete);
+is_valid_addr($addr, $dev) if ($addr);
+is_valid_mac($mac, $dev) if ($mac);
+update_mac($mac_update, $dev) if ($mac_update);
+op_dhcp_command($op_dhclient, $dev) if ($op_dhclient);
+is_valid_name($check_name, $dev) if ($check_name);
+exists_name($dev) if ($warn_name);
+show_interfaces($show_names) if ($show_names);
+exit 0;
sub is_ip_configured {
my ($intf, $ip) = @_;
@@ -484,7 +485,3 @@ sub show_interfaces {
}
print join(' ', @match), "\n";
}
-
-exit 0;
-
-# end of file