Move ao_match_word from ao_ignite.c to ao_cmd.c
[fw/altos] / src / ao_cmd.c
index 33619b245086b8f8ad8a6de1f4cada00d542b64d..81a527085faf5b099fa89f177d871b16a1c235ea 100644 (file)
@@ -171,38 +171,25 @@ ao_cmd_decimal(void)
                ao_cmd_status = r;
 }
 
-static void
-eol(void)
+uint8_t
+ao_match_word(__code char *word)
 {
-       while (ao_cmd_lex_c != '\n')
+       while (*word) {
+               if (ao_cmd_lex_c != *word) {
+                       ao_cmd_status = ao_cmd_syntax_error;
+                       return 0;
+               }
+               word++;
                ao_cmd_lex();
+       }
+       return 1;
 }
 
 static void
-dump(void)
+eol(void)
 {
-       __xdata uint16_t c;
-       __xdata uint8_t * __xdata start, * __xdata end;
-
-       ao_cmd_hex();
-       start = (uint8_t __xdata *) ao_cmd_lex_i;
-       ao_cmd_hex();
-       end = (uint8_t __xdata *) ao_cmd_lex_i;
-       if (ao_cmd_status != ao_cmd_success)
-               return;
-       c = 0;
-       while (start <= end) {
-               if ((c & 7) == 0) {
-                       if (c)
-                               putchar('\n');
-                       ao_cmd_put16((uint16_t) start);
-               }
-               putchar(' ');
-               ao_cmd_put8(*start);
-               ++c;
-               start++;
-       }
-       putchar('\n');
+       while (ao_cmd_lex_c != '\n')
+               ao_cmd_lex();
 }
 
 static void
@@ -305,7 +292,6 @@ __code struct ao_cmds       ao_base_cmds[] = {
        { '?', help,            "?                                  Print this message" },
        { 'T', ao_task_info,    "T                                  Show task states" },
        { 'E', echo,            "E <0 off, 1 on>                    Set command echo mode" },
-       { 'd', dump,            "d <start> <end>                    Dump memory" },
        { 'v', version,         "v                                  Show version" },
        { 0,    help,   NULL },
 };