commit 6341524d8587aba6b647de9798941aa9e6db6cfc
parent f4b03f5a7efb846d3fa6d17ee3279ab172e66e3c
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 30 Apr 2019 00:31:59 +0200
sfeed_frames, sfeed_html: use the same code for link handling
Diffstat:
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git 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("<b><u>", fpitems);
if (fields[FieldLink][0]) {
diff --git 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("<b><u>", stdout);
- if (islink) {
+ if (fields[FieldLink][0]) {
fputs("<a href=\"", stdout);
xmlencode(fields[FieldLink], stdout);
fputs("\">", stdout);
- }
- xmlencode(fields[FieldTitle], stdout);
- if (islink)
+ xmlencode(fields[FieldTitle], stdout);
fputs("</a>", stdout);
+ } else {
+ xmlencode(fields[FieldTitle], stdout);
+ }
if (isnew)
fputs("</u></b>", stdout);
fputs("\n", stdout);