void run_shell() { char shell_buffer[1000]; int shell_buffer_pos = 0; char c; initialize_commands(); clean_screen_segment(DEBUG); clean_screen_segment(SHELL); screen_division(); prompt(); while(true) { c = getChar(); switch(c) { case '\n': shell_run_command(shell_buffer, &shell_buffer_pos); prompt(); break; case '\b': if (shell_buffer_pos > 0) { shell_buffer_pos--; video_erase_write(SHELL); } break; default: shell_buffer[shell_buffer_pos++] = c; putchar(c); } } }
void ShellTask(void * arg) { (void) arg; for (;;) { char * line = read_line(&read_line_config, "> "); if (!line) continue; int ret = shell_run_command(line, &shell_config); if (ret) { printf("Command failed with code: %d\r\n", ret); } } }