diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2014-04-09 00:33:40 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2014-04-09 00:33:40 +0200 |
commit | 96a333b11544e4120a25633d5e23e7ff5789a91e (patch) | |
tree | 7f474b174d728b6c63dbb15f961df3df9dfb7b15 | |
parent | 59583122dcacaf5d6db1cef37c367fc5e5bae9c5 (diff) |
sfeed_web: show type of feed
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
-rw-r--r-- | sfeed_web.c | 7 |
1 files changed, 6 insertions, 1 deletions
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)); |