aboutsummaryrefslogtreecommitdiff
path: root/rssd.c
blob: 1511ca6179e756b1c1a827f1789452b0c6936193 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "rssd.h"

int main(void)
{
    mrss_t *feed = malloc(sizeof(mrss_t));
    mrss_error_t err = 0;
    char url[MAX_URL_LENGTH] = "";

    while (fgets(url, MAX_URL_LENGTH, stdin) != NULL) {
        chomp(url);
        fprintf(stderr, "Processing URL: %s\n", url);
        err = mrss_parse_url(url, &feed);
        fprintf(stderr, "Error value: %u\n", err);
        fprintf(stderr, "Feed title: %s\n", feed->title);
        fprintf(stderr, "Feed description: %s\n", feed->description);
    }

    exit(EXIT_SUCCESS);
}

void chomp(char *s) {
    s[strcspn(s, "\n")] = 0;
    return;
}