Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/kconsole.c

    raca4a04 r9b11a971  
    202202 *
    203203 */
    204 NO_TRACE static int cmdtab_compl(char *input, size_t size, indev_t * indev)
     204NO_TRACE static int cmdtab_compl(char *input, size_t size, indev_t *indev)
    205205{
    206206        const char *name = input;
    207207       
    208208        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         */
    211214        size_t max_match_len = size;
    212215        size_t max_match_len_tmp = size;
     
    229232        }
    230233       
    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         */
    232238        if (found > MAX_TAB_HINTS) {
    233239                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);
    235242        }
    236243       
     
    240247                while (cmdtab_search_one(name, &pos)) {
    241248                        cmd_info_t *hlp = list_get_instance(pos, cmd_info_t, link);
    242 
     249                       
    243250                        if (continue_showing_hints) {
    244251                                printf("%s (%s)\n", hlp->name, hlp->description);
    245252                                --hints_to_show;
    246253                                ++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);
    250259                                }
    251260                        }
    252 
     261                       
    253262                        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                       
    256269                        max_match_len = max_match_len_tmp;
    257270                }
    258                 /* keep only the characters common in all completions */
     271               
     272                /* Keep only the characters common in all completions */
    259273                output[max_match_len] = 0;
    260274        }
     
    310324                                continue;
    311325                       
    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                         */
    314330                        size_t beg;
    315331                        for (beg = position - 1; (beg > 0) && (!isspace(current[beg]));
     
    333349                                continue;
    334350
    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                         */
    337355                        size_t off = 0;
    338356                        size_t i = 0;
     
    340358                                if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE))
    341359                                        break;
     360                               
    342361                                i++;
    343362                        }
     
    505524                /* It's a number - convert it */
    506525                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;
    508530                switch (rc) {
    509531                case EINVAL:
    510                         printf("Invalid number.\n");
     532                        printf("Invalid number '%s'.\n", text);
    511533                        return false;
    512534                case EOVERFLOW:
    513                         printf("Integer overflow.\n");
     535                        printf("Integer overflow in '%s'.\n", text);
    514536                        return false;
    515537                case EOK:
     
    519541                        break;
    520542                default:
    521                         printf("Unknown error.\n");
     543                        printf("Unknown error parsing '%s'.\n", text);
    522544                        return false;
    523545                }
Note: See TracChangeset for help on using the changeset viewer.