Andrew Nguyen : winedbg: Convert the CRLF newline to LF newline when reading interactive input.

Alexandre Julliard julliard at winehq.org
Wed May 18 11:15:35 CDT 2011


Module: wine
Branch: master
Commit: 9981938486ad131cc0badaca75bd25f45a7ed7bd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9981938486ad131cc0badaca75bd25f45a7ed7bd

Author: Andrew Nguyen <anguyen at codeweavers.com>
Date:   Wed May 18 07:09:11 2011 -0500

winedbg: Convert the CRLF newline to LF newline when reading interactive input.

---

 programs/winedbg/debug.l |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/programs/winedbg/debug.l b/programs/winedbg/debug.l
index 41db76c..dfb75b4 100644
--- a/programs/winedbg/debug.l
+++ b/programs/winedbg/debug.l
@@ -78,10 +78,19 @@ static int read_input(const char* pfx, char* buf, int size)
         lexeme_flush();
         len = input_fetch_entire_line(pfx, &tmp);
         if (len < 0) return 0;  /* eof */
+
+        /* remove carriage return in newline */
+        if (len >= 2 && tmp[len - 2] == '\r')
+        {
+            tmp[len - 2] = '\n';
+            tmp[len - 1] = '\0';
+            len--;
+        }
+
         /* FIXME: should have a pair of buffers, and switch between the two, instead of
          * reallocating a new one for each line
          */
-        if (last_line && (len == 0 || (len == 1 && tmp[0] == '\n') || (len == 2 && tmp[0] == '\r' && tmp[1] == '\n')))
+        if (last_line && (len == 0 || (len == 1 && tmp[0] == '\n')))
         {
             HeapFree(GetProcessHeap(), 0, tmp);
         }




More information about the wine-cvs mailing list