# putch - write a character c to file fd. # NOTE AOS/RDOS DIFFERENCE BELOW !! include ratdef subroutine putch (c, fd) integer c, fd include channel if (0 <= fd & fd <= MAXCHNL & channel(fd) ^= ERR) { if (md(fd) ^= WRITE) { # fix up pointers if last operation not WRITE md(fd) = WRITE; ic(fd) = 1; nc(fd) = 0 } if (c == NEWLINE) { # change NEWLINE to CR and flush the buffer if RDOS # insert NEWLINE and flush buffer if AOS # byte(linebuf(1,fd),ic(fd)) = CR #RDOS byte(linebuf(1,fd),ic(fd)) = NEWLINE #AOS ic(fd) = ic(fd) + 1 call flush (fd) } else { byte(linebuf(1,fd),ic(fd)) = c ic(fd) = ic(fd) + 1 if (ic(fd) > MAXLINE | c == CR) { # this causes sequential write call wrseq (fd, linebuf(1,fd), ic(fd), ier) call chkio (fd, ier) ic(fd) = 1 } else if (c == FF | c == NULL) # these cause line write call flush (fd) } } return end