aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-03-24 18:43:54 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-03-24 18:43:54 +1300
commit767be5ca7bbf546f30fc68c4324b459c96a45a68 (patch)
tree0e891aabd01380229136ea4df318c53ecb147ba7
parent18910c31944122eab846f91779285fd9a2720733 (diff)
downloadrssd-767be5ca7bbf546f30fc68c4324b459c96a45a68.tar.gz
rssd-767be5ca7bbf546f30fc68c4324b459c96a45a68.zip
Some elementary cleanup
-rw-r--r--Makefile5
-rw-r--r--rssd.c13
-rw-r--r--rssd.h13
3 files changed, 24 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 7652fd3..e8df845 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,14 @@
.PHONY: all
+CC = clang
+CFLAGS = -std=c90 -Weverything
LDFLAGS = -lmrss
all : rssd
+rssd : rssd.c rssd.h
+ $(CC) $(CFLAGS) rssd.c $(LDFLAGS) -o rssd
+
clean :
rm -f rssd
diff --git a/rssd.c b/rssd.c
index b71e87a..1511ca6 100644
--- a/rssd.c
+++ b/rssd.c
@@ -1,9 +1,4 @@
-#include <mrss.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define MAX_URL_LENGTH 2048
+#include "rssd.h"
int main(void)
{
@@ -12,7 +7,7 @@ int main(void)
char url[MAX_URL_LENGTH] = "";
while (fgets(url, MAX_URL_LENGTH, stdin) != NULL) {
- url[strcspn(url, "\n")] = 0;
+ chomp(url);
fprintf(stderr, "Processing URL: %s\n", url);
err = mrss_parse_url(url, &feed);
fprintf(stderr, "Error value: %u\n", err);
@@ -23,3 +18,7 @@ int main(void)
exit(EXIT_SUCCESS);
}
+void chomp(char *s) {
+ s[strcspn(s, "\n")] = 0;
+ return;
+}
diff --git a/rssd.h b/rssd.h
new file mode 100644
index 0000000..9a7f082
--- /dev/null
+++ b/rssd.h
@@ -0,0 +1,13 @@
+#ifndef __RSSD_H
+#define __RSSD_H
+
+#include <mrss.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define MAX_URL_LENGTH 2048
+
+void chomp(char *);
+
+#endif