sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 4c35fd89e81ee83b1174dd6cfed3d6beaf25dc63
parent 3260b503e5a4c1d4ccabed0b2672e2f49c38df05
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 16 Jan 2021 00:01:09 +0100

sfeed_opml_import: minor code-style improvements

Diffstat:
Msfeed_opml_import.c | 19++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/sfeed_opml_import.c b/sfeed_opml_import.c @@ -7,7 +7,7 @@ #include "xml.h" static XMLParser parser; /* XML parser state */ -static char url[2048], text[256], title[256]; +static char text[256], title[256], xmlurl[2048]; static void printsafe(const char *s) @@ -27,7 +27,7 @@ printsafe(const char *s) static void xmltagstart(XMLParser *p, const char *t, size_t tl) { - url[0] = text[0] = title[0] = '\0'; + text[0] = title[0] = xmlurl[0] = '\0'; } static void @@ -36,8 +36,9 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort) if (strcasecmp(t, "outline")) return; - if (url[0]) { + if (xmlurl[0]) { fputs("\tfeed '", stdout); + /* prefer title over text attribute */ if (title[0]) printsafe(title); else if (text[0]) @@ -45,11 +46,11 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort) else fputs("unnamed", stdout); fputs("' '", stdout); - printsafe(url); + printsafe(xmlurl); fputs("'\n", stdout); } - url[0] = text[0] = title[0] = '\0'; + text[0] = title[0] = xmlurl[0] = '\0'; } static void @@ -59,12 +60,12 @@ xmlattr(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl, if (strcasecmp(t, "outline")) return; - if (!strcasecmp(n, "title")) - strlcat(title, v, sizeof(title)); - else if (!strcasecmp(n, "text")) + if (!strcasecmp(n, "text")) strlcat(text, v, sizeof(text)); + else if (!strcasecmp(n, "title")) + strlcat(title, v, sizeof(title)); else if (!strcasecmp(n, "xmlurl")) - strlcat(url, v, sizeof(url)); + strlcat(xmlurl, v, sizeof(xmlurl)); } static void