Merge remote-tracking branch 'upstream/master' into d6/binary

This commit is contained in:
~d6 2024-04-12 10:42:31 -04:00
commit 3904d428a8
1 changed files with 8 additions and 3 deletions

View File

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