lkml.org 
[lkml]   [1999]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:1.953 / U:1.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site