Article View: comp.os.msdos.programmer
Article #1223Re: Environment variables when using system(...) command
From: H. D. Todd
Date: Wed, 02 Sep 1992 13:01
Date: Wed, 02 Sep 1992 13:01
36 lines
2400 bytes
2400 bytes
In article <1992Sep1.194508.10559@sactoh0.sac.ca.us> sap@sactoh0.sac.ca.us (Stephan A. Puga) writes:
>Subject: Environment variables when using system(...) command
>From: sap@sactoh0.sac.ca.us (Stephan A. Puga)
>Date: Tue, 1 Sep 92 19:45:08 GMT
>If an environment variable is set before a program is run and the
>program makes use of the system(...) command, how can I use the
>environment variable in the system command? I am writing a program
>to be used on a network and there is a variable "username" set
>before the program is run (this variable by the way is very
>important to how WordPerfect 5.1 runs on the network), my program
>invokes WP51 and tries to pass it the username variable, but it
>doesn't work! Is there no way I can get the new "local" command
>shell to use the same "old" command shell's variables?
>--
>#############################################################
># "Its been surreal!" # sap@sactoh0.SAC.CA.US #
># -- Gogo Dodo # UUCP=..ames!pacbell!sactoh0 #
>#############################################################
You need to set variables in the parent-process environment, but there
are no DOS int calls to let you do that. You can trace back through the
PSP's to find the parent-process environment block, though.
We had the same problem, motivated by WP 5.1 in exactly the same way.
I wrote a program called "envtrim" to trim environment variable names for
Netware use (specifically for WP). I have uploaded envtrim.zip to
wsmr-simtel20.army.mil (just yesterday, actually, so it may not be available
yet). The distribution package contains the Turbo C source and makefile,
the .exe file, and a user man page. I think it'll solve exactly the problem
you're trying to solve.
David Tod
Wesleyan University
Technical Details
Message-ID:
<hdtodd.5.715438861@wccnet.wcc.wesleyan.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!wupost!gumby!yale!news.wesleyan.edu!albatross.wcc.wesleyan.edu!hdtoddReferences:
<1992Sep1.194508.10559@sactoh0.sac.ca.us>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!gumby!yale!news.wesleyan.edu!albatross.wcc.wesleyan.edu!hdtodd Newsgroups: comp.os.msdos.programmer Subject: Re: Environment variables when using system(...) command Message-ID: <hdtodd.5.715438861@wccnet.wcc.wesleyan.edu> From: hdtodd@wccnet.wcc.wesleyan.edu (H. D. Todd) Date: Wed, 2 Sep 1992 13:01:01 GMT References: <1992Sep1.194508.10559@sactoh0.sac.ca.us> Organization: Wesleyan University, Middletown, CT USA Nntp-Posting-Host: albatross.wcc.wesleyan.edu Lines: 37