View previous topic :: View next topic |
Author |
Message |
the_darkside_986
Joined: 04 Apr 2008 Posts: 10
|
Posted: Thu Apr 10, 2008 3:48 pm Post subject: os.getEnv functionality |
|
|
This function does not appear to work properly unless I'm doing something wrong.
I tried doing writefln(os.getEnv("myvar")); which should print the value of the shell variable myvar, but I get null instead. I tried exporting the variable before calling the script, and it still returns null. I tried showing variables in the D programming language by itself (via tango.sys.Environment.get()) and that seems to work as long as I export it first.
I'm using the release of MiniD that is installable via dsss, btw.
It's nothing serious as I can easily write my own native method and bind it to MiniD, but the reason I point it out is because I figured out how to use MiniD as a CGI scripting language on my personal webserver But I won't get too far unless I can figure out how to access shell variables.
I hope someday I can make an apache module that can load and execute .md files in a manner similar to php files. But first I have to figure out how to load the D runtime from a C++ program (which always fails when the C++ program is linked to any extra non-standard library ) |
|
Back to top |
|
|
the_darkside_986
Joined: 04 Apr 2008 Posts: 10
|
Posted: Thu Apr 10, 2008 6:00 pm Post subject: |
|
|
Sorry I was mistaken. The problem lies in tango.sys.Environment.
I made my own os.getEnv via tango.stdc.stdlib:getenv. It actually worked. So the problem is with tango not MiniD. |
|
Back to top |
|
|
vektorboson
Joined: 14 Sep 2006 Posts: 44
|
Posted: Thu Apr 10, 2008 6:30 pm Post subject: |
|
|
Yes; it's an error in Tango's Linux implementation. On Windows a '\0' is appended to the string, on Linux the pointer is passed as is to the getenv-function.
EDIT:
I've submitted a ticket |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Sat Apr 12, 2008 6:07 pm Post subject: |
|
|
Woo, got out of that one. |
|
Back to top |
|
|
|