// FtpKbdInit.bcpl
// Copyright Xerox Corporation 1979, 1980, 1981, 1982
// Last modified May 7, 1982  3:30 PM by Boggs

get "FtpProt.decl"
get "FtpUser.decl"

external
[
// outgoing procedures
InitFtpKbd

// incoming procedures
CreateKeywordTable; LoadKT; TelnetQuit
KbdByte; KbdClose; KbdCompare; KbdConnect; KbdDelete; KbdDevice
KbdDirectory; KbdDump; KbdEol; KbdList; KbdLoad; KbdLogin
KbdMail; KbdOpen; KbdQuit; KbdRename; KbdRetrieve
KbdServer; KbdStore; KbdTelnet; KbdType; KbdUser; KbdVersion

// incoming statics
killServer; overwriteServer; protectedServer
telnetFlag; serverFlag; userFlag; serverCtx; userCtx

// outgoing statics
kbdKT; servKT; listKT; userKT; chatKT
]

static [ kbdKT; servKT; userKT; chatKT; listKT ]

//-----------------------------------------------------------------------------------------
let InitFtpKbd() be
//-----------------------------------------------------------------------------------------
[
kbdKT = CreateKeywordTable(22, 2)
LoadKT(kbdKT, "Byte-size", KbdByte, false)
LoadKT(kbdKT, "Close", KbdClose, true)
LoadKT(kbdKT, "Compare", KbdCompare, true)
LoadKT(kbdKT, "Connect", KbdConnect, false)
LoadKT(kbdKT, "Delete", KbdDelete, true)
LoadKT(kbdKT, "Device", KbdDevice, false)
LoadKT(kbdKT, "Directory", KbdDirectory, false)
LoadKT(kbdKT, "Dump", KbdDump, true)
LoadKT(kbdKT, "EOL", KbdEol, false)
LoadKT(kbdKT, "List", KbdList, true)
LoadKT(kbdKT, "Load", KbdLoad, true)
LoadKT(kbdKT, "Login", KbdLogin, false)
LoadKT(kbdKT, "Open", KbdOpen, false)
LoadKT(kbdKT, "Quit", KbdQuit, false)
LoadKT(kbdKT, "Rename", KbdRename, true)
LoadKT(kbdKT, "Retrieve", KbdRetrieve, true)
if serverFlag then LoadKT(kbdKT, "Server", KbdServer, false)
LoadKT(kbdKT, "Store", KbdStore, true)
if telnetFlag then LoadKT(kbdKT, "Telnet", KbdTelnet, false)
LoadKT(kbdKT, "Type", KbdType, false)
LoadKT(kbdKT, "User", KbdUser, false)
LoadKT(kbdKT, "Version", KbdVersion, false)

if serverFlag then
   [
   servKT = CreateKeywordTable(4, 1)
   LoadKT(servKT, "Debug", lv serverCtx>>FtpCtx.debugFlag)
   LoadKT(servKT, "Killable", lv killServer)
   LoadKT(servKT, "Overwrite", lv overwriteServer)
   LoadKT(servKT, "Protected", lv protectedServer)
   ]

if userFlag then
   [
   userKT = CreateKeywordTable(1, 1)
   LoadKT(userKT, "Debug", lv userCtx>>FtpCtx.debugFlag)
   ]

if telnetFlag then
   [
   chatKT = CreateKeywordTable(1, 1)
   LoadKT(chatKT, "Close", TelnetQuit)
   ]

listKT = CreateKeywordTable(8, 1)
LoadKT(listKT, "Author", lbAuthor)
LoadKT(listKT, "Create", lbCreate)
LoadKT(listKT, "Everything", lbEverything)
LoadKT(listKT, "Length", lbLength)
LoadKT(listKT, "Read", lbRead)
LoadKT(listKT, "Type", lbType)
LoadKT(listKT, "Verbose", lbVerbose)
LoadKT(listKT, "Write", lbWrite)
]