Fixes problem where `./program </dev/null` didn't show output.
#else
FROM Unix IMPORT read, write, open, ioctl;
#endif
- VAR fildes: INTEGER;
+ VAR fildes, fdout: INTEGER;
unreadch: CHAR;
unread: BOOLEAN;
tty: ARRAY[0..8] OF CHAR;
PROCEDURE Write(ch: CHAR);
BEGIN
- IF write(fildes, ADR(ch), 1) < 0 THEN
+ IF write(fdout, ADR(ch), 1) < 0 THEN
;
END;
END Write;
(* dtrg: changed so that instead of opening /dev/tty, fd 0 is always used. *)
tty := "stdio";
fildes := 0;
+ fdout := 1;
unread := FALSE;
END Terminal.