# simple ``environment variable'' server
load file2chan std
(file2chan /chan/env
{
rescue 'bad $ arg' {} {
fid := ${rget fid}
v := rq^$fid
(if {! ~ $#$v 0}
{rread ${quote $$$v}}
{rerror 'no variable name written'}
)
}
}
{rq^${rget fid} = ${rget data}}
{rq^${rget fid} = ()}
)
fn getenv {
var := $1
{echo -n $var >[1=3]; /usr/rog/limbo/read 8192 0 <[0=3]} <>[3] /chan/env
}
|