ref: d430e0f5a5bce917b9063ef7da943a5bd2d59391
dir: /libstd/env.myr/
use "extremum.use" use "option.use" use "sleq.use" pkg std = extern var _environment : byte[:][:] const getenv : (name : byte[:] -> option(byte[:])) const getenvv : (name : byte[:], default : byte[:] -> byte[:]) ;; const getenv = {name var n for env in _environment n = min(name.len, env.len) if sleq(name, env[:n]) && sleq(env[n:n+1], "=") -> `Some env[n+1:] ;; ;; -> `None } const getenvv = {name, default match getenv(name) | `Some v: -> v | `None: -> default ;; }