David Ashley wrote:
The problem here is that on *nix environment the base environment is
*owned* byt the parent spawning process. On Windows you get a copy of
the environment when the process starts. On *nix the environment is
inherited form the spawning process and since you do not own the
spawning process' memory you can not free it.
David is right. There are libc functions like setenv() getenv() to do
what the author of those lines
was doing by hand. Here is Solaris:
Standard C Library Functions setenv(3C)
NAME
setenv - add or change environment variable
SYNOPSIS
#include <stdlib.h>
int setenv(const char *envname, const char *envval, int
overwrite);
DESCRIPTION
The setenv() function updates or adds a variable in the
environment of the calling process.
But it's /not portable/ to use setenv() in an arbitrary fashion. While a
generalized barrage of getenv() setenv()
would probably work on OpenBSD, it might not be satisfactory on FreeBSD.
Here from the Darwin docs from Apple
(
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/setenv.3.html):
*
BUGS*
Successive calls to *setenv*() or *putenv*() assigning a differently sized
_value_ to the same _name_ will
result in a memory leak. The FreeBSD semantics for these functions
(namely, that the contents of _value_
are copied and that old values remain accessible indefinitely) make this
bug unavoidable. Future ver-sions versions
sions may eliminate one or both of these semantic guarantees in order to
fix the bug.
*
*
--
Jack J. Woehr # "Self-delusion is
http://www.well.com/~jax # half the battle!"
http://www.softwoehr.com # - Zippy the Pinhead
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel