From 6341524d8587aba6b647de9798941aa9e6db6cfc Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Tue, 30 Apr 2019 00:31:59 +0200 Subject: sfeed_frames, sfeed_html: use the same code for link handling --- sfeed_frames.c | 1 - sfeed_html.c | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sfeed_frames.c b/sfeed_frames.c index f6f679a..43ffcd3 100644 --- a/sfeed_frames.c +++ b/sfeed_frames.c @@ -61,7 +61,6 @@ printfeed(FILE *fpitems, FILE *fpin, struct feed *f) fprintf(fpitems, "%04d-%02d-%02d %02d:%02d ", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min); - if (isnew) fputs("", fpitems); if (fields[FieldLink][0]) { diff --git a/sfeed_html.c b/sfeed_html.c index 56d56bf..e337d40 100644 --- a/sfeed_html.c +++ b/sfeed_html.c @@ -21,7 +21,7 @@ printfeed(FILE *fp, struct feed *f) char *fields[FieldLast]; struct tm *tm; time_t parsedtime; - unsigned int islink, isnew; + unsigned int isnew; ssize_t linelen; if (f->name[0]) { @@ -47,8 +47,6 @@ printfeed(FILE *fp, struct feed *f) err(1, "localtime"); isnew = (parsedtime >= comparetime) ? 1 : 0; - islink = fields[FieldLink][0] ? 1 : 0; - totalnew += isnew; f->totalnew += isnew; f->total++; @@ -58,14 +56,15 @@ printfeed(FILE *fp, struct feed *f) tm->tm_hour, tm->tm_min); if (isnew) fputs("", stdout); - if (islink) { + if (fields[FieldLink][0]) { fputs("", stdout); - } - xmlencode(fields[FieldTitle], stdout); - if (islink) + xmlencode(fields[FieldTitle], stdout); fputs("", stdout); + } else { + xmlencode(fields[FieldTitle], stdout); + } if (isnew) fputs("", stdout); fputs("\n", stdout); -- cgit v1.2.3