Rev 4224 | Rev 4273 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4224 | Rev 4267 | ||
---|---|---|---|
Line 212... | Line 212... | ||
212 | 212 | ||
213 | output[0] = 0; |
213 | output[0] = 0; |
214 | 214 | ||
215 | while ((hint = cmdtab_search_one(name, &pos))) { |
215 | while ((hint = cmdtab_search_one(name, &pos))) { |
216 | if ((found == 0) || (str_length(output) > str_length(hint))) |
216 | if ((found == 0) || (str_length(output) > str_length(hint))) |
217 | str_ncpy(output, hint, MAX_CMDLINE); |
217 | str_cpy(output, MAX_CMDLINE, hint); |
218 | 218 | ||
219 | pos = pos->next; |
219 | pos = pos->next; |
220 | found++; |
220 | found++; |
221 | } |
221 | } |
222 | 222 | ||
Line 229... | Line 229... | ||
229 | pos = pos->next; |
229 | pos = pos->next; |
230 | } |
230 | } |
231 | } |
231 | } |
232 | 232 | ||
233 | if (found > 0) |
233 | if (found > 0) |
234 | str_ncpy(input, output, size); |
234 | str_cpy(input, size, output); |
235 | 235 | ||
236 | return found; |
236 | return found; |
237 | } |
237 | } |
238 | 238 | ||
239 | static wchar_t *clever_readline(const char *prompt, indev_t *indev) |
239 | static wchar_t *clever_readline(const char *prompt, indev_t *indev) |
Line 436... | Line 436... | ||
436 | len--; |
436 | len--; |
437 | } |
437 | } |
438 | 438 | ||
439 | if ((text[0] < '0') || (text[0] > '9')) { |
439 | if ((text[0] < '0') || (text[0] > '9')) { |
440 | char symname[MAX_SYMBOL_NAME]; |
440 | char symname[MAX_SYMBOL_NAME]; |
441 | str_ncpy(symname, text, min(len + 1, MAX_SYMBOL_NAME)); |
441 | str_ncpy(symname, MAX_SYMBOL_NAME, text, len + 1); |
442 | 442 | ||
443 | uintptr_t symaddr; |
443 | uintptr_t symaddr; |
444 | int rc = symtab_addr_lookup(symname, &symaddr); |
444 | int rc = symtab_addr_lookup(symname, &symaddr); |
445 | switch (rc) { |
445 | switch (rc) { |
446 | case ENOENT: |
446 | case ENOENT: |
Line 578... | Line 578... | ||
578 | 578 | ||
579 | char *buf; |
579 | char *buf; |
580 | switch (cmd->argv[i].type) { |
580 | switch (cmd->argv[i].type) { |
581 | case ARG_TYPE_STRING: |
581 | case ARG_TYPE_STRING: |
582 | buf = (char *) cmd->argv[i].buffer; |
582 | buf = (char *) cmd->argv[i].buffer; |
583 | str_ncpy(buf, cmdline + start, |
583 | str_ncpy(buf, cmd->argv[i].len, cmdline + start, |
584 | min((end - start) + 1, cmd->argv[i].len)); |
584 | (end - start) + 1); |
585 | break; |
585 | break; |
586 | case ARG_TYPE_INT: |
586 | case ARG_TYPE_INT: |
587 | if (!parse_int_arg(cmdline + start, end - start, |
587 | if (!parse_int_arg(cmdline + start, end - start, |
588 | &cmd->argv[i].intval)) |
588 | &cmd->argv[i].intval)) |
589 | error = true; |
589 | error = true; |
590 | break; |
590 | break; |
591 | case ARG_TYPE_VAR: |
591 | case ARG_TYPE_VAR: |
592 | if ((start < end - 1) && (cmdline[start] == '"')) { |
592 | if ((start < end - 1) && (cmdline[start] == '"')) { |
593 | if (cmdline[end - 1] == '"') { |
593 | if (cmdline[end - 1] == '"') { |
594 | buf = (char *) cmd->argv[i].buffer; |
594 | buf = (char *) cmd->argv[i].buffer; |
- | 595 | str_ncpy(buf, cmd->argv[i].len, |
|
595 | str_ncpy(buf, cmdline + start + 1, |
596 | cmdline + start + 1, |
596 | min((end - start) - 1, cmd->argv[i].len)); |
597 | (end - start) - 1); |
597 | cmd->argv[i].intval = (unative_t) buf; |
598 | cmd->argv[i].intval = (unative_t) buf; |
598 | cmd->argv[i].vartype = ARG_TYPE_STRING; |
599 | cmd->argv[i].vartype = ARG_TYPE_STRING; |
599 | } else { |
600 | } else { |
600 | printf("Wrong synxtax.\n"); |
601 | printf("Wrong synxtax.\n"); |
601 | error = true; |
602 | error = true; |