From dacb9836a038feac9f5d46a54caab99d542abbac Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sun, 14 Apr 2024 16:58:26 -0700 Subject: [PATCH] Fixed issue with trailing whitespace --- src/modal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modal.c b/src/modal.c index 15d97a2..40c35ce 100644 --- a/src/modal.c +++ b/src/modal.c @@ -132,7 +132,8 @@ write_rule(Rule *r, char last, char *res) put_reg(*b++); else *outp_++ = c, last = c; - if(last == ' ' && outp_ - origin == 0) outp_--; + if(outp_ - origin == 0) + while(*res == ' ') res++; return commit_rule(r, res, 0); } @@ -200,7 +201,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, 13 Apr 2024.\n"); + return !printf("Modal Interpreter, 14 Apr 2024.\n"); if(!(f = fopen(argv[1], "r"))) return !printf("Invalid Modal file: %s.\n", argv[1]); while(fread(&c, 1, 1, f)) {