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"
22 "<link>%s#%s</link>\n"
23 "<description>%s</description>\n",
25 "http://blerg.dominionfawesome.com/",
30 while (i < record_count) {
31 blerg_fetch(b, i, &data, &len);
32 tmp = xml_escape_data(data, len);
35 "<description>%s</description>\n"
51 int main (int argc, char *argv) {
57 request_method = getenv("REQUEST_METHOD");
58 if (request_method == NULL) {
59 fprintf(stderr, "Request method is null!?\n");
63 if (strncmp(request_method, "GET", 4) != 0) {
68 path = getenv("PATH_INFO");
79 ret = parse_url_info(path + 1, &info);
80 if ((ret & URL_INFO_AUTHOR) == 0) {
85 if (!blerg_exists(info.author)) {
90 printf("Content-type: application/rss+xml\r\n\r\n");
92 fprint_rss(stdout, "chip");