lib: add 'module' keyword to environ
[nit.git] / lib / standard / environ.nit
index 6fe9c11..504f1d3 100644 (file)
 # You  are  allowed  to  redistribute it and sell it, alone or is a part of
 # another product.
 
+# Acces of the environement variables of the process
+module environ
+
 import symbol
 
 # TODO prevoir une structure pour recup tout un environ, le modifier et le passer a process
 
 redef class Symbol
-       # Return environement valued for this symbol
-       meth environ: String
+       # Return environement value for this symbol
+       # If there is no such environement value, then return ""
+       fun environ: String
        do
                var res = to_s.to_cstring.get_environ
                # FIXME: There is no proper way to handle NULL C string yet. What a pitty.
                var nulstr = once ("".to_cstring.get_environ)
                if res != nulstr then
-                       "env {self}=".output
-                       res.output
                        return new String.from_cstring(res)
                else
                        return ""
@@ -33,6 +35,5 @@ redef class Symbol
 end
 
 redef class NativeString
-# Refinned to add environement bindings
-       private meth get_environ: NativeString is extern "string_NativeString_NativeString_get_environ_0"
+       private fun get_environ: NativeString is extern "string_NativeString_NativeString_get_environ_0"
 end