// FtpBoot.bcpl - the main program, such as it is
// Copyright Xerox Corporation 1979, 1980
// Last modified December 25, 1980  8:20 PM by Boggs

get "AltoDefs.d"
get "BcplFiles.d"

external
[
// incoming procedures
InitFtpBoot; InitFtpTelnet; InitFtpServer; InitFtpUser
CallContextList; SetTimer; TimerHasExpired
AddToZone; StartIO; CloseDisk

// incoming statics
ctxQ; ftpDisk; sysZone; ramFlag
lvUserFinishProc
]

static savedUserFinishProc

//---------------------------------------------------------------------------
let FtpBoot(blv, nil) be
//---------------------------------------------------------------------------
[
savedUserFinishProc = @lvUserFinishProc
@lvUserFinishProc = FtpFinishProc
InitFtpBoot()
InitFtpUser()
AddToZone(sysZone, InitFtpBoot, sysZone-InitFtpBoot)
InitFtpServer()
InitFtpTelnet()
CallContextList(ctxQ!0) repeat  //forever
]

//---------------------------------------------------------------------------
and FtpFinishProc() be
//---------------------------------------------------------------------------
// This is the last user finish procedure.
[
@displayListHead = 0
let timer = 0; SetTimer(lv timer, 2)

CloseDisk(ftpDisk)

if ramFlag then
   [
   (table [ 61010b; 1401b ])(177776b, 22b)  //SetBLV(177776b)
   StartIO(100000b)  //silent boot
   ]

until TimerHasExpired(lv timer) loop
@lvUserFinishProc = savedUserFinishProc  //rumble rumble
]