Taco Hoekwater
Hi David,
b) don't bother about the leak and use setenv instead.
Option b) would be somewhat more portable, I believe.
Rationale: it is not more portable, because win32 doesn't have it (and Solaris is unknown).
Great. The posixified manual page for "setenv" says this on Ubuntu: RATIONALE Unanticipated results may occur if setenv() changes the external variable environ. In particular, if the optional envp argument to main() is present, it is not changed, and thus may point to an obsolete copy of the environment (as may any other copy of environ). However, other than the aforementioned restriction, the developers of IEEE Std 1003.1-2001 intended that the traditional method of walking through the environment by way of the environ pointer must be supported. It was decided that setenv() should be required by this revision because it addresses a piece of missing functionality, and does not impose a significant burden on the implementor. There was considerable debate as to whether the System V putenv() function or the BSD setenv() function should be required as a mandatory function. The setenv() function was chosen because it permitted the implementation of the unsetenv() function to delete environmental variables, without specifying an additional interface. The putenv() function is available as an XSI extension. So it would appear that Posix chose to standardize one interface, and win32 picked another (the term "standardize" does not apply here really). Anyway, option a) presumably also would require to place the table keeping score of environment variables into Lua context 0, in order to make sure that it remains available until LuaTeX exits. -- David Kastrup