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