@echo off
if not exist CNFTEMP.EXE goto skpren
ren CNF.EXE BBSMTREE.EXE
ren CNFTEMP.EXE CNF.EXE
:skpren
bbsrmb
btrieve /p:2048 /e >nul
if not exist BBSISUP.FLG goto skipfix
echo The server shut down abnormally... >BBSABSD.FLG
del BBSISUP.FLG
:skipfix
if "%1" == "GO" goto op50
if "%1" == "go" goto op50
if "%1" == "Go" goto op50
if "%1" == "gO" goto op50
BBSINTRO %1
goto mintret
:mintrcv
if not exist BBSISUP.FLG goto mint0
echo The server shut down abnormally... >BBSABSD.FLG
del BBSISUP.FLG
:mint0
BBSINTRO 0
goto mintret
:mint5
BBSINTRO 5
goto mintret
:mint7
BBSINTRO 7
goto mintret
:mint9
BBSINTRO 9
:mintret
if errorlevel 200 goto gotodos
if errorlevel 90 goto op90
if errorlevel 70 goto op70
if errorlevel 60 goto op60
if errorlevel 50 goto op50
if errorlevel 40 goto op40
if errorlevel 30 goto op30
if errorlevel 20 goto op20
if errorlevel 10 goto op10
:gotodos
echo 
echo Type "WG"(Enter) to return to Worldgroup...
goto fin
:op10
bbsrmb
echo 
if not exist cnfup.bat goto nocnfup1
call cnfup.bat 1
:nocnfup1
cnf -L1
if errorlevel 1 goto waitmi
wgsmsx
if not exist cnfdn.bat goto nocnfdn1
call cnfdn.bat 1
:nocnfdn1
:cnfret
btrieve /p:2048 /e >nul
goto mint5
:op20
echo 
call bbsmtree.bat
if errorlevel 1 goto waitmi
goto mint5
:op30
bbsrmb
echo 
if not exist cnfup.bat goto nocnfup3
call cnfup.bat 3
:nocnfup3
cnf -L3
if errorlevel 1 goto waitmi
wgsmsx
if not exist cnfdn.bat goto nocnfdn3
call cnfdn.bat 3
:nocnfdn3
goto cnfret
:op40
bbsrmb
echo 
if not exist cnfup.bat goto nocnfup4
call cnfup.bat 4
:nocnfup4
cnf -L4
if errorlevel 1 goto waitmi
wgsmsx
if not exist cnfdn.bat goto nocnfdn4
call cnfdn.bat 4
:nocnfdn4
goto cnfret
:op50
if not exist BBSCATA.FLG goto op50int
wgsridx catastro
if errorlevel 11 goto dfwait
if not errorlevel 10 goto skpgk2
copy galfilk.vir galfilk.dat >nul
galfilkw
:skpgk2
del BBSCATA.FLG
:op50int
bbsint
bbsrmb
call bbsbtr
wgsmsx
echo The server is up... >BBSISUP.FLG
echo WGSRIDX may be required (for CATASTRO fixup)... >BBSCATA.FLG
echo 
if not exist bbsup.bat goto nobbsup
call bbsup.bat
if errorlevel 251 goto nobbsup
if errorlevel 250 goto delflag
:nobbsup
majorbbs
if errorlevel 80 goto finbbs
if errorlevel 50 goto dfwbbs
if errorlevel 49 goto delflag
if errorlevel 14 goto msh4
if errorlevel 13 goto msh3
if errorlevel 12 goto msh2
if errorlevel 11 goto msh1
if errorlevel 1 goto delflag
if exist BBSABSD.FLG del BBSABSD.FLG
if not exist bbsdn.bat goto nobbsdn0
call bbsdn.bat
:nobbsdn0
bbsfndo Cleanup
if not exist BBSCLEAN.BAT goto nocbat
call BBSCLEAN.BAT
:nocbat
goto op50int
:delflag
if not exist bbsdn.bat goto nobbsdn1
call bbsdn.bat
:nobbsdn1
del BBSISUP.FLG
del BBSCATA.FLG
goto mint0
:msh1
if not exist bbsdn.bat goto nobbsdn2
call bbsdn.bat
:nobbsdn2
bbsfndo Event-1
if not exist BBSEVT1.BAT goto noe1bat
call BBSEVT1.BAT
:noe1bat
goto op50int
:msh2
if not exist bbsdn.bat goto nobbsdn3
call bbsdn.bat
:nobbsdn3
bbsfndo Event-2
if not exist BBSEVT2.BAT goto noe2bat
call BBSEVT2.BAT
:noe2bat
goto op50int
:msh3
if not exist bbsdn.bat goto nobbsdn4
call bbsdn.bat
:nobbsdn4
bbsfndo Event-3
if not exist BBSEVT3.BAT goto noe3bat
call BBSEVT3.BAT
:noe3bat
goto op50int
:msh4
if not exist bbsdn.bat goto nobbsdn5
call bbsdn.bat
:nobbsdn5
bbsfndo Event-4
if not exist BBSEVT4.BAT goto noe4bat
call BBSEVT4.BAT
:noe4bat
goto op50int
:op60
bbsrmb
echo 
if not exist cnfup.bat goto nocnfup6
call cnfup.bat 6
:nocnfup6
cnf -L6
if errorlevel 1 goto waitmi
wgsmsx
if not exist cnfdn.bat goto nocnfdn6
call cnfdn.bat 6
:nocnfdn6
goto cnfret
:op70
if errorlevel 84 goto op84
if errorlevel 83 goto op83
if errorlevel 82 goto op82
if errorlevel 81 goto op81
if errorlevel 80 goto op80
if errorlevel 79 goto op79
if errorlevel 78 goto op78
if errorlevel 77 goto op77
if errorlevel 76 goto op76
if errorlevel 75 goto op75
if errorlevel 74 goto op74
if errorlevel 73 goto op73
if errorlevel 72 goto op72
if errorlevel 71 goto op71
if not exist bbsaudit.old goto op70ren
del bbsaudit.old
:op70ren
rename bbsaudit.dat bbsaudit.old
copy bbsaudit.vir bbsaudit.dat >nul
goto mint7
:op71
wgscolor
if errorlevel 1 goto waitmi
goto mint7
:op72
wgsdmod
if errorlevel 1 goto waitmi
bbsint
goto mint7
:op73
wgslang
if errorlevel 1 goto waitmi
bbsint
wgsmsx
goto mint7
:op74
wgsmref
if errorlevel 1 goto waitmi
goto mint7
:op75
wgsridx *
if not exist GALFILK.DAT goto skpgkw
copy galfilk.vir galfilk.dat >nul
galfilkw
:skpgkw
copy bbsmajor.mcv junk.jnk >nul
del *.mcv
rename junk.jnk bbsmajor.mcv
wgsmsx bbsmajor
wgsmsx
del bbsint.ref
del mdf.ref
bbsrbt
copy bbsxrf.vir bbsxrf.dat >nul
bbsrbx
bbsrbk
goto mint7
:op76
wgssetcl
if errorlevel 1 goto waitmi
wgsmsx
goto mint7
:op77
wgsswtcl
if errorlevel 1 goto waitmi
goto mint7
:op78
wgszstat
if errorlevel 1 goto waitmi
goto mint7
:op79
galfilin
if errorlevel 1 goto waitmi
goto mint7
:op80
galfilkw
if errorlevel 1 goto waitmi
goto mint7
:op81
bbsrmb
call bbsbtr
echo.
galfoman
if errorlevel 1 goto waitmi
bbsrmb
btrieve /p:2048 /e > nul
bbsint
goto mint7
:op82
bbsrmb
galmkwgm
if errorlevel 1 goto waitmi
btrieve /p:2048 /e > nul
goto mint7
:op83
galp&qr
if errorlevel 1 goto waitmi
bbsint
goto mint7
:op84
galrfc
if errorlevel 1 goto waitmi
goto mint7
:op90
bbsrmb
call bbsbtr
echo.
bbsrpt
if errorlevel 1 goto waitmi
bbsrmb
btrieve /p:2048 /e > nul
goto mint9
:dfwbbs
if not exist bbsdn.bat goto nobbsdn6
call bbsdn.bat
:nobbsdn6
:dfwait
del BBSISUP.FLG
:waitmi
bbsrmb
echo 
echo Write down the error message in the box, then press Ctrl-C to stop, or
pause
btrieve /p:2048 /e >nul
goto mintrcv
:finbbs
if not exist bbsdn.bat goto nobbsdn7
call bbsdn.bat
:nobbsdn7
:fin
bbsrmb
