🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #7557

Re: question on spawning DOS from C prog

#7557
From: Stan Brown
Date: Sat, 09 Jan 1993 14:47
44 lines
2178 bytes
In article <o0q1wB2w165w@cybrspc.uucp> roy%cybrspc@cs.umn.edu (Roy M. Silvernail) writes:
>siebeck@infoac.rmi.de (Wolfgang Siebeck) writes:
>
>> In your function declare something like:
>> 
>> 	static char prompt[]="PROMPT=<Type EXIT to return to program>$_$_$P";
>> 
>> and before the spawnl() do a
>> 
>> 	putenv(prompt);
>> 
>> to get exactly what you want.
>
>This will, of course, require that you have spare room in your
>environment block.  Applications are passed a _copy_ of the environment
>by command.com, which has all spare space trimmed off.  Thus, the
>putenv() call may very well fail.

Well, anything _may_ fail; but it's unlikely that the putenv call will.

I've long since lost track of which compiler we were talking about.  But
Microsoft C _putenv makes it quite clear that what is modified is the
run-time library's _copy_ of the environment. From the description of
wht happens, it appears that the _putenv( ) will succeed unless the heap
space is exhausted.

Both BC++ 2.0 and MSC++ 7.0 manuals specifically say that putenv/_putenv
can be used to add an environment variable; neither warns about running
out of space.  From this I conclude that BC++'s version works similarly
to MSC++'s on its copy of the environment that it received from DOS, not
on the (space-limited) environment that it received from DOS.

Department of amplification:

In an earlier follow-up I said that spawn would create a secondary
command shell.  This is true when what you spawn is COMMAND.COM; but
that was not what the original question was about.  My comment was
incorrect in that context.

-- 
Stan Brown, Oak Road Systems                      brown@Ncoast.ORG
Cleveland, Ohio, USA

"Life!  Don't talk to me about life!"
Technical Details
Message-ID: <C0LD2K.6Cr@NCoast.ORG>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!usenet.ins.cwru.edu!ncoast!brown
References: <1iedifINNmoi@infoac.rmi.de> <o0q1wB2w165w@cybrspc.uucp>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!usenet.ins.cwru.edu!ncoast!brown
From: brown@NCoast.ORG (Stan Brown)
Subject: Re: question on spawning DOS from C prog
Organization: Oak Road Systems, Cleveland Ohio USA
Date: Sat, 9 Jan 1993 14:47:07 GMT
Message-ID: <C0LD2K.6Cr@NCoast.ORG>
References: <1iedifINNmoi@infoac.rmi.de> <o0q1wB2w165w@cybrspc.uucp>
Lines: 44