lane@dalcs.UUCP (John Wright/Dr. Pat Lane) (12/13/88)
Hello. A few months back, I remember seeing some discussion on how a program could modify the environment of the program which executed it (or, were it is different, of the initial command processor). Now that the question has come up for me and I've tried it and seen it's not so simple...Now, I wish I'd read the discussion. Can someone tell what the upshot was or provide me with any articles they saved? I know that both the environment segment and the parent's PSP segment are stored in the PSP. Using this you could trace back to the parent program or all the way back to the first program loaded after booting (COMMAND.COM usually). Then, it's easy to find the environment of that program. The catch, as I see it, is that if the parent program is COMMAND.COM, the copy of the environment that it passes to its children is not its own environment but an allocated memory block after the program. If you want to set an environment variable in a program run from COMMAND.COM that will be seen by other programs run from the same shell or a sub-shell, then you would have to modify the allocated memory block, no? How can you tell in a consistant way if the parent program is COMMAND.COM or a program using a similar way of handling the environment. What about other command processors that might do something else in this regard? Thanks. -- John Wright ///////////////// Phone: 902-424-3805 or 902-424-6527 Post: c/o Dr Pat Lane, Biology Dept, Dalhousie U, Halifax N.S., CANADA B3H-4H8 Cdn/Bitnet: lane@cs.dal.cdn Arpa: lane%dalcs.uucp@uunet.uu.net Uucp: lane@dalcs.uucp or {uunet,watmath,utai}!dalcs!lane -- John Wright ///////////////// Phone: 902-424-3805 or 902-424-6527 Post: c/o Dr Pat Lane, Biology Dept, Dalhousie U, Halifax N.S., CANADA B3H-4H8 Cdn/Bitnet: lane@cs.dal.cdn Arpa: lane%dalcs.uucp@uunet.uu.net Uucp: lane@dalcs.uucp or {uunet,watmath,utai}!dalcs!lane
lane@dalcs.UUCP (John Wright/Dr. Pat Lane) (01/13/89)
Hello. A few months back, I remember seeing some discussion on how a program could modify the environment of the program which executed it (or, were it is different, of the initial command processor). Now that the question has come up for me and I've tried it and seen it's not so simple...Now, I wish I'd read the discussion. Can someone tell what the upshot was or provide me with any articles they saved? I know that both the environment segment and the parent's PSP segment are stored in the PSP. Using this you could trace back to the parent program or all the way back to the first program loaded after booting (COMMAND.COM usually). Then, it's easy to find the environment of that program. The catch, as I see it, is that if the parent program is COMMAND.COM, the copy of the environment that it passes to its children is not its own environment but an allocated memory block after the program. If you want to set an environment variable in a program run from COMMAND.COM that will be seen by other programs run from the same shell or a sub-shell, then you would have to modify the allocated memory block, no? How can you tell in a consistant way if the parent program is COMMAND.COM or a program using a similar way of handling the environment. What about other command processors that might do something else in this regard? Thanks. -- John Wright ///////////////// Phone: 902-424-3805 or 902-424-6527 Post: c/o Dr Pat Lane, Biology Dept, Dalhousie U, Halifax N.S., CANADA B3H-4H8 Cdn/Bitnet: lane@cs.dal.cdn Arpa: lane%dalcs.uucp@uunet.uu.net Uucp: lane@dalcs.uucp or {uunet,watmath,utai}!dalcs!lane