Messages in this thread Patch in this message | | | Date | Wed, 22 Dec 1999 18:10:23 +0000 (GMT) | From | Tim Waugh <> | Subject | [patch] 2.3.35pre1: printer console LF->CRLF translation |
| |
Just spotted this. I made the fix ages ago but forgot to merge it.
Without this, you get stair-stepping text. :-(
Tim. */
Index: linux/drivers/char/lp.c diff -u linux/drivers/char/lp.c:1.1.1.3 linux/drivers/char/lp.c:1.4 --- linux/drivers/char/lp.c:1.1.1.3 Tue Dec 21 09:34:54 1999 +++ linux/drivers/char/lp.c Wed Dec 22 18:05:17 1999 @@ -662,11 +662,30 @@ parport_negotiate (port, IEEE1284_MODE_COMPAT); do { - /* Write the data. */ - written = parport_write (port, s, count); - if (written > 0) { - s += written; - count -= written; + /* Write the data, converting LF->CRLF as we go. */ + ssize_t canwrite = count; + char *line = strchr (s, '\n'); + if (line) + canwrite = line - s; + + written = parport_write (port, s, canwrite); + if (written <= 0) + continue; + + s += written; + count -= written; + if (line) { + const char *crlf = "\r\n"; + int i = 2; + + /* Dodge the original '\n', and put '\r\n' instead. */ + s++; + count--; + while (i) { + written = parport_write (port, crlf, i); + if (written > 0) + i -= written, crlf += written; + } } } while (count > 0 && (CONSOLE_LP_STRICT || written > 0));
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |