34 lines · 1.3 KB · Text
RawDownload
= env: environment module     include "env.m";    env = load Env Env->PATH;     getenv: fn(var: string): string;    setenv: fn(var: string, val: string): int;    getall: fn(): list of (string, string);    clone:  fn(): int;    new:    fn(): int; Env provides an interface to manipulate environment variableswhich may then be shared between processes.   Getenv  returnsthe value of the environment variable var passed as a parame‐ter, or nil if the variable is not set. It does this by read‐ing  the  contents of /env/var.  Setenv sets the value of theenvironment variable var to val.  The value  may  be  nil  tounset the variable. It does this by writing the string val to/env/var.  The routine returns a negative number if it  failsto  set  the variable for any reason.  Getall returns all thevariables in the current environment as a list of  (variable,value)  pairs.   Clone  copies  the  current  environment andplaces the process in a new environment  group.  Changes  nowmade  to  the  environment will not affect the environment ofother processes.  New places the process in a new empty envi‐ronment  group. Changes made in this new environment will notaffect other processes. == source/appl/lib/env.b == see ALSOenv(1), sys-pctl(2), env(3)