msp4th: proper cr/nl handling
authorDan White <dan@whiteaudio.com>
Tue, 14 May 2013 19:27:47 +0000 (14:27 -0500)
committerDan White <dan@whiteaudio.com>
Tue, 14 May 2013 19:27:47 +0000 (14:27 -0500)
msp4th/msp4th.c

index d81ce653553df9b7ec18a696f18d0480c01de15a..b7ebda72db7de20b7519ee5352368c055993da20 100644 (file)
@@ -499,6 +499,10 @@ void getLine(void)
         } else {
             if (echo) {
                 msp4th_putchar(c);
+
+                if (c == '\r') {
+                    msp4th_putchar('\n');
+                }
             }
 
             if ( (c == '\r') ||
@@ -506,8 +510,6 @@ void getLine(void)
                  (lineBufferIdx >= (lineBufferLength - 1))) { // prevent overflow of line buffer
 
                 waiting = 0;
-
-                if (echo) { msp4th_putchar('\n'); }
             }
 
             lineBuffer[lineBufferIdx++] = c;