aboutsummaryrefslogtreecommitdiff
path: root/sboconfig
diff options
context:
space:
mode:
authorJacob Pipkin <j@dawnrazor.net>2012-05-30 16:05:44 -0500
committerJacob Pipkin <j@dawnrazor.net>2012-05-30 16:05:44 -0500
commit76336e45482c08ee962ab1efc857e1b66b18b1e6 (patch)
tree67ee12452a6df93315ceaf47f5a0a2e43f0d486e /sboconfig
parenta0ac34529effe5ac75542b6b843aea47e5d2a7b1 (diff)
downloadsbotools2-76336e45482c08ee962ab1efc857e1b66b18b1e6.tar.xz
many small cleanups, fixes for consistency, code reduction, etc
Diffstat (limited to 'sboconfig')
-rwxr-xr-xsboconfig13
1 files changed, 5 insertions, 8 deletions
diff --git a/sboconfig b/sboconfig
index 967819b..beaa719 100755
--- a/sboconfig
+++ b/sboconfig
@@ -56,7 +56,7 @@ if (exists $options{l}) {
exit 0;
}
-show_usage () unless %options;
+show_usage () and exit (0) unless %options;
my %valid_confs = (
c => 'NOCLEAN',
@@ -72,9 +72,8 @@ while (my ($key, $value) = each %valid_confs) {
$changes{$value} = $options{$key} if exists $options{$key};
}
if (exists $changes{JOBS}) {
- unless ($changes{JOBS} =~ /^\d+$/ || $changes{JOBS} eq 'FALSE') {
- die "You have provided an invalid parameter for -j\n";
- }
+ die "You have provided an invalid parameter for -j\n" unless
+ ($changes{JOBS} =~ /^\d+$/ || $changes{JOBS} eq 'FALSE');
}
my $conf_dir = $SBO::Lib::conf_dir;;
@@ -86,14 +85,12 @@ sub config_write {
script_error ('config_write requires two arguments.') unless exists $_[1];
my ($key, $val) = @_;
if (! -d $conf_dir) {
- mkdir ($conf_dir)
- or die "Unable to create $conf_dir. Exiting.\n";
+ mkdir ($conf_dir) or die "Unable to create $conf_dir. Exiting.\n";
}
if (-f $conf_file) {
- # get a temp file and fill it with the contents of our config file
my ($fh, $filename) = make_temp_file ();
close $fh;
- copy ($conf_file, $filename)
+ copy ($conf_file, $filename);
# tie the file so that if $key is already there, we just change that
# line and untie it
tie my @temp, 'Tie::File', $filename;