lib/standard: fix whitespaces before renaming
[nit.git] / lib / standard / environ.nit
index 2f6ae46..4774878 100644 (file)
@@ -5,7 +5,7 @@
 #
 # This file is free software, which comes along with NIT.  This software is
 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-# without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A 
+# without  even  the implied warranty of  MERCHANTABILITY or  FITNESS FOR A
 # PARTICULAR PURPOSE.  You can modify it is you want,  provided this header
 # is kept unaltered, and a notification of the changes is added.
 # You  are  allowed  to  redistribute it and sell it, alone or is a part of
@@ -14,7 +14,7 @@
 # Access to the environment variables of the process
 module environ
 
-import string
+import text
 import file
 
 # TODO prevoir une structure pour recup tout un environ, le modifier et le passer a process
@@ -57,6 +57,14 @@ redef class String
 end
 
 redef class NativeString
-       private fun get_environ: NativeString is extern "string_NativeString_NativeString_get_environ_0"
-       private fun setenv( v : NativeString ) is extern "string_NativeString_NativeString_setenv_1"
+       private fun get_environ: NativeString `{ return getenv(self); `}
+       private fun setenv(value: NativeString) `{ setenv(self, value, 1); `}
+end
+
+redef class Sys
+       redef init
+       do
+               var x = "NIT_SRAND".environ
+               if x != "" then srand_from(x.to_i)
+       end
 end