sfeed

simple feed reader - forked from git.codemadness.org/sfeed
git clone git://src.gearsix.net/sfeed
Log | Files | Refs | Atom | README | LICENSE

commit fbe7d9926bbdafdfb42609aa614ba50a172f3150
parent a28aa0400b28a7655f39e0d2a07a7163c326f052
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun, 11 Mar 2018 18:32:43 +0100

sfeed_tail improvements

keep sfeed_tail until sfeed is reworked to support tail -f (eventually)

Diffstat:
MREADME | 1+
Msfeed_tail.c | 28++++++++++------------------
Mutil.h | 4++--
3 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/README b/README @@ -111,6 +111,7 @@ sfeed_opml_export - Generate an OPML XML file from a sfeedrc config file. sfeed_opml_import - Generate a sfeedrc config file from an OPML XML file. sfeed_mbox - Format feed data (TSV) to mbox. sfeed_plain - Format feed data (TSV) to a plain-text list. +sfeed_tail - format unseen feed data (TSV) to a plain-text list. sfeed_update - Update feeds and merge with old feeds in the directory $HOME/.sfeed/feeds by default. sfeed_web - Find urls to RSS/Atom feed from a webpage. diff --git a/sfeed_tail.c b/sfeed_tail.c @@ -1,3 +1,5 @@ +#include <sys/types.h> + #include <ctype.h> #include <err.h> #include <locale.h> @@ -107,26 +109,16 @@ printfeed(FILE *fp, const char *feedname) if (firsttime) continue; - /* output parsed line: it may not be the same as the input. */ - for (i = 0; i < FieldLast; i++) { - if (i) - putchar('\t'); - fputs(fields[i], stdout); + if (feedname[0]) { + printutf8pad(stdout, feedname, 15, ' '); + fputs(" ", stdout); } - putchar('\n'); - fflush(stdout); - -#if 0 - if (fields[FieldFeedName][0]) - printf("%-15.15s ", fields[FieldFeedName]); - else if (feedname[0]) - printf("%-15.15s ", feedname); - printf("%04d-%02d-%02d %02d:%02d ", - tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min); + + fprintf(stdout, "%04d-%02d-%02d %02d:%02d ", + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min); printutf8pad(stdout, fields[FieldTitle], 70, ' '); printf(" %s\n", fields[FieldLink]); -#endif } } @@ -168,7 +160,7 @@ main(int argc, char *argv[]) fclose(fp); } } - // DEBUG: TODO: gc first run. + /* DEBUG: TODO: gc first run. */ gc(); sleep(sleepsecs); diff --git a/util.h b/util.h @@ -31,8 +31,8 @@ struct uri { }; enum { - FieldUnixTimestamp = 0, FieldTitle, FieldLink, - FieldContent, FieldContentType, FieldId, FieldAuthor, FieldLast + FieldUnixTimestamp = 0, FieldTitle, FieldLink, FieldContent, + FieldContentType, FieldId, FieldAuthor, FieldLast }; int absuri(char *, size_t, const char *, const char *);