예제 #1
0
파일: shell.c 프로젝트: kevinjhanna/kernel
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);
    }
  }
}
예제 #2
0
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);
    }
  }
}