summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2013-06-14 15:21:41 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2013-06-14 15:21:41 +0200
commit4e6799026291a9fd2627c060b00c128d3bbce405 (patch)
treead38ed6f5d2d3c4573ff012f3abb1b6c9dda58e5
parent77fcaf37692e5a7845e83d7cc437764d4dce4417 (diff)
sfeed_opml_import: format code, wordwrap
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
-rw-r--r--sfeed_opml_import.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/sfeed_opml_import.c b/sfeed_opml_import.c
index 187d030..dfa0f1f 100644
--- a/sfeed_opml_import.c
+++ b/sfeed_opml_import.c
@@ -29,15 +29,19 @@ xml_handler_start_element(XMLParser *p, const char *tag, size_t taglen) {
}
void
-xml_handler_end_element(XMLParser *p, const char *tag, size_t taglen, int isshort) {
+xml_handler_end_element(XMLParser *p, const char *tag, size_t taglen,
+ int isshort) {
if(istag(tag, "outline")) {
- printf("\tfeed \"%s\" \"%s\" \"%s\"\n", feedname[0] ? feedname : "unnamed",
- feedurl[0] ? feedurl : "", basesiteurl[0] ? basesiteurl : "");
+ printf("\tfeed \"%s\" \"%s\" \"%s\"\n",
+ feedname[0] ? feedname : "unnamed",
+ feedurl[0] ? feedurl : "",
+ basesiteurl[0] ? basesiteurl : "");
}
}
void
-xml_handler_attr(XMLParser *p, const char *tag, size_t taglen, const char *name, size_t namelen, const char *value, size_t valuelen) {
+xml_handler_attr(XMLParser *p, const char *tag, size_t taglen,
+ const char *name, size_t namelen, const char *value, size_t valuelen) {
if(istag(tag, "outline")) {
if(isattr(name, "text") || isattr(name, "title"))
strncpy(feedname, value, sizeof(feedname) - 1);
@@ -55,18 +59,17 @@ main(void) {
parser.xmltagstart = xml_handler_start_element;
parser.xmltagend = xml_handler_end_element;
parser.xmlattr = xml_handler_attr;
- parser.fp = stdin;
fputs(
- "# paths\n"
- "# NOTE: make sure to uncomment all these if you change it.\n"
- "#sfeedpath=\"$HOME/.sfeed\"\n"
- "#sfeedfile=\"$sfeedpath/feeds\"\n"
- "#sfeedfilenew=\"$sfeedfile.new\"\n"
- "\n"
- "# list of feeds to fetch:\n"
- "feeds() {\n"
- " # feed <name> <feedurl> <basesiteurl> [encoding]\n", stdout);
+ "# paths\n"
+ "# NOTE: make sure to uncomment all these if you change it.\n"
+ "#sfeedpath=\"$HOME/.sfeed\"\n"
+ "#sfeedfile=\"$sfeedpath/feeds\"\n"
+ "#sfeedfilenew=\"$sfeedfile.new\"\n"
+ "\n"
+ "# list of feeds to fetch:\n"
+ "feeds() {\n"
+ " # feed <name> <feedurl> <basesiteurl> [encoding]\n", stdout);
xmlparser_parse(&parser);
fputs("}\n", stdout);
return EXIT_SUCCESS;