summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-02-03 11:32:39 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-02-03 11:32:39 -0800
commitcc25ba067b79b91c92e0f67026e04a9b295dae76 (patch)
treee8611f88362e081e82d8e98653fd768d5056363e
parent7fa9f0b7bdf358ced81ee8ca3051ce042ffd2e5b (diff)
downloadvyatta-cfg-cc25ba067b79b91c92e0f67026e04a9b295dae76.tar.gz
vyatta-cfg-cc25ba067b79b91c92e0f67026e04a9b295dae76.zip
Simplify logic
Use || operator
-rwxr-xr-xscripts/vyatta-load-config.pl20
1 files changed, 6 insertions, 14 deletions
diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl
index c3dc21f..a942019 100755
--- a/scripts/vyatta-load-config.pl
+++ b/scripts/vyatta-load-config.pl
@@ -53,27 +53,19 @@ if ( $load_file =~ /^[^\/]\w+:\// ) {
if ( $load_file =~ /^(\w+):\/\/\w/ ) {
$mode = 'url';
$proto = lc($1);
- if ( $proto eq 'tftp' ) {
+ unless( $proto eq 'tftp' ||
+ $proto eq 'ftp' ||
+ $proto eq 'http' ||
+ $proto eq 'scp' ) {
+ die "Invalid url protocol [$proto]\n";
}
- elsif ( $proto eq 'ftp' ) {
- }
- elsif ( $proto eq 'http' ) {
- }
- elsif ( $proto eq 'scp' ) {
- }
- else {
- print "Invalid url protocol [$proto]\n";
- exit 1;
- }
- }
- else {
+ } else {
print "Invalid url [$load_file]\n";
exit 1;
}
}
if ( $mode eq 'local' and !( $load_file =~ /^\// ) ) {
-
# relative path
$load_file = "$bootpath/$load_file";
}