14.4 Envstring Interface

ORIGIN '~beta/basiclib/betaenv';
LIB_DEF 'sysutilsenvstring' '../lib';
BODY 'private/envstringbody';
(*
 * COPYRIGHT
 *       Copyright Mjolner Informatics, 1992-96
 *       All rights reserved.
 *)
--- LIB: attributes ---
expandEnvVar: 
  (* Expands text containing substrings of the form $(VAR) to the value
   * of the corresponding unix-environment variable.
   * 
   * E.g., if the unix-command printenv says
   * HOME=/users/cn
   * SHELL=/bin/csh
   * USER=cn
   * 
   * then                  is expanded to
   * 
   *  $(SHELL)               /bin/csh
   *  $(HOME)!$(USER)        /users/cn!cn
   * 
   * (if an environment variable is specified, which is not set, then the
   * virtual pattern defaultvalue is called. This allows the programmer to
   * specify default-values for not-set environment variables.
   *)
  (# t: ^text;
     
     defaultValue:< (# envvar,envvarvalue: ^text
       enter envvar[]
       do INNER
       exit envvarvalue[]
       #);
     expand: @...
  enter t[]
  do expand
  exit t[]
  #)


14.4 Envstring Interface
© 1994-2004 Mjølner Informatics
[Modified: Monday August 24th 1998 at 14:44]