From 81cf0f729e3b7ad777e144843da29a787854b666 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Fri, 17 Feb 2023 09:00:22 +0900 Subject: [PATCH] tty: support IUCLC since we support OLCUC --- apps/stty.c | 2 ++ kernel/vfs/tty.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/apps/stty.c b/apps/stty.c index 051faa02..ee53ae46 100644 --- a/apps/stty.c +++ b/apps/stty.c @@ -170,6 +170,7 @@ static int show_settings(int all) { print_iflag("ixany", IXANY, 0); print_iflag("ixoff", IXOFF, 0); print_iflag("ixon", IXON, 0); + print_iflag("iuclc", IUCLC, 0); print_iflag("parmrk", PARMRK, 0); if (printed) { fprintf(stdout, "\n"); printed = 0; } @@ -323,6 +324,7 @@ int main(int argc, char * argv[]) { set_iflag("ixon", IXON); set_iflag("ixany", IXANY); set_iflag("ixoff", IXOFF); + set_iflag("iuclc", IUCLC); set_oflag("olcuc", OLCUC); set_oflag("opost", OPOST); diff --git a/kernel/vfs/tty.c b/kernel/vfs/tty.c index 77f03b8e..4fc03572 100644 --- a/kernel/vfs/tty.c +++ b/kernel/vfs/tty.c @@ -178,6 +178,10 @@ void tty_input_process(pty_t * pty, uint8_t c) { c = '\n'; } + if ((pty->tios.c_iflag & IUCLC) && (c >= 'A' && c <= 'Z')) { + c = c - 'A' + 'a'; + } + if (pty->tios.c_lflag & ICANON) { if (c == pty->tios.c_cc[VLNEXT] && (pty->tios.c_lflag & IEXTEN)) {