🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Setting Environment Variables (MS Quick C)

#4550
From: Arto V. Viitanen
Date: Wed, 06 Feb 1991 07:35
49 lines
2060 bytes
>>>>> On 5 Feb 91 23:05:10 GMT, Valenti@MSU (John Valenti) said:

John> I'm told that a program is given a copy of the environment variables, so any
John> changes/additions made are lost when the program ends. There must be some
John> way around this limitation?

John> Specifically, I want a batch file that runs a Quick C program, then calls another batch
John> file based on an environment variable:
John>        :top
John>         menu (quick c program)
John>         if %prgm%=exit goto done
John>         call %prgm%
John>         goto top
John>         :done
John> (The above batch file may not be syntactically correct, but you get the idea?)

There is (for some DOS versio) some undocumented interrupt, which does
exactly that. You should check it from a list of MSDOS interrupts (at
simtel20 and garbo.uwasa.fi, I think).

If number is enough for your menu system, why don't you use exit() plus
ERRORLEVEL ? For example, if your menu has seven different choises, your
program has

	choise = get_user_selection();
	exit(choise);

and your batchfile has

	:top
	menu
	IF ERRORLEVEL 7 goto seven
	IF ERRORLEVEL 6 goto six
	..
	IF ERRORLEVEL 0 goto zero
	:six
	program_six
	goto top

notice the order: from high to low !

Hope this helps 



--
Arto V. Viitanen				         email: av@kielo.uta.fi
University Of Tampere,				   	    av@ohdake.cs.uta.fi
Finland
Technical Details
Message-ID: <AV.91Feb6093511@kielo.uta.fi>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!news.funet.fi!uta!kielo!av
References: <1991Feb5.230510.4867@msuinfo.cl.msu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!news.funet.fi!uta!kielo!av
From: av@kielo.uta.fi (Arto V. Viitanen)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Setting Environment Variables (MS Quick C)
Message-ID: <AV.91Feb6093511@kielo.uta.fi>
Date: 6 Feb 91 07:35:11 GMT
References: <1991Feb5.230510.4867@msuinfo.cl.msu.edu>
Sender: news@uta.fi
Reply-To: av@uta.fi (Arto Viitanen)
Organization: University of Tampere, Finland
Lines: 49
Nntp-Posting-Host: uta.fi
In-reply-to: Valenti@MSU's message of 5 Feb 91 23:05:10 GMT