summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2019-04-30 00:30:33 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2019-04-30 00:30:33 +0200
commitf4b03f5a7efb846d3fa6d17ee3279ab172e66e3c (patch)
tree0ebe8f22c755f53c06df6dcf704a2aeab09cbbc1
parent1fe06563b88c072bdbad91a4966204a552a0065b (diff)
sfeed_gph: when a link is empty show as regular text
-rw-r--r--sfeed_gph.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/sfeed_gph.c b/sfeed_gph.c
index 93f610c..adfa4f8 100644
--- 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]);
+ }
}
}