Changes in kernel/generic/src/console/kconsole.c [583c2a3:690ad20] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/kconsole.c
r583c2a3 r690ad20 39 39 */ 40 40 41 #include <adt/list.h> 42 #include <arch.h> 41 43 #include <assert.h> 42 #include <console/kconsole.h>43 #include <console/console.h>44 44 #include <console/chardev.h> 45 45 #include <console/cmd.h> 46 #include <console/console.h> 47 #include <console/kconsole.h> 46 48 #include <console/prompt.h> 49 #include <debug.h> 50 #include <errno.h> 51 #include <halt.h> 52 #include <macros.h> 53 #include <panic.h> 47 54 #include <stdio.h> 48 #include <panic.h> 55 #include <stdlib.h> 56 #include <str.h> 57 #include <symtab.h> 58 #include <sysinfo/sysinfo.h> 49 59 #include <typedefs.h> 50 #include <adt/list.h>51 #include <arch.h>52 #include <macros.h>53 #include <debug.h>54 #include <halt.h>55 #include <str.h>56 #include <sysinfo/sysinfo.h>57 #include <symtab.h>58 #include <errno.h>59 #include <putchar.h>60 #include <stdlib.h>61 60 62 61 /** Simple kernel console. … … 85 84 SPINLOCK_INITIALIZE(cmd_lock); /**< Lock protecting command list. */ 86 85 LIST_INITIALIZE(cmd_list); /**< Command list. */ 86 87 #define MAX_SYMBOL_NAME 64 87 88 88 89 static char32_t history[KCONSOLE_HISTORY][MAX_CMDLINE] = { }; … … 156 157 157 158 /** Print count times a character */ 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); 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); 163 165 } 164 166 … … 345 347 if (ch == '\n') { 346 348 /* Enter */ 347 put uchar(ch);349 putstr("\n", 1); 348 350 break; 349 351 } … … 356 358 if (wstr_remove(current, position - 1)) { 357 359 position--; 358 put uchar('\b');360 putstr("\b", 1); 359 361 printf("%ls ", current + position); 360 362 print_cc('\b', wstr_length(current) - position + 1); … … 366 368 /* Tab completion */ 367 369 368 /* Move to the end of the word */ 369 for (; (current[position] != 0) && (!isspace(current[position])); 370 position++) 371 putuchar(current[position]); 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", ¤t[position]); 377 current[i] = stash; 378 position = i; 372 379 373 380 /* … … 428 435 */ 429 436 size_t off = 0; 430 size_t i = 0; 431 while ((ch = str_decode(tmp, &off, STR_NO_LIMIT)) != 0) { 437 for (size_t i = 0; (ch = str_decode(tmp, &off, STR_NO_LIMIT)); i++) 432 438 if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE)) 433 439 break; 434 435 i++;436 }437 440 438 441 if (found > 1) { … … 464 467 /* Left */ 465 468 if (position > 0) { 466 put uchar('\b');469 putstr("\b", 1); 467 470 position--; 468 471 } … … 473 476 /* Right */ 474 477 if (position < wstr_length(current)) { 475 p utuchar(current[position]);478 printf("%lc", current[position]); 476 479 position++; 477 480 } … … 597 600 /* It's a number - convert it */ 598 601 uint64_t value; 599 c har *end;602 const char *end; 600 603 errno_t rc = str_uint64_t(text, &end, 0, false, &value); 601 604 if (end != text + len)
Note:
See TracChangeset
for help on using the changeset viewer.