Allow input of utf8 characters

This commit is contained in:
Devine Lu Linvega 2024-05-10 20:24:47 -07:00
parent 16cb1823c4
commit 8d49821fdd
1 changed files with 6 additions and 9 deletions

View File

@ -90,14 +90,6 @@ device_write(char *s)
} }
} }
static void
device_read(void)
{
char c, *origin = dst_;
while(fread(&c, 1, 1, stdin) && c >= ' ') *dst_++ = c;
if(feof(stdin)) dst_ = copy("EOF", dst_, 3);
}
static char * static char *
file_import(char *path, char *ptr) file_import(char *path, char *ptr)
{ {
@ -123,7 +115,12 @@ write_reg(char r, char *reg)
{ {
switch(r) { switch(r) {
case ':': device_write(reg); return; case ':': device_write(reg); return;
case '~': device_read(); return; case '~': {
unsigned char c;
while(fread(&c, 1, 1, stdin) && c >= ' ') *dst_++ = c;
if(feof(stdin)) dst_ = copy("EOF", dst_, 3);
return;
}
case '_': { case '_': {
char filepath[0x80]; char filepath[0x80];
copy(reg, filepath, walk(reg) - reg); copy(reg, filepath, walk(reg) - reg);