'===========================================================================
' Subject: RETRIEVING ENVIRONMENT SETTINGS    Date: 06-16-96 (16:56)       
'  Author: Jason Laviska                      Code: QB, QBasic, PDS        
'  Origin: jason.laviska@outdoor.com        Packet: DOS.ABC
'===========================================================================
'Retriving data from the environment settings by Jason Laviska.
'LaserArts' Library Function E-02-A
'--- Public Domain --- Use at your own risk ---

'     A simple program used to check the environment settings and
'retrieve only the data found after the equal sign.  So if your
'environment settings included:

'  PROMPT=$P$G

'If you ran this Function by typing:

'  PRINT Environment$ ("PROMPT")

'You would get the following output:

'  $P$G

FUNCTION Environment$ (SearchFor$)

SearchFor$ = UCASE$(SearchFor$)
SearchSize% = LEN(SearchFor$)
Temp% = 1

DO WHILE ENVIRON$(Temp%) <> ""
  IF LEFT$(ENVIRON$(Temp%), SearchSize%) = SearchFor$ THEN
    Environment$ = RIGHT$(ENVIRON$(Temp%), LEN(ENVIRON$(Temp%)) - SearchSize% - 1)
    EXIT FUNCTION
  END IF
  Temp% = Temp% + 1
LOOP
Environment$ = ""

END FUNCTION
