summaryrefslogtreecommitdiff
path: root/scripts/vyatta_quagga_utils.pl
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-16 09:58:58 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-16 09:58:58 -0700
commitf9ab046eddd19417c0b2bbe4c5afed2d4516b53f (patch)
treed563f2cb1b9d869ada58d94a4bf1e0b5181c8b21 /scripts/vyatta_quagga_utils.pl
parent8b782b88bd535d739166d21a4cbb95931fff2ce0 (diff)
downloadvyatta-cfg-quagga-f9ab046eddd19417c0b2bbe4c5afed2d4516b53f.tar.gz
vyatta-cfg-quagga-f9ab046eddd19417c0b2bbe4c5afed2d4516b53f.zip
Reindent perl code
Make it look nice and tidy
Diffstat (limited to 'scripts/vyatta_quagga_utils.pl')
-rwxr-xr-xscripts/vyatta_quagga_utils.pl71
1 files changed, 36 insertions, 35 deletions
diff --git a/scripts/vyatta_quagga_utils.pl b/scripts/vyatta_quagga_utils.pl
index 55254cbb..1d85b431 100755
--- a/scripts/vyatta_quagga_utils.pl
+++ b/scripts/vyatta_quagga_utils.pl
@@ -6,12 +6,13 @@ use Vyatta::Misc;
use NetAddr::IP;
use Getopt::Long;
-my ($prefix, $exists, $not_exists, $area);
+my ( $prefix, $exists, $not_exists, $area );
-GetOptions("check-prefix-boundry=s" => \$prefix,
- "not-exists=s" => \$not_exists,
- "exists=s" => \$exists,
- "check-ospf-area=s" => \$area,
+GetOptions(
+ "check-prefix-boundry=s" => \$prefix,
+ "not-exists=s" => \$not_exists,
+ "exists=s" => \$exists,
+ "check-ospf-area=s" => \$area,
);
check_prefix_boundry($prefix) if ($prefix);
@@ -22,52 +23,52 @@ check_ospf_area($area) if ($area);
exit 0;
sub check_prefix_boundry {
- my $prefix = shift;
- my ($net, $network, $cidr);
-
- $net = new NetAddr::IP $prefix;
- $network = $net->network()->cidr();
- $cidr = $net->cidr();
-
- die "Your prefix must fall on a natural network boundry. ",
- "Did you mean $network?\n"
- if ($cidr ne $network);
-
- exit 0;
+ my $prefix = shift;
+ my ( $net, $network, $cidr );
+
+ $net = new NetAddr::IP $prefix;
+ $network = $net->network()->cidr();
+ $cidr = $net->cidr();
+
+ die "Your prefix must fall on a natural network boundry. ",
+ "Did you mean $network?\n"
+ if ( $cidr ne $network );
+
+ exit 0;
}
sub check_exists {
- my $node = shift;
- my $config = new Vyatta::Config;
+ my $node = shift;
+ my $config = new Vyatta::Config;
- exit 0 if $config->exists($node);
- exit 1;
+ exit 0 if $config->exists($node);
+ exit 1;
}
sub check_not_exists {
- my $node = shift;
- my $config = new Vyatta::Config;
+ my $node = shift;
+ my $config = new Vyatta::Config;
- exit 0 if ! $config->exists($node);
- exit 1;
+ exit 0 if !$config->exists($node);
+ exit 1;
}
sub check_ospf_area {
my $area = shift;
#
- # allow both decimal or dotted decimal
+ # allow both decimal or dotted decimal
#
- if ($area =~ m/^\d+$/) {
- if ($area >= 0 && $area <= 4294967295) {
- exit 0;
- }
+ if ( $area =~ m/^\d+$/ ) {
+ if ( $area >= 0 && $area <= 4294967295 ) {
+ exit 0;
+ }
}
- if ($area =~ m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) {
- foreach my $octet ($1, $2, $3, $4) {
- if (($octet < 0) || ($octet > 255)) { exit 1; }
- }
- exit 0
+ if ( $area =~ m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ ) {
+ foreach my $octet ( $1, $2, $3, $4 ) {
+ if ( ( $octet < 0 ) || ( $octet > 255 ) ) { exit 1; }
+ }
+ exit 0;
}
die "Invalid OSPF area: $area\n";