Added escape character for space

This commit is contained in:
Devine Lu Linvega 2024-04-12 07:35:46 -07:00
parent 12a767dc0e
commit e04d4fa23f
1 changed files with 8 additions and 3 deletions

View File

@ -79,8 +79,13 @@ put_reg(char r)
if(*s == '(') s++, --ss;
while(s < ss) {
char c = *s++;
if(c == '\\' && *s++ == 'n') c = 0xa;
putc(c, stdout);
if(c == '\\') {
switch(*s++) {
case 'n': putc(0x0a, stdout); break;
case 's': putc(0x20, stdout); break;
}
} else
putc(c, stdout);
}
} else
while(s < ss) *outp_++ = *s++;
@ -200,7 +205,7 @@ main(int argc, char **argv)
if(argc < 2)
return !printf("usage: modal [-v] source.modal\n");
if(argc < 3 && argv[1][0] == '-' && argv[1][1] == 'v')
return !printf("Modal Interpreter, 11 Apr 2024.\n");
return !printf("Modal Interpreter, 12 Apr 2024.\n");
if(!(f = fopen(argv[1], "r")))
return !printf("Invalid Modal file: %s.\n", argv[1]);
while(fread(&c, 1, 1, f)) {