DIRECTORY BasicTime, FTP, IO, Rope, UserCredentials; TestFTPUser: CEDAR PROGRAM IMPORTS FTP, IO, Rope, UserCredentials = BEGIN ROPE: TYPE = Rope.ROPE; ConnectAndGoAway: PROC [hostName: ROPE] RETURNS [remoteHerald: ROPE] = { ftpHandle: FTP.Handle; [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: PROC [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: PROC [hostName: ROPE, directory: ROPE, file: ROPE, version: ROPE] RETURNS [fileRope: ROPE] = { ftpHandle: FTP.Handle; remoteHerald: ROPE; properties: FTP.PropertySet; name, password: Rope.ROPE; 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 Bob Hagmann March 18, 1985 3:47:49 pm PST Hal Murray, April 11, 1986 8:43:18 am PST PROCEDURE [h: Handle] RETURNS [confirm: BOOLEAN]; PROCEDURE [h: Handle, stream: IO.STREAM]; PROCEDURE [h: Handle, ok: BOOLEAN]; ΚN– "cedar" style˜šœ™Icode™)K™)—unitšΟk ˜ Kšœ ˜ Kšœ˜Kšœ˜Kšœ˜Kšœ˜K˜—defaultšœ œ˜Mšœœœ˜)Mšœ˜M˜Mšœœœ˜—˜š Οnœœ œœœ˜HMšœ œ˜šœ-œ˜@Mšœ7˜7—Mšœ˜Mšœ˜—M˜šœ œœ˜Mšœ œ˜Mšœœ˜ Mšœ œ˜Mšœ˜M˜M˜—š žœœ œ œ œ˜OMšœ œ˜Mšœœ˜Mšœ œ ˜Mšœœ˜Mš œ œœœœ˜'šΟbœ œœ ˜'Mšœœ˜Mšœ œ˜Mšœœ˜ Mšœ œ˜Mšœœ ˜Mšœ;˜;Mšœ=˜=Mšœ7˜7Mšœ9˜9Mšœœ2˜