.
.   
NEdit.org
   .

Home
 - News - Download - Documentation - Search - FTP     
.
.
  

Get environment variable

[Back]

This function returns the value of the environment variable passed to it, i.e.:

$HOME=getenv("HOME")
It requires that the whole environment is kept in the global varible $ENVSTR, which is faster than using several shell commands to get values. Add the following to your .neditmacro file:
$ENVSTR=shell_command("setenv","")

define getenv {
   if($n_args==0) return $ENVSTR
   else {
      if(search_string($ENVSTR, "(^|[\n])" $1 "[=]", 0, "regex")!=-1) {
         vn=$search_end
         ve=search_string($ENVSTR, "\n", vn, "regex")
         if(ve>=vn) return substring($ENVSTR, vn, ve)
      }
   }
   return ""
}
[Back]

. Released on  Wed, 21 Nov 2001  by C. Denat  

  
Visit our sponsor
Check Metrolink

© NEdit.org
1999-2001
All rights reserved


.