summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-04-18 00:14:04 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2009-04-18 00:14:04 +0200
commit98ff359879119cfbdf8399ebaab5ff3cb4d14bb1 (patch)
tree500e24489230ee357893a51bdd78f2f49c3e1b7b /bin
parent30c1daf25d36fd4a630edc46323b5a2dc7e6c555 (diff)
envstore: API change - save var value instead of var=value
Diffstat (limited to 'bin')
-rwxr-xr-xbin/envstore10
1 files changed, 4 insertions, 6 deletions
diff --git a/bin/envstore b/bin/envstore
index 5c27b22..5dad484 100755
--- a/bin/envstore
+++ b/bin/envstore
@@ -9,6 +9,7 @@ my $store_file = "/tmp/.envstore-$>";
my %store;
my $action = shift;
my $arg = shift;
+my $arg2 = shift;
my ($key, $value);
sub check_store {
@@ -54,11 +55,8 @@ sub save_store {
}
sub get_keyvalue {
- my $arg = shift;
- my ($key, $value);
- $arg =~ /^(\w+)(?:=(.*))?$/;
- ($key, $value) = ($1, $2);
- unless (defined($2)) {
+ my ($key, $value) = @_;
+ unless (defined($value)) {
if (exists($ENV{$key})) {
$value = $ENV{$key};
} else {
@@ -71,7 +69,7 @@ sub get_keyvalue {
load_store;
if ($action eq 'save') {
- ($key, $value) = get_keyvalue($arg);
+ ($key, $value) = get_keyvalue($arg, $arg2);
$store{$key} = $value;
save_store;
} elsif ($action eq 'eval') {