#
# 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
# 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
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