summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfeed.c5
-rw-r--r--sfeed_web.c10
2 files changed, 9 insertions, 6 deletions
diff --git a/sfeed.c b/sfeed.c
index dcc4ce5..e7b7757 100644
--- a/sfeed.c
+++ b/sfeed.c
@@ -345,7 +345,7 @@ string_print(String *s)
static void
printfields(void)
{
- char timebuf[64];
+ char link[4096], timebuf[64];
time_t t;
int r;
@@ -362,7 +362,8 @@ printfields(void)
string_print(&ctx.item.title);
putchar(FieldSeparator);
/* always print absolute urls */
- printlink(ctx.item.link.data, baseurl, stdout);
+ if (absuri(ctx.item.link.data, baseurl, link, sizeof(link)) != -1)
+ fputs(link, stdout);
putchar(FieldSeparator);
string_print(&ctx.item.content);
putchar(FieldSeparator);
diff --git a/sfeed_web.c b/sfeed_web.c
index 9a96959..4e7a8d5 100644
--- a/sfeed_web.c
+++ b/sfeed_web.c
@@ -7,8 +7,8 @@
#include "util.h"
#include "xml.h"
-static unsigned int isbase = 0, islink = 0, isfeedlink = 0, found = 0;
-static char feedlink[4096] = "", basehref[4096] = "", feedtype[256] = "";
+static unsigned int isbase, islink, isfeedlink, found;
+static char abslink[4096], feedlink[4096], basehref[4096], feedtype[256];
static void
printfeedtype(const char *s, FILE *fp)
@@ -46,7 +46,8 @@ xmltagstartparsed(XMLParser *p, const char *tag, size_t taglen, int isshort)
printfeedtype(feedtype, stdout);
putchar(' ');
}
- printlink(feedlink, basehref, stdout);
+ if(absuri(feedlink, basehref, abslink, sizeof(abslink)) != -1)
+ fputs(abslink, stdout);
putchar('\n');
found++;
}
@@ -74,8 +75,9 @@ xmlattr(XMLParser *p, const char *tag, size_t taglen, const char *name,
isfeedlink = 1;
strlcpy(feedtype, value, sizeof(feedtype));
}
- } else if(!strncasecmp(name, "href", namelen))
+ } else if(!strncasecmp(name, "href", namelen)) {
strlcpy(feedlink, value, sizeof(feedlink));
+ }
}
}