On 1/20/06, Sebastian Redl
Angus Leeming wrote:
Sebastian Redl wrote:
Another interesting addition would be replacing of referenced environment variables within the variable - does getenv() do that?
Sorry, I don't follow.
Angus
Especially in Windows, many environment variables contain a sequence %something%, which tells the shell to substitute this sequence with the environment variable something. An example is the PATH variable, which contains, I believe, %WINDIR% as an early entry. I wonder whether the Win32 implementation of getenv() does this, or if it should be done by an external function.
Sebastian Redl
Well, ExpandEnvironmentStrings (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/bas...) does what you want. A cursory look at the man pages on my iBook doesn't reveal anything obviously similar for OS X (and, I suspect, other Unix based operating systems). In addition, a Boost implementation would likely have to cater for the two flavours of embedded environment string, i.e. "%WINDIR%\some_file" as used in Windows and "$HOME/.bashrc" in Unix. And then, do you want to support the various expansion operations the two OSs give you. And what about other OSs like VMS... Anyway - there's a solution under Windows... Stuart Dootson