Changeset d9ffc54 in mainline


Ignore:
Timestamp:
2016-03-16T11:27:23Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
485dacd
Parents:
669e9b5 (diff), 6b00876 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~aurelio-x/helenos/kcon-devel

File:
1 edited

Legend:

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

    r669e9b5 rd9ffc54  
    362362                                putchar(current[position]);
    363363                       
    364                         if (position == 0)
    365                                 continue;
    366364                       
    367365                        /*
     
    370368                         */
    371369                        size_t beg;
    372                         for (beg = position - 1; (beg > 0) && (!isspace(current[beg]));
    373                             beg--);
    374                        
    375                         if (isspace(current[beg]))
    376                                 beg++;
    377                        
    378                         wstr_to_str(tmp, position - beg + 1, current + beg);
    379                        
     370                        unsigned narg = 0;
     371                        if (position == 0) {
     372                                tmp[0] = '\0';
     373                                beg = 0;
     374                        } else {
     375                                for (beg = position - 1;
     376                                    (beg > 0) && (!isspace(current[beg]));
     377                                    beg--) {
     378                                        ;
     379                                }
     380                               
     381                                if (isspace(current[beg]))
     382                                        beg++;
     383                               
     384                                wstr_to_str(tmp, position - beg + 1, current + beg);
     385                        }
     386                       
     387                        /* Count which argument number are we tabbing (narg=0 is cmd) */
     388                        bool sp = false;
     389                        for (; beg > 0; beg--) {
     390                                if (isspace(current[beg])) {
     391                                        if (!sp) {
     392                                                narg++;
     393                                                sp = true;
     394                                        }
     395                                } else
     396                                        sp = false;
     397                        }
     398                        if (narg && isspace(current[0]))
     399                                narg--;
     400
    380401                        int found;
    381                         if (beg == 0) {
     402                        if (narg == 0) {
    382403                                /* Command completion */
    383404                                found = cmdtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE), indev,
     
    386407                                /* Arguments completion */
    387408                                cmd_info_t *cmd = parse_cmd(current);
    388                                 if (!cmd || !cmd->hints_enum)
     409                                if (!cmd || !cmd->hints_enum || cmd->argc < narg)
    389410                                        continue;
    390411                                found = cmdtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE), indev,
Note: See TracChangeset for help on using the changeset viewer.