Introduction
Introduction Statistics Contact Development Disclaimer Help
style: line-wrap some lines - saait - the most boring static page generator
git clone git://git.codemadness.org/saait
Log
Files
Refs
README
LICENSE
---
commit b3db791ebe566ca99df34a365df1f2632f2a31c8
parent 0007e983fbd257049d360f1347c4266ac9e83847
Author: Hiltjo Posthuma <[email protected]>
Date: Mon, 4 Dec 2017 23:27:04 +0100
style: line-wrap some lines
Diffstat:
M saait.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/saait.c b/saait.c
@@ -209,7 +209,9 @@ parsevars(const char *s)
s++;
continue;
}
- for (keyend = s; keyend > keystart && (keyend[-1] == ' ' || ke…
+ for (keyend = s; keyend > keystart &&
+ (keyend[-1] == ' ' || keyend[-1] == '\t');
+ keyend--)
;
/* no variable name: skip */
if (keystart == keyend)
@@ -308,7 +310,7 @@ writepage(FILE *fp, const char *filename, struct variable *…
void
usage(void)
{
- fprintf(stderr, "saait [-c config] [-o outputdir] [-t templatedir] pag…
+ fprintf(stderr, "%s [-c config] [-o outputdir] [-t templatedir] pages.…
exit(1);
}
@@ -346,9 +348,11 @@ main(int argc, char *argv[])
for (i = 0; i < LEN(templates); i++) {
for (j = 0; j < LEN(templates[i].blocks); j++) {
b = &templates[i].blocks[j];
- r = snprintf(file, sizeof(file), "%s/%s", templatedir,…
+ r = snprintf(file, sizeof(file), "%s/%s", templatedir,
+ b->name);
if (r < 0 || (size_t) r >= sizeof(file)) {
- fprintf(stderr, "path truncated: '%s/%s'\n", t…
+ fprintf(stderr, "path truncated: '%s/%s'\n",
+ templatedir, b->name);
exit(1);
}
b->data = readfile(file);
@@ -359,9 +363,11 @@ main(int argc, char *argv[])
for (i = 0; i < LEN(templates); i++) {
if (!strcmp(templates[i].name, "page"))
continue;
- r = snprintf(file, sizeof(file), "%s/%s", outputdir, templates…
+ r = snprintf(file, sizeof(file), "%s/%s", outputdir,
+ templates[i].name);
if (r < 0 || (size_t) r >= sizeof(file)) {
- fprintf(stderr, "path truncated: '%s/%s'\n", outputdir…
+ fprintf(stderr, "path truncated: '%s/%s'\n", outputdir,
+ templates[i].name);
exit(1);
}
templates[i].fp = efopen(file, "wb");
@@ -374,7 +380,8 @@ main(int argc, char *argv[])
c = readconfig(argv[i]);
if ((p = strrchr(argv[i], '.')))
- r = snprintf(htmlfile, sizeof(htmlfile), "%.*s.html", …
+ r = snprintf(htmlfile, sizeof(htmlfile), "%.*s.html",
+ (int)(p - argv[i]), argv[i]);
else
r = snprintf(htmlfile, sizeof(htmlfile), "%s.html", ar…
if (r < 0 || (size_t)r >= sizeof(htmlfile)) {
@@ -384,7 +391,8 @@ main(int argc, char *argv[])
/* set htmlfile, but allow to override it */
setvar(&c, newvar("htmlfile", htmlfile), 0);
- /* set HTML output filename (with part removed), but allow to …
+ /* set HTML output filename (with part removed), but allow to
+ override it */
if ((p = strrchr(htmlfile, '/')))
setvar(&c, newvar("filename", &htmlfile[p - htmlfile +…
else
@@ -397,9 +405,11 @@ main(int argc, char *argv[])
for (j = 0; j < LEN(templates); j++) {
/* TODO: page is a special case for now */
if (!strcmp(templates[j].name, "page")) {
- r = snprintf(outputfile, sizeof(outputfile), "…
+ r = snprintf(outputfile, sizeof(outputfile), "…
+ outputdir, v->value);
if (r < 0 || (size_t)r >= sizeof(outputfile)) {
- fprintf(stderr, "path truncated: '%s/%…
+ fprintf(stderr, "path truncated: '%s/%…
+ outputdir, v->value);
exit(1);
}
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.