Lines Matching refs:inbuf
55 char inbuf[CLI_INBUF_SIZE]; member
159 int32_t cli_handle_input(char *inbuf) in cli_handle_input() argument
181 switch (inbuf[i]) { in cli_handle_input()
191 if (i > 0 && inbuf[i - 1] == '\\' && stat.inArg) { in cli_handle_input()
192 memcpy(&inbuf[i - 1], &inbuf[i], in cli_handle_input()
193 strlen((const char *)(&inbuf[i]) + 1)); in cli_handle_input()
210 &inbuf[i + 1]; in cli_handle_input()
214 inbuf[i] = '\0'; in cli_handle_input()
219 if (i > 0 && inbuf[i - 1] == '\\' && stat.inArg) { in cli_handle_input()
220 memcpy(&inbuf[i - 1], &inbuf[i], in cli_handle_input()
221 strlen((const char *)(&inbuf[i]) + 1)); in cli_handle_input()
227 inbuf[i] = '\0'; in cli_handle_input()
232 if (i > 0 && inbuf[i - 1] == '\\' && stat.inArg) { in cli_handle_input()
233 memcpy(&inbuf[i - 1], &inbuf[i], in cli_handle_input()
234 strlen((const char *)(&inbuf[i]) + 1)); in cli_handle_input()
244 inbuf[i] = '\0'; in cli_handle_input()
259 (cmd_arg_all->arg[cmdnum]).argv[(*pargc) - 1] = &inbuf[i]; in cli_handle_input()
292 static void cli_tab_complete(char *inbuf, uint32_t *idx) in cli_tab_complete() argument
303 if (!strncmp(inbuf, g_cli->cmds[i]->name, *idx)) { in cli_tab_complete()
323 memcpy(inbuf + *idx, fm + *idx, n); in cli_tab_complete()
325 inbuf[*idx] = '\0'; in cli_tab_complete()
334 cli_printf("%s", inbuf); in cli_tab_complete()
338 static char *find_last(char *inbuf, uint32_t *idx) in find_last() argument
340 char *ret = inbuf + (--(*idx)); in find_last()
387 static void cli_tab_complete_path(char *inbuf, uint32_t *idx) in cli_tab_complete_path() argument
402 inbuf, *idx); in cli_tab_complete_path()
403 last_str = find_last(inbuf, &last_idx); in cli_tab_complete_path()
430 __func__, __LINE__, inbuf, *idx, last_str, tmpdir, dir); in cli_tab_complete_path()
443 if (inbuf[*idx] == ' ') in cli_tab_complete_path()
446 inbuf[*idx] = '\0'; in cli_tab_complete_path()
449 inbuf, *idx); in cli_tab_complete_path()
546 __LINE__, inbuf, *idx, m, n); in cli_tab_complete_path()
552 snprintf(inbuf + *idx, CLI_INBUF_SIZE - *idx, "%s%s%s", in cli_tab_complete_path()
553 (inbuf[(*idx) - 1] == '/' || inbuf[(*idx) - 1] == ' ') ? in cli_tab_complete_path()
558 inbuf[*idx] = '\0'; in cli_tab_complete_path()
567 snprintf(inbuf + *idx, CLI_INBUF_SIZE - *idx, "%s%s", in cli_tab_complete_path()
568 (inbuf[(*idx) - 1] == '/' || inbuf[(*idx) - 1] == ' ') ? "" : in cli_tab_complete_path()
571 *idx = strlen((const char *)inbuf); in cli_tab_complete_path()
575 inbuf, *idx); in cli_tab_complete_path()
580 len = strlen(inbuf); in cli_tab_complete_path()
581 if (inbuf[len - 1] != '/') in cli_tab_complete_path()
582 inbuf[len++] = '/'; in cli_tab_complete_path()
583 inbuf[len] = '\0'; in cli_tab_complete_path()
589 cli_printf("%s", inbuf); in cli_tab_complete_path()
597 char *inbuf = cli_console_inbuf; in cli_history_input() local
610 strncpy(&(g_cli->history[his_cur]), inbuf, charnum); in cli_history_input()
616 strncpy(&(g_cli->history[his_cur]), inbuf, left_num); in cli_history_input()
617 strncpy(&(g_cli->history[0]), inbuf + left_num, charnum - left_num); in cli_history_input()
719 static int32_t cli_get_input(char *inbuf, uint32_t size) in cli_get_input() argument
724 if (inbuf == NULL) { in cli_get_input()
742 g_cli->inbuf[g_cli->cmd_end_pos] = '\0'; in cli_get_input()
743 memcpy(inbuf, g_cli->inbuf, size); in cli_get_input()
744 memset(g_cli->inbuf, 0, size); in cli_get_input()
771 cli_up_history(g_cli->inbuf); in cli_get_input()
773 cli_down_history(g_cli->inbuf); in cli_get_input()
775 g_cli->cmd_cur_pos = strlen((const char *)g_cli->inbuf); in cli_get_input()
781 cli_printf("%s", g_cli->inbuf); in cli_get_input()
793 cli_printf("%c", g_cli->inbuf[g_cli->cmd_cur_pos]); in cli_get_input()
806 g_cli->inbuf[g_cli->cmd_end_pos] = '\0'; in cli_get_input()
808 if (strstr((const char *)g_cli->inbuf, " ")) { in cli_get_input()
809 cli_tab_complete_path(g_cli->inbuf, &g_cli->cmd_end_pos); in cli_get_input()
812 cli_tab_complete(g_cli->inbuf, &g_cli->cmd_end_pos); in cli_get_input()
816 g_cli->cmd_cur_pos = strlen((const char *)g_cli->inbuf); in cli_get_input()
830 memmove(&g_cli->inbuf[g_cli->cmd_cur_pos], in cli_get_input()
831 &g_cli->inbuf[g_cli->cmd_cur_pos + 1], in cli_get_input()
834 g_cli->inbuf[g_cli->cmd_end_pos] = 0; in cli_get_input()
836 cli_printf("\b%s \b", &g_cli->inbuf[g_cli->cmd_cur_pos]); in cli_get_input()
844 g_cli->inbuf[g_cli->cmd_end_pos] = 0; in cli_get_input()
861 cli_printf("%c", g_cli->inbuf[g_cli->cmd_cur_pos]); in cli_get_input()
903 cli_printf("%c", g_cli->inbuf[i]); in cli_get_input()
923 memmove(&g_cli->inbuf[g_cli->cmd_cur_pos], in cli_get_input()
924 &g_cli->inbuf[g_cli->cmd_cur_pos + 1], in cli_get_input()
927 g_cli->inbuf[g_cli->cmd_end_pos] = 0; in cli_get_input()
929 cli_printf("%s \b", &g_cli->inbuf[g_cli->cmd_cur_pos]); in cli_get_input()
946 memmove(&g_cli->inbuf[g_cli->cmd_cur_pos + 1], in cli_get_input()
947 &g_cli->inbuf[g_cli->cmd_cur_pos], in cli_get_input()
949 g_cli->inbuf[g_cli->cmd_cur_pos] = c; in cli_get_input()
952 cli_printf("%s", &g_cli->inbuf[g_cli->cmd_cur_pos]); in cli_get_input()
960 g_cli->inbuf[g_cli->cmd_end_pos] = c; in cli_get_input()