Ignore:
File:
1 edited

Legend:

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

    r690ad20 r583c2a3  
    3939 */
    4040
     41#include <assert.h>
     42#include <console/kconsole.h>
     43#include <console/console.h>
     44#include <console/chardev.h>
     45#include <console/cmd.h>
     46#include <console/prompt.h>
     47#include <stdio.h>
     48#include <panic.h>
     49#include <typedefs.h>
    4150#include <adt/list.h>
    4251#include <arch.h>
    43 #include <assert.h>
    44 #include <console/chardev.h>
    45 #include <console/cmd.h>
    46 #include <console/console.h>
    47 #include <console/kconsole.h>
    48 #include <console/prompt.h>
     52#include <macros.h>
    4953#include <debug.h>
     54#include <halt.h>
     55#include <str.h>
     56#include <sysinfo/sysinfo.h>
     57#include <symtab.h>
    5058#include <errno.h>
    51 #include <halt.h>
    52 #include <macros.h>
    53 #include <panic.h>
    54 #include <stdio.h>
     59#include <putchar.h>
    5560#include <stdlib.h>
    56 #include <str.h>
    57 #include <symtab.h>
    58 #include <sysinfo/sysinfo.h>
    59 #include <typedefs.h>
    6061
    6162/** Simple kernel console.
     
    8485SPINLOCK_INITIALIZE(cmd_lock);  /**< Lock protecting command list. */
    8586LIST_INITIALIZE(cmd_list);      /**< Command list. */
    86 
    87 #define MAX_SYMBOL_NAME 64
    8887
    8988static char32_t history[KCONSOLE_HISTORY][MAX_CMDLINE] = { };
     
    157156
    158157/** Print count times a character */
    159 _NO_TRACE static void print_cc(char ch, size_t count)
    160 {
    161         // FIXME: only lock once
    162 
    163         for (size_t i = 0; i < count; i++)
    164                 putstr(&ch, 1);
     158_NO_TRACE static void print_cc(char32_t ch, size_t count)
     159{
     160        size_t i;
     161        for (i = 0; i < count; i++)
     162                putuchar(ch);
    165163}
    166164
     
    347345                if (ch == '\n') {
    348346                        /* Enter */
    349                         putstr("\n", 1);
     347                        putuchar(ch);
    350348                        break;
    351349                }
     
    358356                        if (wstr_remove(current, position - 1)) {
    359357                                position--;
    360                                 putstr("\b", 1);
     358                                putuchar('\b');
    361359                                printf("%ls ", current + position);
    362360                                print_cc('\b', wstr_length(current) - position + 1);
     
    368366                        /* Tab completion */
    369367
    370                         size_t i = position;
    371                         while (current[i] && !isspace(current[i]))
    372                                 i++;
    373 
    374                         char32_t stash = current[i];
    375                         current[i] = 0;
    376                         printf("%ls", &current[position]);
    377                         current[i] = stash;
    378                         position = i;
     368                        /* Move to the end of the word */
     369                        for (; (current[position] != 0) && (!isspace(current[position]));
     370                            position++)
     371                                putuchar(current[position]);
    379372
    380373                        /*
     
    435428                         */
    436429                        size_t off = 0;
    437                         for (size_t i = 0; (ch = str_decode(tmp, &off, STR_NO_LIMIT)); i++)
     430                        size_t i = 0;
     431                        while ((ch = str_decode(tmp, &off, STR_NO_LIMIT)) != 0) {
    438432                                if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE))
    439433                                        break;
     434
     435                                i++;
     436                        }
    440437
    441438                        if (found > 1) {
     
    467464                        /* Left */
    468465                        if (position > 0) {
    469                                 putstr("\b", 1);
     466                                putuchar('\b');
    470467                                position--;
    471468                        }
     
    476473                        /* Right */
    477474                        if (position < wstr_length(current)) {
    478                                 printf("%lc", current[position]);
     475                                putuchar(current[position]);
    479476                                position++;
    480477                        }
     
    600597                /* It's a number - convert it */
    601598                uint64_t value;
    602                 const char *end;
     599                char *end;
    603600                errno_t rc = str_uint64_t(text, &end, 0, false, &value);
    604601                if (end != text + len)
Note: See TracChangeset for help on using the changeset viewer.