@ECHO OFF
REM *****  Sample batch file for running the BBS on Instance 1:

REM ***** First, set the environment variable for the instance:
SET WWIV_INSTANCE=1


REM ***** Change drive and directory to the location of the BBS 
d:
cd \bbs

REM ***** Looping the BBS to include a reload of the fossil driver is 
REM ***** recommended after every user.

:LOOP

REM ***** Load the BBS  -o  = Exit after one user
REM *****               -n0 = Error level 0 on normal exit
REM *****               -a2 = Error level 2 on abnormal exit
REM *****                %x = Allows passing of other parameters on the 
REM *****                     commandline ( i.e.  WWIV -m )

wwiv50.exe -o -n%WWIV_INSTANCE% -q0 -a3 %1 %2 %3
REM ***** If the BBS exits abnormally goto the specified label. 
if errorlevel 3 goto ABNORMALEND  
REM ***** Errorlevel 2 is a normal quit or escape from the BBS  
if errorlevel 2 goto END  

REM ***** Otherwise, turn of and unload the fossil driver
XU PORT:1:OFF
X00.EXE
REM ***** And go back to the top of the loop to reload.
goto LOOP

REM ***** Actions to be performed if the BBS exits abnormally
:ABNORMALEND

REM ***** Nothing goes below this label
:END
