sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 02b590f6a23ab775535ab96614eb467156e8abe6
parent 1a90add12ed8ab5b8b2117fd4f079749865211e4
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu, 27 May 2021 12:32:41 +0200

sfeed_frames/sfeed_html: show the total counts and improve the title format

This title format now matches the one with sfeed_curses. It shows the count to
the most left and makes it more readable imho. It also works better when the
titlebar is small.

Diffstat:
Msfeed_frames.c | 9+++++----
Msfeed_html.c | 7++++---
2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/sfeed_frames.c b/sfeed_frames.c @@ -12,7 +12,7 @@ static struct feed *feeds; static char *line; static size_t linesize; static time_t comparetime; -static unsigned long totalnew; +static unsigned long totalnew, total; static void printfeed(FILE *fpitems, FILE *fpin, struct feed *f) @@ -54,6 +54,7 @@ printfeed(FILE *fpitems, FILE *fpin, struct feed *f) fputs(" ", fpitems); } f->total++; + total++; if (fields[FieldLink][0]) { fputs("<a href=\"", fpitems); @@ -159,9 +160,9 @@ main(int argc, char *argv[]) fputs("<!DOCTYPE html>\n<html>\n<head>\n" "\t<meta name=\"referrer\" content=\"no-referrer\" />\n" "\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n" - "\t<title>Newsfeed (", fpindex); - fprintf(fpindex, "%lu", totalnew); - fputs(")</title>\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />\n" + "\t<title>(", fpindex); + fprintf(fpindex, "%lu/%lu", totalnew, total); + fputs(") - Newsfeed</title>\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />\n" "</head>\n", fpindex); if (showsidebar) { fputs("<frameset framespacing=\"0\" cols=\"250,*\" frameborder=\"1\">\n" diff --git a/sfeed_html.c b/sfeed_html.c @@ -12,7 +12,7 @@ static struct feed *feeds; static int showsidebar; static char *line; static size_t linesize; -static unsigned long totalnew; +static unsigned long totalnew, total; static time_t comparetime; static void @@ -55,6 +55,7 @@ printfeed(FILE *fp, struct feed *f) fputs(" ", stdout); } f->total++; + total++; if (fields[FieldLink][0]) { fputs("<a href=\"", stdout); @@ -147,8 +148,8 @@ main(int argc, char *argv[]) fputs("\t\t</ul>\n\t</div>\n", stdout); } - fprintf(stdout, "\t</body>\n\t<title>Newsfeed (%lu)</title>\n</html>\n", - totalnew); + fprintf(stdout, "\t</body>\n\t<title>(%lu/%lu) - Newsfeed</title>\n</html>\n", + totalnew, total); return 0; }