Changes in kernel/generic/src/console/kconsole.c [aca4a04:9b11a971] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/kconsole.c
raca4a04 r9b11a971 202 202 * 203 203 */ 204 NO_TRACE static int cmdtab_compl(char *input, size_t size, indev_t * 204 NO_TRACE static int cmdtab_compl(char *input, size_t size, indev_t *indev) 205 205 { 206 206 const char *name = input; 207 207 208 208 size_t found = 0; 209 /* Maximum Match Length : Length of longest matching common substring in 210 case more than one match is found */ 209 210 /* 211 * Maximum Match Length: Length of longest matching common 212 * substring in case more than one match is found. 213 */ 211 214 size_t max_match_len = size; 212 215 size_t max_match_len_tmp = size; … … 229 232 } 230 233 231 /* If possible completions are more than MAX_TAB_HINTS, ask user whether to display them or not. */ 234 /* 235 * If the number of possible completions is more than MAX_TAB_HINTS, 236 * ask the user whether to display them or not. 237 */ 232 238 if (found > MAX_TAB_HINTS) { 233 239 printf("\n"); 234 continue_showing_hints = console_prompt_display_all_hints(indev, found); 240 continue_showing_hints = 241 console_prompt_display_all_hints(indev, found); 235 242 } 236 243 … … 240 247 while (cmdtab_search_one(name, &pos)) { 241 248 cmd_info_t *hlp = list_get_instance(pos, cmd_info_t, link); 242 249 243 250 if (continue_showing_hints) { 244 251 printf("%s (%s)\n", hlp->name, hlp->description); 245 252 --hints_to_show; 246 253 ++total_hints_shown; 247 248 if (hints_to_show == 0 && total_hints_shown != found) { /* Time to ask user to continue */ 249 continue_showing_hints = console_prompt_more_hints(indev, &hints_to_show); 254 255 if ((hints_to_show == 0) && (total_hints_shown != found)) { 256 /* Ask user to continue */ 257 continue_showing_hints = 258 console_prompt_more_hints(indev, &hints_to_show); 250 259 } 251 260 } 252 261 253 262 pos = pos->next; 254 for(max_match_len_tmp = 0; output[max_match_len_tmp] == hlp->name[input_len + max_match_len_tmp] 255 && max_match_len_tmp < max_match_len; ++max_match_len_tmp); 263 264 for (max_match_len_tmp = 0; 265 (output[max_match_len_tmp] == 266 hlp->name[input_len + max_match_len_tmp]) && 267 (max_match_len_tmp < max_match_len); ++max_match_len_tmp); 268 256 269 max_match_len = max_match_len_tmp; 257 270 } 258 /* keep only the characters common in all completions */ 271 272 /* Keep only the characters common in all completions */ 259 273 output[max_match_len] = 0; 260 274 } … … 310 324 continue; 311 325 312 /* Find the beginning of the word 313 and copy it to tmp */ 326 /* 327 * Find the beginning of the word 328 * and copy it to tmp 329 */ 314 330 size_t beg; 315 331 for (beg = position - 1; (beg > 0) && (!isspace(current[beg])); … … 333 349 continue; 334 350 335 /* We have hints, may be many. In case of more than one hint, 336 tmp will contain the common prefix. */ 351 /* 352 * We have hints, possibly many. In case of more than one hint, 353 * tmp will contain the common prefix. 354 */ 337 355 size_t off = 0; 338 356 size_t i = 0; … … 340 358 if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE)) 341 359 break; 360 342 361 i++; 343 362 } … … 505 524 /* It's a number - convert it */ 506 525 uint64_t value; 507 int rc = str_uint64_t(text, NULL, 0, true, &value); 526 char *end; 527 int rc = str_uint64_t(text, &end, 0, false, &value); 528 if (end != text + len) 529 rc = EINVAL; 508 530 switch (rc) { 509 531 case EINVAL: 510 printf("Invalid number .\n");532 printf("Invalid number '%s'.\n", text); 511 533 return false; 512 534 case EOVERFLOW: 513 printf("Integer overflow .\n");535 printf("Integer overflow in '%s'.\n", text); 514 536 return false; 515 537 case EOK: … … 519 541 break; 520 542 default: 521 printf("Unknown error .\n");543 printf("Unknown error parsing '%s'.\n", text); 522 544 return false; 523 545 }
Note:
See TracChangeset
for help on using the changeset viewer.