<> <> DIRECTORY Commander, CommandTool, FS, IO, Rope; BootSmash: CEDAR PROGRAM IMPORTS Commander, CommandTool, FS, IO, Rope = {OPEN IO, ROPE; Smash: Commander.CommandProc = { names: LIST OF Rope.ROPE = CommandTool.ParseToList[cmd]; buffer: REF TEXT = NEW[TEXT[512]]; FOR each: LIST OF Rope.ROPE _ names, each.rest WHILE each # NIL DO inStream, outStream: IO.STREAM _ NIL; name: ROPE = each.first; bytes: NAT _ 0; timeBytes: PACKED ARRAY [0..3] OF CARDINAL = LOOPHOLE[BasicTime.ToPupTime[BasicTime.Now[]]]; IF Rope.Equal[name, "-n", FALSE] THEN {useNebula _ TRUE; LOOP}; IO.PutF[cmd.out, "Open %g", [rope[name]]]; inStream _ FS.StreamOpen[name ! FS.Error => {IO.PutF[cmd.out, "\n Error - %g\n", [rope[error.explanation]]]; LOOP}; ]; outStream _ FS.StreamOpen[ IF useNebula THEN Rope.Concat["/Nebula//", name] ELSE name, create ! FS.Error => {IO.PutF[cmd.out, "\n Error - %g\n", [rope[error.explanation]]]; LOOP}; ]; IO.PutRope[cmd.out, " ."]; bytes _ IO.GetBlock[inStream, buffer, 0, 512]; <> buffer[6+0] _ timeBytes[2]; buffer[6+1] _ timeBytes[3]; buffer[6+2] _ timeBytes[0]; buffer[6+3] _ timeBytes[1]; DO IO.PutRope[cmd.out, "."]; IO.PutBlock[outStream, buffer, 0, bytes]; bytes _ IO.GetBlock[inStream, buffer, 0, 512 ! IO.EndOfStream => EXIT]; ENDLOOP; IO.Close[outStream]; IO.Close[inStream]; IO.PutRope[cmd.out, "\n"]; ENDLOOP; }; Commander.Register[ "SmashBoot", Smash, "Smashes the date of a boot file so we can propagate changes."]; }.