summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-05-22 10:36:36 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2009-05-22 10:36:36 +0200
commitd1b176119a4c4152f762e31aeca2b855f8404ad9 (patch)
tree44585cfa27f45816195711cf25134ecb2d0a7e60 /bin
parente952d88c1f0c1420e990114572bbd0d94e158950 (diff)
envstore: Added support for values with nwelines
Diffstat (limited to 'bin')
-rwxr-xr-xbin/envstore10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/envstore b/bin/envstore
index e3398b6..afc9f3e 100755
--- a/bin/envstore
+++ b/bin/envstore
@@ -45,7 +45,11 @@ sub load_store {
chomp;
/^(\S+)\s+(.*)$/ or next;
($key, $value) = ($1, $2);
- $store{$key} = $value;
+ if (exists($store{$key})) {
+ $store{$key} .= "\n$value";
+ } else {
+ $store{$key} = $value;
+ }
}
close($handle);
}
@@ -55,7 +59,9 @@ sub save_store {
umask(0077);
open(my $handle, '>', $store_file) or die("Cannot open $store_file: $!");
foreach $key (keys(%store)) {
- print $handle "$key\t$store{$key}\n";
+ foreach (split(/\n/, $store{$key})) {
+ print $handle "$key\t$_\n";
+ }
}
close($handle);
}