Implement basic canonical mode for Windows

The `cat` command now works properly, when run by itself on the bash
command prompt. It's working beautifully so far, and is only missing
a few keystrokes for clearing words and lines. Definitely works more
well than the one that ships with WIN32 :-)
This commit is contained in:
Justine Tunney 2023-10-03 22:34:45 -07:00
parent 4825737509
commit f26a280cda
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
36 changed files with 320 additions and 231 deletions

View file

@ -1275,23 +1275,23 @@ syscon termios FF1 0b1000000000000000 0b1000000000000000 0b000100000000000
# Teletypewriter Special Control Character Assignments
#
# group name GNU/Systemd GNU/Systemd (Aarch64) XNU's Not UNIX! MacOS (Arm64) FreeBSD OpenBSD NetBSD The New Technology Commentary
syscon termios VMIN 6+1 6+1 16 16 16 16 16 6 # termios.c_cc[VMIN]=𝑥 in non-canonical mode can be set to 0 for non-blocking reads, 1 for single character raw mode reads, or higher to buffer
syscon termios VTIME 5+1 5+1 17 17 17 17 17 5 # termios.c_cc[VTIME]=𝑥 sets non-canonical read timeout to 𝑥×𝟷𝟶𝟶ms which is needed when entering escape sequences manually with the escape key
syscon termios VINTR 0+1 0+1 8 8 8 8 8 0 # termios.c_cc[VINTR]=𝑥
syscon termios VQUIT 1+1 1+1 9 9 9 9 9 1 # termios.c_cc[VQUIT]=𝑥
syscon termios VERASE 2+1 2+1 3 3 3 3 3 2 # termios.c_cc[VERASE]=𝑥
syscon termios VKILL 3+1 3+1 5 5 5 5 5 3 # termios.c_cc[VKILL]=𝑥
syscon termios VEOF 4+1 4+1 0 0 0 0 0 4 # termios.c_cc[VEOF]=𝑥
syscon termios VSWTC 7+1 7+1 0 0 0 0 0 7 # termios.c_cc[VSWTC]=𝑥
syscon termios VSTART 8+1 8+1 12 12 12 12 12 8 # termios.c_cc[VSTART]=𝑥
syscon termios VSTOP 9+1 9+1 13 13 13 13 13 9 # termios.c_cc[VSTOP]=𝑥
syscon termios VSUSP 10+1 10+1 10 10 10 10 10 10 # termios.c_cc[VSUSP]=𝑥 defines suspend, i.e. Ctrl-Z (a.k.a. →, ^Z, SUB, 26, 032, 0x1A, ord('Z')^0b01000000); unix consensus
syscon termios VEOL 11+1 11+1 1 1 1 1 1 11 # termios.c_cc[VEOL]=𝑥
syscon termios VREPRINT 12+1 12+1 6 6 6 6 6 12 # termios.c_cc[VREPRINT]=𝑥
syscon termios VDISCARD 13+1 13+1 15 15 15 15 15 13 # termios.c_cc[VDISCARD]=𝑥
syscon termios VWERASE 14+1 14+1 4 4 4 4 4 14 # termios.c_cc[VWERASE]=𝑥
syscon termios VLNEXT 15+1 15+1 14 14 14 14 14 15 # termios.c_cc[VLNEXT]=𝑥
syscon termios VEOL2 16+1 16+1 2 2 2 2 2 16 # termios.c_cc[VEOL2]=𝑥
syscon termios VMIN 6+1 6+1 16 16 16 16 16 6+1 # termios.c_cc[VMIN]=𝑥 in non-canonical mode can be set to 0 for non-blocking reads, 1 for single character raw mode reads, or higher to buffer
syscon termios VTIME 5+1 5+1 17 17 17 17 17 5+1 # termios.c_cc[VTIME]=𝑥 sets non-canonical read timeout to 𝑥×𝟷𝟶𝟶ms which is needed when entering escape sequences manually with the escape key
syscon termios VINTR 0+1 0+1 8 8 8 8 8 0+1 # termios.c_cc[VINTR]=𝑥
syscon termios VQUIT 1+1 1+1 9 9 9 9 9 1+1 # termios.c_cc[VQUIT]=𝑥
syscon termios VERASE 2+1 2+1 3 3 3 3 3 2+1 # termios.c_cc[VERASE]=𝑥
syscon termios VKILL 3+1 3+1 5 5 5 5 5 3+1 # termios.c_cc[VKILL]=𝑥
syscon termios VEOF 4+1 4+1 0 0 0 0 0 4+1 # termios.c_cc[VEOF]=𝑥
syscon termios VSWTC 7+1 7+1 0 0 0 0 0 7+1 # termios.c_cc[VSWTC]=𝑥
syscon termios VSTART 8+1 8+1 12 12 12 12 12 8+1 # termios.c_cc[VSTART]=𝑥
syscon termios VSTOP 9+1 9+1 13 13 13 13 13 9+1 # termios.c_cc[VSTOP]=𝑥
syscon termios VSUSP 10+1 10+1 10 10 10 10 10 10+1 # termios.c_cc[VSUSP]=𝑥 defines suspend, i.e. Ctrl-Z (a.k.a. →, ^Z, SUB, 26, 032, 0x1A, ord('Z')^0b01000000); unix consensus
syscon termios VEOL 11+1 11+1 1 1 1 1 1 11+1 # termios.c_cc[VEOL]=𝑥
syscon termios VREPRINT 12+1 12+1 6 6 6 6 6 12+1 # termios.c_cc[VREPRINT]=𝑥
syscon termios VDISCARD 13+1 13+1 15 15 15 15 15 13+1 # termios.c_cc[VDISCARD]=𝑥
syscon termios VWERASE 14+1 14+1 4 4 4 4 4 14+1 # termios.c_cc[VWERASE]=𝑥
syscon termios VLNEXT 15+1 15+1 14 14 14 14 14 15+1 # termios.c_cc[VLNEXT]=𝑥
syscon termios VEOL2 16+1 16+1 2 2 2 2 2 16+1 # termios.c_cc[VEOL2]=𝑥
syscon termios _POSIX_VDISABLE 0 0 255 255 255 255 255 0 # termios.c_cc tombstone value
# tcflush() magic numbers

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VDISCARD,13+1,13+1,15,15,15,15,15,13
.syscon termios,VDISCARD,13+1,13+1,15,15,15,15,15,13+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VEOF,4+1,4+1,0,0,0,0,0,4
.syscon termios,VEOF,4+1,4+1,0,0,0,0,0,4+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VEOL,11+1,11+1,1,1,1,1,1,11
.syscon termios,VEOL,11+1,11+1,1,1,1,1,1,11+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VEOL2,16+1,16+1,2,2,2,2,2,16
.syscon termios,VEOL2,16+1,16+1,2,2,2,2,2,16+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VERASE,2+1,2+1,3,3,3,3,3,2
.syscon termios,VERASE,2+1,2+1,3,3,3,3,3,2+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VINTR,0+1,0+1,8,8,8,8,8,0
.syscon termios,VINTR,0+1,0+1,8,8,8,8,8,0+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VKILL,3+1,3+1,5,5,5,5,5,3
.syscon termios,VKILL,3+1,3+1,5,5,5,5,5,3+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VLNEXT,15+1,15+1,14,14,14,14,14,15
.syscon termios,VLNEXT,15+1,15+1,14,14,14,14,14,15+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VMIN,6+1,6+1,16,16,16,16,16,6
.syscon termios,VMIN,6+1,6+1,16,16,16,16,16,6+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VQUIT,1+1,1+1,9,9,9,9,9,1
.syscon termios,VQUIT,1+1,1+1,9,9,9,9,9,1+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VREPRINT,12+1,12+1,6,6,6,6,6,12
.syscon termios,VREPRINT,12+1,12+1,6,6,6,6,6,12+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VSTART,8+1,8+1,12,12,12,12,12,8
.syscon termios,VSTART,8+1,8+1,12,12,12,12,12,8+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VSTOP,9+1,9+1,13,13,13,13,13,9
.syscon termios,VSTOP,9+1,9+1,13,13,13,13,13,9+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VSUSP,10+1,10+1,10,10,10,10,10,10
.syscon termios,VSUSP,10+1,10+1,10,10,10,10,10,10+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VSWTC,7+1,7+1,0,0,0,0,0,7
.syscon termios,VSWTC,7+1,7+1,0,0,0,0,0,7+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VTIME,5+1,5+1,17,17,17,17,17,5
.syscon termios,VTIME,5+1,5+1,17,17,17,17,17,5+1

View file

@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
.syscon termios,VWERASE,14+1,14+1,4,4,4,4,4,14
.syscon termios,VWERASE,14+1,14+1,4,4,4,4,4,14+1