From 96a333b11544e4120a25633d5e23e7ff5789a91e Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Wed, 9 Apr 2014 00:33:40 +0200 Subject: sfeed_web: show type of feed Signed-off-by: Hiltjo Posthuma --- sfeed_web.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sfeed_web.c b/sfeed_web.c index 17541b1..df9577b 100644 --- a/sfeed_web.c +++ b/sfeed_web.c @@ -8,7 +8,7 @@ #include "xml.h" static unsigned int isbase = 0, islink = 0, isfeedlink = 0, found = 0; -static char feedlink[4096] = "", basehref[4096] = ""; +static char feedlink[4096] = "", basehref[4096] = "", feedtype[256] = ""; static void xmltagstart(XMLParser *p, const char *tag, size_t taglen) { @@ -24,6 +24,10 @@ xmltagstart(XMLParser *p, const char *tag, size_t taglen) { static void xmltagstartparsed(XMLParser *p, const char *tag, size_t taglen, int isshort) { if(isfeedlink) { + if(*feedtype) { + fputs(feedtype, stdout); + putchar(' ' ); + } printlink(feedlink, basehref, stdout); putchar('\n'); found++; @@ -44,6 +48,7 @@ xmlattr(XMLParser *p, const char *tag, size_t taglen, const char *name, if(!strncasecmp(value, "application/atom", strlen("application/atom")) || !strncasecmp(value, "application/rss", strlen("application/rss"))) { isfeedlink = 1; + strlcpy(feedtype, value, sizeof(feedtype)); } } else if(!strncasecmp(name, "href", namelen)) strlcpy(feedlink, value, sizeof(feedlink)); -- cgit v1.2.3