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 $) (?:)
<> ($ ?x) (?x $)
$ (Welcome to NAME
Have fun!\n\n) print
$ (Welcome to NAME \nHave fun!\n\n) print

View File

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

View File

@ -76,11 +76,13 @@ put_reg(char r)
} else if(s) {
char *ss = walk(s);
if(r == ':') {
if(*(outp_ - 1) == ' ') outp_--;
if(*s == '(') s++, --ss;
while(s < ss) {
char c = *s++;
if(c == '\\') {
switch(*s++) {
case 't': putc(0x09, stdout); break;
case 'n': putc(0x0a, stdout); break;
case 's': putc(0x20, stdout); break;
}
@ -209,6 +211,7 @@ main(int argc, char **argv)
if(!(f = fopen(argv[1], "r")))
return !printf("Invalid Modal file: %s.\n", argv[1]);
while(fread(&c, 1, 1, f)) {
c = c <= 0x20 ? 0x20 : c;
if(w > bank_a) {
if(c == ' ' && *(w - 1) == '(') continue;
if(c == ')' && *(w - 1) == ' ') w--;