lib: add missing documentation synopsis on some modules
[nit.git] / lib / standard / environ.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2006 Floréal Morandat <morandat@lirmm.fr>
4 # Copyright 2008 Jean Privat <jean@pryen.org>
5 #
6 # This file is free software, which comes along with NIT. This software is
7 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
10 # is kept unaltered, and a notification of the changes is added.
11 # You are allowed to redistribute it and sell it, alone or is a part of
12 # another product.
13
14 # Acces of the environement variables of the process
15 import symbol
16
17 # TODO prevoir une structure pour recup tout un environ, le modifier et le passer a process
18
19 redef class Symbol
20 # Return environement valued for this symbol
21 fun environ: String
22 do
23 var res = to_s.to_cstring.get_environ
24 # FIXME: There is no proper way to handle NULL C string yet. What a pitty.
25 var nulstr = once ("".to_cstring.get_environ)
26 if res != nulstr then
27 return new String.from_cstring(res)
28 else
29 return ""
30 end
31 end
32 end
33
34 redef class NativeString
35 # Refinned to add environement bindings
36 private fun get_environ: NativeString is extern "string_NativeString_NativeString_get_environ_0"
37 end