Lines Matching refs:p_shell

179 static struct shell *p_shell = &hv_shell;  variable
249 for (i = 0U; i < p_shell->cmd_count; i++) { in shell_find_cmd()
250 p_cmd = &p_shell->cmds[i]; in shell_find_cmd()
305 if (p_shell->cursor_offset < p_shell->input_line_len) { in handle_delete_key()
307 uint32_t delta = p_shell->input_line_len - p_shell->cursor_offset - 1; in handle_delete_key()
313 shell_puts(p_shell->buffered_line[p_shell->input_line_active] + p_shell->cursor_offset + 1); in handle_delete_key()
318 memcpy_erms(p_shell->buffered_line[p_shell->input_line_active] + p_shell->cursor_offset, in handle_delete_key()
319 p_shell->buffered_line[p_shell->input_line_active] + p_shell->cursor_offset + 1, delta); in handle_delete_key()
322 p_shell->buffered_line[p_shell->input_line_active][p_shell->input_line_len - 1] = 0; in handle_delete_key()
325 p_shell->input_line_len--; in handle_delete_key()
331 int32_t to_select, current_select = p_shell->to_select_index; in handle_updown_key()
336 to_select = p_shell->to_select_index - 1; in handle_updown_key()
341 if (p_shell->buffered_line[to_select][0] != '\0') { in handle_updown_key()
347 if (p_shell->to_select_index != p_shell->input_line_active) { in handle_updown_key()
348 current_select = (p_shell->to_select_index + 1) % MAX_BUFFERED_CMDS; in handle_updown_key()
353 if (current_select != p_shell->input_line_active) { in handle_updown_key()
354 p_shell->to_select_index = current_select; in handle_updown_key()
357 …if (strcmp(p_shell->buffered_line[current_select], p_shell->buffered_line[p_shell->input_line_acti… in handle_updown_key()
359 if (p_shell->cursor_offset < p_shell->input_line_len) { in handle_updown_key()
360 shell_puts(p_shell->buffered_line[p_shell->input_line_active] + p_shell->cursor_offset); in handle_updown_key()
363 clear_input_line(p_shell->input_line_len); in handle_updown_key()
364 shell_puts(p_shell->buffered_line[current_select]); in handle_updown_key()
366 size_t len = strnlen_s(p_shell->buffered_line[current_select], SHELL_CMD_MAX_LEN); in handle_updown_key()
368 memcpy_s(p_shell->buffered_line[p_shell->input_line_active], SHELL_CMD_MAX_LEN, in handle_updown_key()
369 p_shell->buffered_line[current_select], len + 1); in handle_updown_key()
370 p_shell->input_line_len = len; in handle_updown_key()
371 p_shell->cursor_offset = len; in handle_updown_key()
396 if (p_shell->cursor_offset < p_shell->input_line_len) { in shell_handle_special_char()
397 shell_puts(p_shell->buffered_line[p_shell->input_line_active] + p_shell->cursor_offset); in shell_handle_special_char()
398 p_shell->cursor_offset++; in shell_handle_special_char()
399 set_cursor_pos(p_shell->input_line_len - p_shell->cursor_offset); in shell_handle_special_char()
403 if (p_shell->cursor_offset > 0) { in shell_handle_special_char()
404 p_shell->cursor_offset--; in shell_handle_special_char()
409 if (p_shell->cursor_offset < p_shell->input_line_len) { in shell_handle_special_char()
410 shell_puts(p_shell->buffered_line[p_shell->input_line_active] + p_shell->cursor_offset); in shell_handle_special_char()
411 p_shell->cursor_offset = p_shell->input_line_len; in shell_handle_special_char()
415 if (p_shell->cursor_offset > 0) { in shell_handle_special_char()
416 set_cursor_pos(p_shell->cursor_offset); in shell_handle_special_char()
417 p_shell->cursor_offset = 0; in shell_handle_special_char()
439 if (p_shell->cursor_offset > 0U) { in handle_backspace_key()
445 if (p_shell->cursor_offset < p_shell->input_line_len) { in handle_backspace_key()
446 uint32_t delta = p_shell->input_line_len - p_shell->cursor_offset; in handle_backspace_key()
449 shell_puts(p_shell->buffered_line[p_shell->input_line_active] + p_shell->cursor_offset); in handle_backspace_key()
453 memcpy_erms(p_shell->buffered_line[p_shell->input_line_active] + p_shell->cursor_offset - 1, in handle_backspace_key()
454 p_shell->buffered_line[p_shell->input_line_active] + p_shell->cursor_offset, delta); in handle_backspace_key()
458 p_shell->buffered_line[p_shell->input_line_active][p_shell->input_line_len - 1] = 0; in handle_backspace_key()
461 p_shell->input_line_len--; in handle_backspace_key()
462 p_shell->cursor_offset--; in handle_backspace_key()
468 uint32_t delta = p_shell->input_line_len - p_shell->cursor_offset; in handle_input_char()
472 …memcpy_erms_backwards(p_shell->buffered_line[p_shell->input_line_active] + p_shell->input_line_len, in handle_input_char()
473 p_shell->buffered_line[p_shell->input_line_active] + p_shell->input_line_len - 1, delta); in handle_input_char()
476 p_shell->buffered_line[p_shell->input_line_active][p_shell->cursor_offset] = ch; in handle_input_char()
479 shell_puts(p_shell->buffered_line[p_shell->input_line_active] + p_shell->cursor_offset); in handle_input_char()
483 p_shell->input_line_len++; in handle_input_char()
484 p_shell->cursor_offset++; in handle_input_char()
510 p_shell->input_line_len = 0U; in shell_input_line()
511 p_shell->cursor_offset = 0U; in shell_input_line()
522 if (p_shell->input_line_len < SHELL_CMD_MAX_LEN) { in shell_input_line()
538 p_shell->input_line_len = 0U; in shell_input_line()
539 p_shell->cursor_offset = 0U; in shell_input_line()
601 p_input_line = p_shell->buffered_line[p_shell->input_line_active]; in shell_process()
603 former_index = (p_shell->input_line_active + MAX_BUFFERED_CMDS - 1) % MAX_BUFFERED_CMDS; in shell_process()
607 (strcmp(p_input_line, p_shell->buffered_line[former_index]) != 0)) { in shell_process()
608 p_shell->input_line_active = (p_shell->input_line_active + 1) % MAX_BUFFERED_CMDS; in shell_process()
611 p_shell->to_select_index = p_shell->input_line_active; in shell_process()
617 (void)memset(p_shell->buffered_line[p_shell->input_line_active], 0, SHELL_CMD_MAX_LEN + 1U); in shell_process()
653 p_shell->cmds = shell_cmds; in shell_init()
654 p_shell->cmd_count = ARRAY_SIZE(shell_cmds); in shell_init()
656 p_shell->to_select_index = 0; in shell_init()
659 (void)memset(p_shell->buffered_line[p_shell->input_line_active], 0U, SHELL_CMD_MAX_LEN + 1U); in shell_init()
674 p_shell->cmd_count, __func__); in shell_cmd_help()
677 if (p_shell->cmd_count == 0U) { in shell_cmd_help()
684 for (j = 0U; j < p_shell->cmd_count; j++) { in shell_cmd_help()
685 p_cmd = &p_shell->cmds[j]; in shell_cmd_help()