summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2019-04-30 00:31:59 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2019-04-30 00:31:59 +0200
commit6341524d8587aba6b647de9798941aa9e6db6cfc (patch)
tree3b92e4e5b0f6fab4a86a20bd78d01927c05d8289
parentf4b03f5a7efb846d3fa6d17ee3279ab172e66e3c (diff)
sfeed_frames, sfeed_html: use the same code for link handling
-rw-r--r--sfeed_frames.c1
-rw-r--r--sfeed_html.c13
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&nbsp;%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
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("<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);