diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2016-02-27 16:21:30 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2016-02-27 16:21:30 +0100 |
commit | 13927fc6083c3d134e456ccfafb953c6cea17662 (patch) | |
tree | e34286bfbef190e29a49ed8a12fd5565d7e36f1a /sfeed_frames.c | |
parent | fc6c2a381742aba4deaf8538fa2c85750361a2d9 (diff) |
various improvements
- pledge tools and add define to enable it on platforms that support it, currently
only OpenBSD 5.9+
- separate getline and parseline functionality.
- use murmur3 hash instead of jenkins1: faster and less collisions.
- make some error messages a bit more clear, for example with path truncation.
- some small cleanups, move printutf8pad to util.
Diffstat (limited to 'sfeed_frames.c')
-rw-r--r-- | sfeed_frames.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sfeed_frames.c b/sfeed_frames.c index 57efdf3..8674678 100644 --- a/sfeed_frames.c +++ b/sfeed_frames.c @@ -138,13 +138,15 @@ printfeed(FILE *fpitems, FILE *fpin, struct feed *f) } fputs("<table cellpadding=\"0\" cellspacing=\"0\">\n", fpitems); - while (parseline(&line, &linesize, fields, fpin) > 0) { + while (getline(&line, &linesize, fpin) > 0) { + if (!parseline(line, fields)) + break; /* write content */ if (!(namelen = normalizepath(fields[FieldTitle], name, sizeof(name)))) continue; r = snprintf(filepath, sizeof(filepath), "%s/%s.html", dirpath, name); if (r == -1 || (size_t)r >= sizeof(filepath)) - errx(1, "snprintf: path truncation"); + errx(1, "snprintf: path truncation: '%s/%s.html'", dirpath, name); /* content file doesn't exist yet and has write access */ if (access(filepath, F_OK) != 0) { @@ -215,6 +217,9 @@ main(int argc, char *argv[]) int i; struct feed *f; + if (pledge("stdio rpath wpath cpath", NULL) == -1) + err(1, "pledge"); + if (!(feeds = calloc(argc, sizeof(struct feed *)))) err(1, "calloc"); |