🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: question on spawning DOS from C prog

#7499
From: JOHN M. TROIANO
Date: Thu, 07 Jan 1993 14:05
69 lines
2313 bytes
In article <tim.36.726368023@tim.src.utah.edu>, tim@tim.src.utah.edu (Tim Ma) wr
ites:
>>Subject: Re: question on spawning DOS from C prog
>>Date: 6 Jan 93 10:50:55 GMT
>>jmt7@ns1.cc.lehigh.edu (JOHN M. TROIANO) writes:
>>
>>>For example, after spawning DOS the user would
>>>see:
>>>            <Type EXIT to return to program>      <--this would appear
>>>                                                     each time <RET> hit
>>>            C:\
>>>    Is there, perhaps, a parameter to COMMAND.COM to do this?
>
>Reply was:
>------------------------------------------------------------------------
>>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.
>>
>>Greetings,
>>Wolfgang
>>--
>>siebeck@infoac.rmi.de (Wolfgang Siebeck)
>
>Is this possible?  It was my understanding that 'spawn' called a new command
>shell so any changes in the environment would not be carried over.
>
>I've always used 'spawnl' with the 'e' suffix to set or pass on environment
>variables.
>
>Curiously,
>
>Tim Ma
>Associate Programmer
>University of Utah
>Email:  tim@src.cppa.utah.edu
>

Hi, I am the original poster of this problem: this is especially to
Tim and Wolfgang. I tried the code below (which is I think what both
of you guys are suggesting) but it does'nt work (the new prompt
string is ignored). Any ideas?     - John.

#include <stdio.h>
#include <process.h>
#include <dos.h>
#include <stdlib.h>

int main( int argc, char *argv[], char **envp )
{

printf( "\ninside main, spawning DOS\n" );
sleep( 2 );

putenv( "prompt=$_type EXIT to return to program $_$_$p$g" );

spawnlpe( P_WAIT, "command.com", NULL, envp );

printf( "\nback from spawn!\n" );

sleep( 2 );

}
Technical Details
Message-ID: <1993Jan7.140524.15787@ns1.cc.lehigh.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!gatech!darwin.sura.net!jvnc.net!netnews.upenn.edu!netnews.cc.lehigh.edu!ns1.cc.lehigh.edu!jmt7

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!gatech!darwin.sura.net!jvnc.net!netnews.upenn.edu!netnews.cc.lehigh.edu!ns1.cc.lehigh.edu!jmt7
From: jmt7@ns1.cc.lehigh.edu (JOHN M. TROIANO)
Newsgroups: comp.os.msdos.programmer
Subject: Re: question on spawning DOS from C prog
Message-ID: <1993Jan7.140524.15787@ns1.cc.lehigh.edu>
Date: 7 Jan 93 14:05:24 GMT
Organization: Lehigh University
Lines: 69