DIRECTORY BasicTime, FTP, IO, Rope, UserCredentials; TestFTPUser: CEDAR PROGRAM IMPORTS FTP, IO, Rope, UserCredentials = BEGIN ROPE: TYPE = Rope.ROPE; ConnectAndGoAway: PROCEDURE [hostName: ROPE] = { ftpHandle: FTP.Handle; remoteHerald: ROPE; [h: ftpHandle, remoteHerald: remoteHerald] _ FTP.CreateFromName[hostName: hostName, localHerald: "Cedar FTP Calling"] ; FTP.Destroy[ftpHandle]; }; listObject: TYPE = RECORD [ directory: ROPE, name: ROPE, version: ROPE, create: BasicTime.GMT ]; ConnectListAndGoAway: PROCEDURE [hostName: ROPE, Directory: ROPE, Pattern: ROPE] = { ftpHandle: FTP.Handle; remoteHerald: ROPE; properties: FTP.PropertySet; name, password: Rope.ROPE; nameList: LIST OF REF listObject _ NIL; enumProc: PROCEDURE [h: FTP.Handle] = { create: BasicTime.GMT; directory: ROPE; name: ROPE; version: ROPE; item: REF listObject; create _ h.GetDateProperty[prop: createDate, list: remote]; directory _ h.GetTextProperty[prop: directory, list: remote]; name _ h.GetTextProperty[prop: nameBody, list: remote]; version _ h.GetTextProperty[prop: version, list: remote]; item _ NEW[listObject _ [directory, name, version, create]]; nameList _ CONS[item, nameList]; }; [name, password] _ UserCredentials.Get[]; [h: ftpHandle, remoteHerald: remoteHerald] _ FTP.CreateFromName[hostName: hostName, localHerald: "Cedar FTP Calling"] ; properties[createDate] _ TRUE; properties[directory] _ TRUE; properties[nameBody] _ TRUE; properties[version] _ TRUE; FTP.SetDesiredProperties[h: ftpHandle, props: properties, userDefinedProps: NIL]; FTP.SetTextProperty[ftpHandle, directory, Directory]; FTP.SetTextProperty[ftpHandle, nameBody, Pattern]; FTP.SetTextProperty[ftpHandle, userName, name]; FTP.SetTextProperty[ftpHandle, userPassword, password]; FTP.Enumerate[h: ftpHandle, noteFile: enumProc]; FTP.Destroy[ftpHandle]; }; ConnectRetrieveAndGoAway: PROCEDURE [hostName: ROPE, directory: ROPE, file: ROPE, version: ROPE] RETURNS [fileRope: ROPE] = { ftpHandle: FTP.Handle; remoteHerald: ROPE; properties: FTP.PropertySet; name, password: Rope.ROPE; nameList: LIST OF REF listObject _ NIL; confirmProc: FTP.ConfirmProc = { confirm _ TRUE; }; transferProc: FTP.TransferProc = { DO fileRope _ Rope.Concat[fileRope, stream.GetLineRope[ ! IO.EndOfStream => EXIT]]; ENDLOOP; }; completeProc: FTP.CompleteProc = { }; [name, password] _ UserCredentials.Get[]; [h: ftpHandle, remoteHerald: remoteHerald] _ FTP.CreateFromName[hostName: hostName, localHerald: "Cedar FTP Calling"] ; properties[createDate] _ TRUE; properties[directory] _ TRUE; properties[nameBody] _ TRUE; properties[version] _ TRUE; properties[size] _ TRUE; FTP.SetDesiredProperties[h: ftpHandle, props: properties, userDefinedProps: NIL]; FTP.SetTextProperty[ftpHandle, directory, directory]; FTP.SetTextProperty[ftpHandle, nameBody, file]; FTP.SetTextProperty[ftpHandle, userName, name]; FTP.SetTextProperty[ftpHandle, userPassword, password]; FTP.SetTextProperty[ftpHandle, version, version]; FTP.Retrieve[h: ftpHandle, confirm: confirmProc, transfer: transferProc, complete: completeProc]; FTP.Destroy[ftpHandle]; }; END. ΨTestFTPUser.mesa Last edited by: Bob Hagmann March 18, 1985 3:47:49 pm PST PROCEDURE [h: Handle] RETURNS [confirm: BOOLEAN]; PROCEDURE [h: Handle, stream: IO.STREAM]; PROCEDURE [h: Handle, ok: BOOLEAN]; Κ– "cedar" style˜Jšœ™™Icode™)—unitšΟk ˜ Kšœ ˜ Kšœ˜K˜Kšœ˜Kšœ˜K˜—defaultšœ œ˜Mšœ!˜)Mšœ˜M˜Mšœœœ˜—˜šΟnœ œ œ˜0Mšœ˜Mšœœ˜Mšœ-œG˜wMšœ˜Mšœ˜—M˜šœ˜Mšœ œ˜Mšœœ˜ Mšœ œ˜Mšœ˜M˜M˜—š žœ œ œ œ œ˜TMšœ œ˜Mšœœ˜Mšœ˜Mšœœ˜Mšœ'˜'šΟbœ œœ ˜'Mšœ˜Mšœ œ˜Mšœœ˜ Mšœ œ˜Mšœ˜Mšœ;˜;Mšœ=˜=Mšœ7˜7Mšœ9˜9Mšœ<˜