spence@ICO.UUCP (05/12/85)
/* Written 11:35 am May 8, 1985 by libes@nbs-amrf in ICO:net.unix-wizar */ /* ---------- "Re: Setting environment variables wi" ---------- */ Since no one has posted a better reply than "no, you can't" let me point out something. I think what was wanted was a way to change environment variables in the environment of the current process (and hence child processes). The reason I think this, is because I have to do the same thing (see last paragraph). Obviously there is no way to change them in the parent process. I don't know the "right" way, but one way is to copy the environ array pointers into a new array and make your change. The reason you have to use a new array is in case the change you are making adds a variable to the environment. If you are only resetting a variable, you just reassign that one pointer to the variable value. The reason this is kludgey, of course, is that the space from the original environ becomes unusable garbage. That is, I haven't the faintest idea how to return it (i.e. free) to useful life. I actually wrote a routine to do just this, so I know it works. The problem was on our Suns, I wanted to be able to create "tools" in different fonts. The only way you can do this is by setting the environment variable DEFAULT_FONT. Obviously, if you are controlling the desktop with a C program (the window manager), then, you need to set environment variables. I'd be interested if someone could tell me the "right" way to do this. I'd also like to know why fonts are selected via an environment variable on the Sun. Don Libes {seismo,umcp-cs}!nbs-amrf!libes /* End of text from ICO:net.unix-wizar */