stacinhtml

Static C in HTML - simple static site generator
git clone git://git.kocotian.pl/stacinhtml.git
Log | Files | Refs | README

commit 91397306f94517db054dcc6d714a79d633faf66c
parent 8a47837cf7cf1c84190969371a1a26bc5ab54c29
Author: kocotian <kocotian@kocotian.pl>
Date:   Sat, 20 Mar 2021 20:48:56 +0100

Declaration of a few variables

Diffstat:
Mgenerate.c | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/generate.c b/generate.c @@ -9,7 +9,11 @@ #include "util.h" /* Macros */ -#define $(VARNAME) getVariableName(#VARNAME) +#define $(VARNAME) getVariableValue(#VARNAME) +#define DECLVAR(VARNAME, VALUE) \ + (vs[vss].name.len = strlen(vs[vss].name.data = #VARNAME), \ + vs[vss].value.len = strlen(vs[vss].value.data = VALUE), \ + ++vss) #define BUFFER_SIZE 64 * 1024 #define VS_MAX 256 @@ -103,6 +107,10 @@ main(int argc, char *argv[]) readinput.data = input.data; readinput.len = input.len; + /* Declaring a few variables */ + DECLVAR(title, outputfn); + DECLVAR(template, templatefn == NULL ? "none" : templatefn); + /* Parsing ("preprocessing") input for variables */ if ((rb = read(inputfd, idata, BUFFER_SIZE)) < 0) die("read (input):");