Fixed space leak

This commit is contained in:
Devine Lu Linvega 2024-04-12 08:54:07 -07:00
parent e04d4fa23f
commit 931d43ea9c
3 changed files with 5 additions and 3 deletions

View File

@ -2,5 +2,4 @@
<> (?: print $) (?:) <> (?: print $) (?:)
<> ($ ?x) (?x $) <> ($ ?x) (?x $)
$ (Welcome to NAME $ (Welcome to NAME \nHave fun!\n\n) print
Have fun!\n\n) print

View File

@ -40,5 +40,5 @@
-- (Interface) -- (Interface)
(put-str (Input a move, like "X 0 1":\n)) ((Input a move, like "X 0 1":\n) put-str)
((- - -) (- - -) (- - -)) ready ((- - -) (- - -) (- - -)) ready

View File

@ -76,11 +76,13 @@ put_reg(char r)
} else if(s) { } else if(s) {
char *ss = walk(s); char *ss = walk(s);
if(r == ':') { if(r == ':') {
if(*(outp_ - 1) == ' ') outp_--;
if(*s == '(') s++, --ss; if(*s == '(') s++, --ss;
while(s < ss) { while(s < ss) {
char c = *s++; char c = *s++;
if(c == '\\') { if(c == '\\') {
switch(*s++) { switch(*s++) {
case 't': putc(0x09, stdout); break;
case 'n': putc(0x0a, stdout); break; case 'n': putc(0x0a, stdout); break;
case 's': putc(0x20, stdout); break; case 's': putc(0x20, stdout); break;
} }
@ -209,6 +211,7 @@ main(int argc, char **argv)
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)) {
c = c <= 0x20 ? 0x20 : c;
if(w > bank_a) { if(w > bank_a) {
if(c == ' ' && *(w - 1) == '(') continue; if(c == ' ' && *(w - 1) == '(') continue;
if(c == ')' && *(w - 1) == ' ') w--; if(c == ')' && *(w - 1) == ' ') w--;