> A quick search reveals this:
>
> http://www.greenend.org.uk/rjk/tech/putenv.html
>
> According to this guy unsetenv() was added in Solaris 5.10, which is
> now ~10 years old. On Solaris you could modify *environment directly,
> but IIRC on OSF/1 that was explicitly forbidden.
Then I guess most portable *nix solution would be copying **environ contents
into some separate vim global and ignoring original global completely, using
execve() to run commands and new pointer for variable accesses from VimL.
To make changes to environment available in ruby* these changes should be
mirrored in **environ with appropriate functions as much as it is possible. It
seems that on some systems as an alternative (rather slow one though) to
forbidden direct **environ manipulations and unavailable unsetenv() clearenv()
with a following sequence of putenv() calls may be used.
Though before trying to code such workarounds it is better to check support
status. If ruby (and, possibly, mzscheme and lua: depends on which ones
actually respect **environ) is not supporting systems there is no need to
bother.
* Note: python and perl both create dictionary with environment variable at
startup and completely ignore environ global afterwards thus it does not matter
for them whether or not **environ is kept up-to-date. Tcl, mzscheme and lua
were not checked.
There are some questions about memory: do I read correctly that not to leak
memory you must keep track which environment variables you have set with
putenv() and run `vim_free(&(getenv("VAR")[-STRLEN("VAR")-1]));` just before
you are about to use putenv() or unsetenv() for such variables? It is also
interesting whether you need to free() variables which were already there.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.