[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] minios: fix console end of line: \n\r -> \r\n



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1255507127 -3600
# Node ID 71c859535c6bb7ba543ae3d483c830ca88cf4022
# Parent  b9af4d6d015cc930657f63371f01329df658c45e
minios: fix console end of line: \n\r -> \r\n

Change the end of line produced by minios' console from \n\r to \r\n.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 extras/mini-os/console/console.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff -r b9af4d6d015c -r 71c859535c6b extras/mini-os/console/console.c
--- a/extras/mini-os/console/console.c  Wed Oct 14 08:56:55 2009 +0100
+++ b/extras/mini-os/console/console.c  Wed Oct 14 08:58:47 2009 +0100
@@ -79,7 +79,7 @@ void console_print(struct consfront_dev 
 void console_print(struct consfront_dev *dev, char *data, int length)
 {
     char *curr_char, saved_char;
-    char copied_str[length];
+    char copied_str[length+1];
     char *copied_ptr;
     int part_len;
     int (*ring_send_fn)(struct consfront_dev *dev, const char *data, unsigned 
length);
@@ -95,8 +95,9 @@ void console_print(struct consfront_dev 
     {
         if(*curr_char == '\n')
         {
+            *curr_char = '\r';
             saved_char = *(curr_char+1);
-            *(curr_char+1) = '\r';
+            *(curr_char+1) = '\n';
             part_len = curr_char - copied_ptr + 2;
             ring_send_fn(dev, copied_ptr, part_len);
             *(curr_char+1) = saved_char;
@@ -104,11 +105,14 @@ void console_print(struct consfront_dev 
             length -= part_len - 1;
         }
     }
+
+    if (copied_ptr[length-1] == '\n') {
+        copied_ptr[length-1] = '\r';
+        copied_ptr[length] = '\n';
+        length++;
+    }
     
     ring_send_fn(dev, copied_ptr, length);
-    
-    if(copied_ptr[length-1] == '\n')
-        ring_send_fn(dev, "\r", 1);
 }
 
 void print(int direct, const char *fmt, va_list args)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.