32,10 → 32,10 |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include <io/stream.h> |
#include <console.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <io/console.h> |
#include <io/keycode.h> |
#include <io/style.h> |
#include <vfs/vfs.h> |
#include <errno.h> |
#include <bool.h> |
|
100,7 → 100,7 |
|
static void read_line(char *buffer, int n) |
{ |
kbd_event_t ev; |
console_event_t ev; |
size_t offs, otmp; |
wchar_t dec; |
|
107,9 → 107,10 |
offs = 0; |
while (true) { |
fflush(stdout); |
if (kbd_get_event(&ev) < 0) |
if (!console_get_event(fphone(stdin), &ev)) |
return; |
if (ev.type == KE_RELEASE) |
|
if (ev.type != KEY_PRESS) |
continue; |
|
if (ev.key == KC_ENTER || ev.key == KC_NENTER) |
131,9 → 132,8 |
continue; |
} |
if (ev.c >= ' ') { |
//putchar(ev.c); |
if (chr_encode(ev.c, buffer, &offs, n - 1) == EOK) |
console_putchar(ev.c); |
putchar(ev.c); |
} |
} |
putchar('\n'); |
147,9 → 147,11 |
{ |
char line[INPUT_MAX]; |
|
console_set_style(STYLE_EMPHASIS); |
fflush(stdout); |
console_set_style(fphone(stdout), STYLE_EMPHASIS); |
printf("%s", usr->prompt); |
console_set_style(STYLE_NORMAL); |
fflush(stdout); |
console_set_style(fphone(stdout), STYLE_NORMAL); |
|
read_line(line, INPUT_MAX); |
/* Make sure we don't have rubbish or a C/R happy user */ |