Remove redundant sync that causes error on windows. Update console for Windows cr/lf.

This commit is contained in:
David Brown 2016-11-10 11:22:23 +00:00
parent c2e97de495
commit c93705920e
2 changed files with 11 additions and 3 deletions

View file

@ -46,7 +46,7 @@ MODULE Console; (* J. Templ, 29-June-96 *)
END Int;
PROCEDURE Ln*;
BEGIN Char(0AX); (* Unix end-of-line *)
BEGIN String(Platform.NL);
END Ln;
PROCEDURE Bool*(b: BOOLEAN);
@ -75,7 +75,12 @@ MODULE Console; (* J. Templ, 29-June-96 *)
VAR i: LONGINT; ch: CHAR;
BEGIN Flush();
i := 0; Read(ch);
WHILE (i < LEN(line) - 1) & (ch # 0AX) & (ch # 0X) DO line[i] := ch; INC(i); Read(ch) END ;
WHILE (i < LEN(line) - 1)
& (ch # 0AX)
& (ch # 0X) DO
line[i] := ch; INC(i); Read(ch)
END;
IF (i > 0) & (line[i-1] = 0DX) THEN DEC(i) END; (* Swallow CR before LF *)
line[i] := 0X
END ReadLine;

View file

@ -215,8 +215,11 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files
IF (f.state # create) OR (f.registerName # "") THEN
Create(f); i := 0;
WHILE (i < nofbufs) & (f.bufs[i] # NIL) DO Flush(f.bufs[i]); INC(i) END;
(* There's no reason to sync this file - we're about to close it. The OS
will sync if necessary. Further, sync will fail for a R/O file on Windows.
error := Platform.Sync(f.fd);
IF error # 0 THEN Err("error writing file", f, error) END;
IF error # 0 THEN Err("error syncing file", f, error) END;
*)
CloseOSFile(f);
END
END Close;