sfeed

simple feed reader - forked from git.codemadness.org/sfeed
git clone git://src.gearsix.net/sfeed
Log | Files | Refs | Atom | README | LICENSE

commit 7bd3894befb8033ebdc252103fd0d689e655f127
parent 7e575e13c0cdcc4341fa2f0b6dcb90cb4bd3cd71
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun, 21 Jun 2015 00:25:45 +0200

improvements

Diffstat:
Msfeed.1 | 16++++++++--------
Msfeed_web.c | 12++++++++++--
Msfeedrc.example | 3+--
3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/sfeed.1 b/sfeed.1 @@ -6,16 +6,15 @@ .Nd simple RSS and Atom parser .Sh SYNOPSIS .Nm -.Op Ar suffix string | Fl Ar v +.Op Ar baseurl .Sh DESCRIPTION .Nm reads RSS or Atom feed data (XML) from stdin. It writes the feed data in a -tab-separated format to stdout. -.Sh OPTIONS -.Bl -tag -width 17n -.It Fl v -show program version -.El +tab-separated format to stdout. A +.Ar baseurl +can be specified if the links in the feed are relative urls and the baseurl of +the content differs from the feed. It is generally recommended to always have +absolute urls in your feeds, but the web sucks. .Sh TAB-SEPARATED FORMAT FIELDS The items are saved in a TSV-like format except newlines, tabs and backslash are escaped with \\ (\\n, \\t and \\\\). Carriage returns (\\r) are @@ -30,7 +29,7 @@ string, date and time in the format: YYYY-mm-dd HH:MM:SS tzname[[+-][HHMM]] .It Ar item title string .It Ar item link -string +string, made to absolute url, unsafe characters are encoded .It Ar item content string .It Ar item content\-type @@ -43,6 +42,7 @@ string string, "rss" or "atom" .El .Sh SEE ALSO +.Xr sfeed_plain 1 , .Xr sfeed_update 1 , .Xr sh 1 .Sh AUTHORS diff --git a/sfeed_web.c b/sfeed_web.c @@ -11,6 +11,15 @@ static unsigned int isbase = 0, islink = 0, isfeedlink = 0, found = 0; static char feedlink[4096] = "", basehref[4096] = "", feedtype[256] = ""; static void +printfeedtype(const char *s, FILE *fp) +{ + for(; *s; s++) { + if(!isspace((int)*s)) + fputc(*s, fp); + } +} + +static void xmltagstart(XMLParser *p, const char *tag, size_t taglen) { (void)p; @@ -34,7 +43,7 @@ xmltagstartparsed(XMLParser *p, const char *tag, size_t taglen, int isshort) if(isfeedlink) { if(*feedtype) { - printfeednameid(feedtype, stdout); + printfeedtype(feedtype, stdout); putchar(' '); } printlink(feedlink, basehref, stdout); @@ -75,7 +84,6 @@ main(int argc, char *argv[]) { XMLParser parser; - /* base href */ if(argc > 1) strlcpy(basehref, argv[1], sizeof(basehref)); diff --git a/sfeedrc.example b/sfeedrc.example @@ -1,8 +1,7 @@ # paths # NOTE: make sure to uncomment all these if you change it. #sfeedpath="$HOME/.sfeed" -#sfeedfile="$sfeedpath/feeds" -#sfeedfilenew="$sfeedfile.new" +#sfeeddir="${sfeedpath}/feeds" # list of feeds to fetch: feeds() {