fasdf gfaha / Terminal
Revision:
2:e47cc8c92b3f
Parent:
0:6b2bae4e0481
Child:
3:3c2cc2ea12a9
diff -r 1298bf291d8a -r e47cc8c92b3f Terminal.cpp
--- a/Terminal.cpp	Wed Aug 01 22:29:21 2012 +0000
+++ b/Terminal.cpp	Wed Aug 01 23:51:08 2012 +0000
@@ -54,7 +54,7 @@
             serial.putc(c);
         }
     }
-    else if (c == 127) // Backspace
+    else if (c == '\b' || c == 127) // Backspace
     {
         if (len > 0)
         {
@@ -66,16 +66,21 @@
     {
         serial.putc('\n');
         
+        // Try to match the input string to a command, and call the associated function if a match is found
         for (int i = 0; i < NUM_COMMANDS_MAX; i++)
         {
             if (cmdList[i].stringLength && !strncmp(inputBuffer, cmdList[i].cmdString, cmdList[i].stringLength))
             {
                 cmdList[i].fpointer(serial, inputBuffer);
-                break;
+                goto foundCommand;
             }
         }
         
-        serial.putc('\n');
+        // No match was found
+        serial.printf("unrecognized command");
+        
+        foundCommand:
+        serial.printf("\n> ");
         inputBuffer[0] = '\0'; // Clear the input buffer
     }
 }
\ No newline at end of file