sfeed

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

commit f4b03f5a7efb846d3fa6d17ee3279ab172e66e3c
parent 1fe06563b88c072bdbad91a4966204a552a0065b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue, 30 Apr 2019 00:30:33 +0200

sfeed_gph: when a link is empty show as regular text

Diffstat:
Msfeed_gph.c | 22++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/sfeed_gph.c b/sfeed_gph.c @@ -75,14 +75,20 @@ printfeed(FILE *fpitems, FILE *fpin, struct feed *f) f->totalnew += isnew; f->total++; - fputs("[h|", fpitems); - fprintf(fpitems, "%04d-%02d-%02d %02d:%02d ", - tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min); - gphlink(fpitems, fields[FieldTitle], strlen(fields[FieldTitle])); - fputs("|URL:", fpitems); - gphlink(fpitems, fields[FieldLink], strlen(fields[FieldLink])); - fputs("|server|port]\n", fpitems); + if (fields[FieldLink][0]) { + fputs("[h|", fpitems); + fprintf(fpitems, "%04d-%02d-%02d %02d:%02d ", + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min); + gphlink(fpitems, fields[FieldTitle], strlen(fields[FieldTitle])); + fputs("|URL:", fpitems); + gphlink(fpitems, fields[FieldLink], strlen(fields[FieldLink])); + fputs("|server|port]\n", fpitems); + } else { + fprintf(fpitems, "%04d-%02d-%02d %02d:%02d %s\n", + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min, fields[FieldTitle]); + } } }