Runs the matching command in the current command_array. */
| 2616 | |
| 2617 | /* Runs the matching command in the current command_array. */ |
| 2618 | static int run_command( int argc, const char * * argv ) |
| 2619 | { |
| 2620 | struct command_elem * command; |
| 2621 | const char * command_name; |
| 2622 | if ( argc == 0 ) |
| 2623 | { |
| 2624 | return 1; |
| 2625 | } |
| 2626 | command_name = argv[ 0 ]; |
| 2627 | /* Skip the GDB/MI token when choosing the command to run. */ |
| 2628 | while( isdigit( *command_name ) ) ++command_name; |
| 2629 | current_token = atoi( argv[ 0 ] ); |
| 2630 | for( command = command_array; command->key; ++command ) |
| 2631 | { |
| 2632 | if ( strcmp( command->key, command_name ) == 0 ) |
| 2633 | { |
| 2634 | ( *command->command )( argc, argv ); |
| 2635 | return 1; |
| 2636 | } |
| 2637 | } |
| 2638 | debug_error( "Unknown command: %s", command_name ); |
| 2639 | return 0; |
| 2640 | } |
| 2641 | |
| 2642 | /* Parses a single command into whitespace separated tokens, and runs it. */ |
| 2643 | static int process_command( char * line ) |
no test coverage detected