aboutsummaryrefslogtreecommitdiff
path: root/sboconfig
diff options
context:
space:
mode:
Diffstat (limited to 'sboconfig')
-rwxr-xr-xsboconfig11
1 files changed, 6 insertions, 5 deletions
diff --git a/sboconfig b/sboconfig
index 892279c..71d9d91 100755
--- a/sboconfig
+++ b/sboconfig
@@ -5,7 +5,8 @@
# sboconfig
# script to handle sbotools configuration
#
-# author: Jacob Pipkin <j@dawnrazor.net>
+# authors: Jacob Pipkin <j@dawnrazor.net>
+# Luke Williams <xocel@iquidus.org>
# license: WTFPL <http://sam.zoy.org/wtfpl/COPYING>
use 5.16.0;
@@ -105,7 +106,7 @@ if (exists $changes{SBO_HOME}) {
# TODO: if multiple options are provided to this script, this sub should write
# them all at once, instead of only a single one and having to call it once for
# each option specified to the script.
-sub config_write ($$) {
+sub config_write {
exists $_[1] or script_error 'config_write requires two arguments.';
my ($key, $val) = @_;
if (! -d $conf_dir) {
@@ -131,13 +132,13 @@ sub config_write ($$) {
seek $tempfh, 0, 0;
my $contents = do {local $/; <$tempfh>};
close $conffh;
- eval { $conffh = open_fh $conf_file, '>' };
+ eval { $conffh = open_fh ($conf_file, '>') };
warn "Cannot write configuration: $@\n" and return if $@;
print {$conffh} $contents or return;
close $conffh, close $tempfh;
} else {
# no config file, easiest case of all.
- my $fh = open_fh $conf_file, '>' or return;
+ my $fh = open_fh ($conf_file, '>') or return;
print {$fh} "$key=$val\n";
close $fh;
}
@@ -146,7 +147,7 @@ sub config_write ($$) {
while (my ($key, $value) = each %changes) {
say "Setting $key to $value...";
- config_write $key, $value or warn "Unable to write to $conf_file\n";
+ config_write ($key, $value) or warn "Unable to write to $conf_file\n";
}
exit 0;