diff --git a/src/modal.c b/src/modal.c index 41bcb1d..5447fde 100644 --- a/src/modal.c +++ b/src/modal.c @@ -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 * file_import(char *path, char *ptr) { @@ -123,7 +115,12 @@ write_reg(char r, char *reg) { switch(r) { 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 '_': { char filepath[0x80]; copy(reg, filepath, walk(reg) - reg);