DIRECTORY BasicTime, Commander, FS, IO, Rope; SetDateLikeRemote: CEDAR PROGRAM IMPORTS Commander, FS, IO, Rope = BEGIN ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; SetDateLikeRemoteCommand: Commander.CommandProc = { cmdStream: STREAM = IO.RIS[cmd.commandLine]; remoteName,localName: ROPE _ NIL; remoteName _ IO.GetTokenRope[cmdStream, IO.IDProc ! IO.EndOfStream => GO TO badUsage].token; localName _ IO.GetTokenRope[cmdStream, IO.IDProc ! IO.EndOfStream => CONTINUE].token; IF Rope.Length[localName] = 0 THEN { bang: INT _ Rope.Length[remoteName]; pos: INT _ bang; WHILE pos > 0 DO pos _ pos - 1; SELECT Rope.Fetch[remoteName, pos] FROM '>, '], '/ => {pos _ pos + 1; EXIT}; '! => bang _ pos; ENDCASE; ENDLOOP; localName _ Rope.Flatten[remoteName, pos, bang - pos]; }; {ENABLE FS.Error => IF error.group # bug THEN {msg _ error.explanation; GO TO fail}; remote: FS.OpenFile _ FS.Open[remoteName]; local: FS.OpenFile _ FS.Open[localName, $write]; time: BasicTime.GMT _ FS.GetInfo[remote].created; FS.SetByteCountAndCreatedTime[local, -1, time]; FS.Close[local]; FS.Close[remote]; }; GO TO quit; EXITS badUsage => msg _ "Usage error: SetDateLikeRemote remote local\n"; quit => msg _ "\n"; fail => result _ $Failure; }; Commander.Register["SetDateLikeRemote", SetDateLikeRemoteCommand, "[SetDateLikeRemote remote local] sets the create date of the local file to be the same as the given remote file."]; END. °SetDateLikeRemote.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Russ Atkinson, March 12, 1985 3:19:51 pm PST Use the short version of the remote name Κ]˜codešœ™Kšœ Οmœ1™