From 6ed62214617c10c33370c16e981213e77be1e9ad Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Thu, 17 Jun 2021 02:05:49 -0600 Subject: [PATCH] add twtxt feed and tweak footer --- main.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 5474da6..6c62f4a 100644 --- a/main.c +++ b/main.c @@ -3,7 +3,6 @@ #include #include #include - /* Copyright (c) 2021 Derek Stevens Copyright (c) 2021 Devine Lu Linvega @@ -76,6 +75,41 @@ int findf(Lexicon* l, char* f) { return -1; } +int gettwtxt(FILE* f) { + char buf[1024] = {0}; + char line[256]; + char datebuf[16] = {0}; + char msgbuf[240] = {0}; + char* l; + FILE* twtxt = fopen(SITEROOT "twtxt.txt", "r"); + + scat(buf, "

recent activity:

"); + if (!twtxt) { + error("Get twtxt feed", "no twtxt.txt"); + return 0; + } else { + int i = 0; + while (fgets(line, 256, twtxt) && i < 3) { + l = line; + while (*l != 'T') { + ccat(datebuf, *l++); + } + while (*l != '\t') { + l++; + } + scat(msgbuf, l); + scat(buf, datebuf); + scat(buf, ": "); + scat(buf, msgbuf); + scat(buf, "
"); + i++; + } + scat(buf, "
"); + fputs(buf, f); + return 1; + } +} + void fpedited(FILE* f, char* path) { struct stat attr; stat(path, &attr); @@ -293,13 +327,26 @@ int fpfooter(FILE* f, char* name, char* path) { fputs("(keys)
", f); } fputs( - "visit the webring ", + "visit the nilFM hack lab ", f); fputs( + "visit me on Mastodon ", + f); + fputs( + "visit me on Vimeo ", + f); + fputs( + "visit the Webring
", + f); + /*fputs( "search the webring
", - f); + f);*/ fputs( "