@@ 79,7 79,7 @@ static int run(const char *config_path) {
curl_global_init(0);
char line[1024], email[EMAIL_BUF_SIZE];
- struct kv schemes[SCHEMES_BUF_SIZE] = {}, *current_scheme = &schemes[0];
+ struct kv schemes[SCHEMES_BUF_SIZE] = {0}, *current_scheme = &schemes[0];
CURL *const curl = init_curl_handle();
FILE *feed = NULL;
@@ 191,7 191,7 @@ static int parse_scheme(const char *restrict const buf, struct kv *restrict cons
struct span *const from = &scheme->key, *const to = &scheme->value;
from->len = delimiter - buf + 1;
- to->len = strlen(buf) - from->len + 1;
+ to->len = strlen(buf) - from->len;
if (from->len < 2 || to->len < 2) return fputs("invalid scheme", stderr), 1;
if (!(from->data = strndup(buf, from->len))) return err(ALLOC), 1;
@@ 215,6 215,7 @@ static void replace_scheme(char *restrict const buf, struct kv *restrict const s
static const char *const rfc_2822_date_format = "%a, %d %b %Y %H:%M:%S %Z";
static int process_url(const char *restrict const url, CURL *restrict const curl, FILE *restrict const html) {
+ printf("Processing url %s\n", url);
struct span feed_buf;
FILE *const feed_file = open_memstream(&feed_buf.data, &feed_buf.len);
if (!feed_file) return err(MEMSTREAM), 1;
@@ 238,13 239,8 @@ static int process_url(const char *restrict const url, CURL *restrict const curl
fprintf(html, "<h2>%s</h2>", feed->title);
mrss_item_t *item = feed->item;
- for (int i = 0; i < items_to_take; ++i, item = item->next) {
- fprintf(html,
- "<h3>%s</h3>"
- "<a href='%s'>%s</a>"
- "<p>%s</p>",
- item->title, item->link, item->link, item->description);
- }
+ for (int i = 0; i < items_to_take; ++i, item = item->next)
+ fprintf(html, "<a href='%s'><h3>%s</h3></a><p>%s</p>", item->link, item->title, item->description);
fprintf(html, "<hr>");
cleanup: