Added index and favicon.
[nit.git] / lib / standard / environ.nit
index 939c9a8..93f5b25 100644 (file)
@@ -19,20 +19,28 @@ import string
 # TODO prevoir une structure pour recup tout un environ, le modifier et le passer a process
 
 redef class String
-       # Return environment value for this symbol
-       # If there is no such environment value, then return ""
+       # Return environment value for the symbol.
+       # If there is no such environment variable, then return ""
+       #
+       #     assert "PATH".environ     != ""
+       #     assert "NIT %\n".environ  == ""
        fun environ: String
        do
                var res = self.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
-                       return new String.from_cstring(res)
+                       return res.to_s
                else
                        return ""
                end
        end
-       fun setenv( v : String ) do to_cstring.setenv( v.to_cstring )
+
+       # Set the enviroment value of a variable.
+       #
+       #     "NITis".setenv("fun")
+       #     assert "NITis".environ  == "fun"
+       fun setenv(v: String) do to_cstring.setenv( v.to_cstring )
 end
 
 redef class NativeString