summaryrefslogtreecommitdiff
path: root/sfeed_web.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2016-02-27 16:21:30 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2016-02-27 16:21:30 +0100
commit13927fc6083c3d134e456ccfafb953c6cea17662 (patch)
treee34286bfbef190e29a49ed8a12fd5565d7e36f1a /sfeed_web.c
parentfc6c2a381742aba4deaf8538fa2c85750361a2d9 (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_web.c')
-rw-r--r--sfeed_web.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sfeed_web.c b/sfeed_web.c
index 89f0336..52f8f88 100644
--- a/sfeed_web.c
+++ b/sfeed_web.c
@@ -1,4 +1,5 @@
#include <ctype.h>
+#include <err.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -19,10 +20,9 @@ static char abslink[4096], feedlink[4096], basehref[4096], feedtype[256];
static void
printfeedtype(const char *s, FILE *fp)
{
- for (; *s; s++) {
+ for (; *s; s++)
if (!isspace((int)*s))
fputc(*s, fp);
- }
}
static void
@@ -90,6 +90,9 @@ xmlattr(XMLParser *p, const char *tag, size_t taglen, const char *name,
int
main(int argc, char *argv[])
{
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
+
if (argc > 1)
strlcpy(basehref, argv[1], sizeof(basehref));