Ignore:
Timestamp:
2011-04-13T14:45:41Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
88634420
Parents:
cefb126 (diff), 17279ead (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 mainline changes.

File:
1 edited

Legend:

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

    rcefb126 r89c57b6  
    160160
    161161/** Print count times a character */
    162 static void print_cc(wchar_t ch, size_t count)
     162NO_TRACE static void print_cc(wchar_t ch, size_t count)
    163163{
    164164        size_t i;
     
    168168
    169169/** Try to find a command beginning with prefix */
    170 static const char *cmdtab_search_one(const char *name, link_t **startpos)
     170NO_TRACE static const char *cmdtab_search_one(const char *name,
     171    link_t **startpos)
    171172{
    172173        size_t namelen = str_length(name);
     
    202203 *
    203204 */
    204 static int cmdtab_compl(char *input, size_t size)
     205NO_TRACE static int cmdtab_compl(char *input, size_t size)
    205206{
    206207        const char *name = input;
     
    209210        link_t *pos = NULL;
    210211        const char *hint;
    211         char output[MAX_CMDLINE];
     212        char *output = malloc(MAX_CMDLINE, 0);
    212213       
    213214        output[0] = 0;
     
    234235                str_cpy(input, size, output);
    235236       
     237        free(output);
    236238        return found;
    237239}
    238240
    239 static wchar_t *clever_readline(const char *prompt, indev_t *indev)
     241NO_TRACE static wchar_t *clever_readline(const char *prompt, indev_t *indev)
    240242{
    241243        printf("%s> ", prompt);
     
    244246        wchar_t *current = history[history_pos];
    245247        current[0] = 0;
     248        char *tmp = malloc(STR_BOUNDS(MAX_CMDLINE), 0);
    246249       
    247250        while (true) {
     
    288291                                beg++;
    289292                       
    290                         char tmp[STR_BOUNDS(MAX_CMDLINE)];
    291293                        wstr_to_str(tmp, position - beg + 1, current + beg);
    292294                       
     
    414416        }
    415417       
     418        free(tmp);
    416419        return current;
    417420}
     
    422425}
    423426
    424 static bool parse_int_arg(const char *text, size_t len, unative_t *result)
     427NO_TRACE static bool parse_int_arg(const char *text, size_t len,
     428    sysarg_t *result)
    425429{
    426430        bool isaddr = false;
     
    457461                case EOK:
    458462                        if (isaddr)
    459                                 *result = (unative_t) symaddr;
     463                                *result = (sysarg_t) symaddr;
    460464                        else if (isptr)
    461                                 *result = **((unative_t **) symaddr);
     465                                *result = **((sysarg_t **) symaddr);
    462466                        else
    463                                 *result = *((unative_t *) symaddr);
     467                                *result = *((sysarg_t *) symaddr);
    464468                        break;
    465469                default:
     
    479483                        return false;
    480484                case EOK:
    481                         *result = (unative_t) value;
     485                        *result = (sysarg_t) value;
    482486                        if (isptr)
    483                                 *result = *((unative_t *) *result);
     487                                *result = *((sysarg_t *) *result);
    484488                        break;
    485489                default:
     
    507511 *
    508512 */
    509 static bool parse_argument(const char *cmdline, size_t size, size_t *start, size_t *end)
     513NO_TRACE static bool parse_argument(const char *cmdline, size_t size,
     514    size_t *start, size_t *end)
    510515{
    511516        ASSERT(start != NULL);
     
    543548 *
    544549 */
    545 static cmd_info_t *parse_cmdline(const char *cmdline, size_t size)
     550NO_TRACE static cmd_info_t *parse_cmdline(const char *cmdline, size_t size)
    546551{
    547552        size_t start = 0;
     
    624629                                            cmdline + start + 1,
    625630                                            (end - start) - 1);
    626                                         cmd->argv[i].intval = (unative_t) buf;
     631                                        cmd->argv[i].intval = (sysarg_t) buf;
    627632                                        cmd->argv[i].vartype = ARG_TYPE_STRING;
    628633                                } else {
    629                                         printf("Wrong synxtax.\n");
     634                                        printf("Wrong syntax.\n");
    630635                                        error = true;
    631636                                }
     
    685690                printf("Type \"exit\" to leave the console.\n");
    686691       
     692        char *cmdline = malloc(STR_BOUNDS(MAX_CMDLINE), 0);
    687693        while (true) {
    688694                wchar_t *tmp = clever_readline((char *) prompt, stdin);
     
    691697                        continue;
    692698               
    693                 char cmdline[STR_BOUNDS(MAX_CMDLINE)];
    694699                wstr_to_str(cmdline, STR_BOUNDS(MAX_CMDLINE), tmp);
    695700               
     
    703708                (void) cmd_info->func(cmd_info->argv);
    704709        }
     710        free(cmdline);
    705711}
    706712
Note: See TracChangeset for help on using the changeset viewer.