help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] How to access environment variables ?


From: Mehul N. Sanghvi
Subject: Re: [Help-smalltalk] How to access environment variables ?
Date: Tue, 10 Feb 2009 10:06:44 -0500
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

Krishna said the following on 02/10/2009 09:50 AM:
On Tue, Feb 10, 2009 at 8:11 PM, Krishna <address@hidden> wrote:
On Tue, Feb 10, 2009 at 8:03 PM, Paolo Bonzini <address@hidden> wrote:
Krishna wrote:
On Tue, Feb 10, 2009 at 7:41 PM, Paolo Bonzini <address@hidden> wrote:
There are extra shell variables showing up like PATH, BASH, TERM, etc.
which do not show up in a CGI environment using any other language that
I've used to write a similar CGI program (Perl, PHP, Lisp, Scheme, C,
Tcl).  All of them print out the same variables as the output of the
Perl script.  What we seem to  be doing in Smalltalk is forking/execing
a shell and and then getting the environment variables so that we end up
with variables from a hybrid environment of CGI and shell.
why not call getenv(3) using the C interface?
He wants *all* the variables, not just one.

ha! ok. is it possible to build a custom gst with int main(int argc,
char** argv, char** envp) and slurp the environment from there?


unistd.h defines char** environ. exporting that to smalltalk should
solve the problem right?




That would work with GNU C library since it is defined as follows:

/* NULL-terminated array of "NAME=VALUE" environment variables.  */
extern char **__environ;
#ifdef __USE_GNU
extern char **environ;
#endif

I'm not sure how it is defined on other Unix systems. On Solaris 9 it doesn't exist in /usr/include/unistd.h:

Solaris-9% grep environ /usr/include/unistd.h
/* large file compilation environment setup */
/* In the LP64 compilation environment, the APIs are already large file */


So although I could probably make use of it, I'd break portability of GST along with what ever I am working on.

This is my quick and dirty assessment of it. I have not looked at GST code ever yet so far. This is based on just looking at the include files on Linux and Solaris 9. I could be interpreting things incorrectly.


cheers,

    mehul





reply via email to

[Prev in Thread] Current Thread [Next in Thread]