6 #include "canned_responses.h"
9 int fprint_rss(FILE *f, const char *username) {
10 struct blerg *b = blerg_open(username);
11 uint64_t record_count = blerg_get_record_count(b);
12 uint64_t i = (record_count > 50 ? record_count - 50 : 0);
18 "<?xml version=\"1.0\" encoding=\"utf8\">\n"
19 "<rss version=\"2.0\">\n"
21 "<title>%s's blërg</title>\n"
23 "<description>%s</description>\n",
25 "http://blerg.dominionfawesome.com/",
29 while (i < record_count) {
30 blerg_fetch(b, i, &data, &len);
31 tmp = xml_escape_data(data, len);
34 "<description>%s</description>\n"
50 int main (int argc, char *argv) {
56 request_method = getenv("REQUEST_METHOD");
57 if (request_method == NULL) {
58 fprintf(stderr, "Request method is null!?\n");
62 if (strncmp(request_method, "GET", 4) != 0) {
67 path = getenv("PATH_INFO");
78 ret = parse_url_info(path + 1, &info);
79 if ((ret & URL_INFO_AUTHOR) == 0) {
84 if (!blerg_exists(info.author)) {
89 printf("Content-type: application/rss+xml\r\n\r\n");
91 fprint_rss(stdout, "chip");