From d6a3f2af7b699aa44df90a7810e2bfdf2a773ca1 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 8 Apr 2024 15:26:53 -0700 Subject: [PATCH] Trim program end --- examples/test.modal | 5 ++++- src/modal.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/test.modal b/examples/test.modal index 8996d78..bf84ae8 100644 --- a/examples/test.modal +++ b/examples/test.modal @@ -13,4 +13,7 @@ <> (?x ?y swap) (?y ?x) <> (?x pop) () -(implode reverse (explode hello)) (read) (explode hello) empty-register (eq abc abc) (eq abc def) (1 2 3) (4 5 6) swap pop dup (hey 1234 pop) \ No newline at end of file +(implode reverse (explode hello)) (read) (explode hello) empty-register (eq abc abc) (eq abc def) (1 2 3) (4 5 6) swap pop dup (hey 1234 pop) + + + diff --git a/src/modal.c b/src/modal.c index 58f19f2..f17dc9a 100644 --- a/src/modal.c +++ b/src/modal.c @@ -205,7 +205,7 @@ main(int argc, char **argv) } *w++ = c; } - *w++ = 0; + while(*(--w) <= ' ') *w = 0; fclose(f); regs[':'] = argv[2]; while(rewrite())