// FtpUserProt.bcpl - User FTP protocol routines // Copyright Xerox Corporation 1979, 1980, 1982 // Last modified May 13, 1982 1:09 PM by Boggs get "Pup.decl" get "FtpProt.decl" external [ // outgoing procedures UserOpen; UserClose UserFlushEOC; UserGetYesNo; UserProtocolError // incoming procedrues CloseBSPSocket; Wss; Free FTPM; GetCommand // incoming statics CtxRunning; defaultTimeout; sysZone ] //----------------------------------------------------------------------------------------- let UserOpen(Version) = valof //----------------------------------------------------------------------------------------- [ CtxRunning>>FtpCtx.serverFlag = false CtxRunning>>FtpCtx.newStore = true CtxRunning>>FtpCtx.newDirectory = true FTPM(markVersion, FTPVersion, "$P", true, Version) let ok = valof [ let mark = GetCommand() if mark<>FtpCtx.lst, "*NProtocol incompatible -- aborting") resultis false ] test ok ifso CtxRunning>>FtpCtx.connFlag = true ifnot UserClose(true) resultis ok ] //----------------------------------------------------------------------------------------- and UserClose(abortIt) be //----------------------------------------------------------------------------------------- [ if CtxRunning>>FtpCtx.getCmdString then [ Free(sysZone, CtxRunning>>FtpCtx.getCmdString) CtxRunning>>FtpCtx.getCmdString = 0 ] if CtxRunning>>FtpCtx.connFlag then [ CtxRunning>>FtpCtx.connFlag = false CloseBSPSocket(CtxRunning>>FtpCtx.bspSoc, (abortIt? 0, defaultTimeout)) ] ] //----------------------------------------------------------------------------------------- and UserFlushEOC() = valof //----------------------------------------------------------------------------------------- //suck up byte stream until next EOC, return false if error [ let mark = GetCommand() if mark<>FtpCtx.lst, "*NFTP protocol error -- aborting connection") UserClose(true) ]