diff options
author | J Pipkin <j@dawnrazor.net> | 2012-12-22 18:34:27 -0600 |
---|---|---|
committer | J Pipkin <j@dawnrazor.net> | 2012-12-22 18:34:27 -0600 |
commit | 78a397618b7040868ee07004c7bd0b29399d2905 (patch) | |
tree | d5f0c3fbb6bd931421f60486eb85e01786a50603 /sboconfig | |
parent | 09d1feb09c1b50726f0d37222456d9bf174bbe0e (diff) | |
parent | 5bac066116d3ffaf4a2bd12d1c77b78be5d2147c (diff) | |
download | sbotools2-78a397618b7040868ee07004c7bd0b29399d2905.tar.xz |
Merge branch 'xocel into master'
Diffstat (limited to 'sboconfig')
-rwxr-xr-x | sboconfig | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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; |