summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-01-17 00:49:44 -0800
committerOri Bernstein <ori@eigenstate.org>2017-01-17 00:49:44 -0800
commite26dcd2a475fe909ee4e1bf6120f244e4c0b9d31 (patch)
tree06705f3cddad78ea56697621dadd0f6eda239014 /lib
parent94ee9832f5861c4d09afa12338720eb3a479c342 (diff)
downloadmc-e26dcd2a475fe909ee4e1bf6120f244e4c0b9d31.tar.gz
Setenv for Plan 9.
Diffstat (limited to 'lib')
-rw-r--r--lib/std/env+plan9.myr14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/std/env+plan9.myr b/lib/std/env+plan9.myr
index bc9bd3d..23d3714 100644
--- a/lib/std/env+plan9.myr
+++ b/lib/std/env+plan9.myr
@@ -12,11 +12,13 @@ use "sldup"
use "sleq"
use "slpush"
use "slurp"
+use "blat"
use "threadhooks"
pkg std =
- const getenv : (name : byte[:] -> option(byte[:]))
- const getenvv : (name : byte[:], default : byte[:] -> byte[:])
+ const getenv : (name : byte[:] -> option(byte[:]))
+ const getenvv : (name : byte[:], default : byte[:] -> byte[:])
+ const setenv : (name : byte[:], val : byte[:] -> void)
;;
var envkey : byte[:][:]
@@ -64,3 +66,11 @@ const getenvv = {name, default
| `None: -> default
;;
}
+
+const setenv = {name, val
+ var p
+
+ p = fmt("/env/{}", name)
+ blat(p, val, 0o644)
+ slfree(p)
+}