saait

Simple static page generator
git clone https://git.sinitax.com/codemadness/saait
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 8b073bb76dcaad5e7029405e91918108e86f2b86
parent e75d8cfb365e36512e26cc62f6246d1dcd8500e1
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun,  5 Jan 2020 23:42:02 +0100

rename line to linenr, count from 1

Diffstat:
Msaait.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/saait.c b/saait.c @@ -218,11 +218,11 @@ parsevars(const char *file, const char *s) { struct variable *vars = NULL, *v; const char *keystart, *keyend, *valuestart, *valueend; - size_t line = 0; + size_t linenr = 1; for (; *s; ) { if (*s == '\r' || *s == '\n') { - line += (*s == '\n'); + linenr += (*s == '\n'); s++; continue; } @@ -241,7 +241,7 @@ parsevars(const char *file, const char *s) s = &s[strcspn(s, "=\r\n")]; if (*s != '=') { fprintf(stderr, "%s:%zu: error: no variable\n", - file, line + 1); + file, linenr); exit(1); } @@ -254,7 +254,7 @@ parsevars(const char *file, const char *s) /* no variable name: skip */ if (keystart == keyend) { fprintf(stderr, "%s:%zu: error: invalid variable\n", - file, line + 1); + file, linenr); exit(1); } @@ -308,7 +308,7 @@ writepage(FILE *fp, const char *name, struct variable *c, char *s) FILE *fpin; struct variable *v; char *key; - size_t keylen, line = 0; + size_t keylen, linenr = 1; int op, tmpc; for (; *s; s++) { @@ -324,7 +324,7 @@ writepage(FILE *fp, const char *name, struct variable *c, char *s) fputc(*s, fp); continue; case '\n': - line++; /* FALLTHROUGH */ + linenr++; /* FALLTHROUGH */ default: fputc(*s, fp); continue; @@ -352,7 +352,7 @@ writepage(FILE *fp, const char *name, struct variable *c, char *s) if (!v) { fprintf(stderr, "%s:%zu: error: undefined variable: '%.*s'\n", - name, line + 1, (int)keylen, key); + name, linenr, (int)keylen, key); exit(1); }