/* Read up to a new line like a tty */ /* Rewritten by RLKirby on March 24, 1983 */ int readnl(fd, buf, size) register char *buf; unsigned int size; { register unsigned int count = 0; register int ret; while (count < size) { ret = read(fd, buf, 1); if (ret < 0) return ret; if (ret == 0) break; count++; if(*buf++ == '\n') break; } return count; }