Hello community, here is the log from the commit of package rsstail for openSUSE:Factory checked in at 2018-01-23 13:53:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rsstail (Old) and /work/SRC/openSUSE:Factory/.rsstail.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rsstail" Tue Jan 23 13:53:19 2018 rev:3 rq:568428 version:2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rsstail/rsstail.changes 2017-03-28 15:22:54.223774755 +0200 +++ /work/SRC/openSUSE:Factory/.rsstail.new/rsstail.changes 2018-01-23 13:53:20.392631809 +0100 @@ -1,0 +2,7 @@ +Sun Dec 24 09:59:40 UTC 2017 - sebix+novell....@sebix.at + +- run spec-cleaner +- update to version 2.1 + * No changelog was made available. + +------------------------------------------------------------------- Old: ---- rsstail-1.8.tgz New: ---- rsstail-2.1.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rsstail.spec ++++++ --- /var/tmp/diff_new_pack.uIF8za/_old 2018-01-23 13:53:21.068600231 +0100 +++ /var/tmp/diff_new_pack.uIF8za/_new 2018-01-23 13:53:21.072600044 +0100 @@ -1,7 +1,7 @@ # # spec file for package rsstail # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: rsstail -Version: 1.8 +Version: 2.1 Release: 0 Summary: RSS Feed Reader License: GPL-2.0 @@ -26,9 +26,9 @@ Source: http://www.vanheusden.com/rsstail/rsstail-%{version}.tgz BuildRequires: gcc BuildRequires: glibc-devel +BuildRequires: libiconv_hook-devel BuildRequires: libmrss-devel >= 0.16 BuildRequires: make -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description RSSTail is more or less an RSS reader: it monitors an RSS feed and if it @@ -38,15 +38,15 @@ %setup -q %build -make DEBUG="-g %{optflags}" CC="gcc" +make %{?_smp_mflags} DEBUG="-g %{optflags}" CC="gcc" %install install -D -m 0755 rsstail %{buildroot}%{_bindir}/rsstail install -D -m 0644 -t %{buildroot}%{_mandir}/man1 rsstail.1 %files -%defattr(-,root,root) -%doc readme.txt +%doc README.md +%license license.txt %{_bindir}/rsstail %{_mandir}/man1/rsstail.1* ++++++ rsstail-1.8.tgz -> rsstail-2.1.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsstail-1.8/Makefile new/rsstail-2.1/Makefile --- old/rsstail-1.8/Makefile 2011-09-26 20:11:37.000000000 +0200 +++ new/rsstail-2.1/Makefile 2015-10-14 16:25:18.000000000 +0200 @@ -1,21 +1,28 @@ -VERSION=1.8 +VERSION=2.1 DEBUG=-g -LDFLAGS=-lmrss $(DEBUG) -CFLAGS=-O2 -Wall -DVERSION=\"$(VERSION)\" $(DEBUG) +LDFLAGS=-liconv_hook -lmrss $(DEBUG) +CFLAGS=-O3 -Wall -DVERSION=\"$(VERSION)\" $(DEBUG) OBJS=r2t.o +prefix ?= /usr/local +bindir ?= $(prefix)/bin +mandir ?= $(prefix)/share/man/man1 + all: rsstail rsstail: $(OBJS) $(CC) -Wall -W $(OBJS) $(LDFLAGS) -o rsstail - # - # Oh, blatant plug: http://keetweej.vanheusden.com/wishlist.html install: rsstail - cp rsstail $(DESTDIR)/usr/bin - cp rsstail.1 $(DESTDIR)/usr/share/man/man1/ + mkdir -p $(bindir) + mkdir -p $(mandir) + install rsstail $(bindir) + install -m 644 rsstail.1 $(mandir) + +uninstall: + rm $(bindir)/rsstail $(mandir)/rsstail.1 clean: rm -f $(OBJS) core rsstail @@ -24,6 +31,9 @@ # source package rm -rf rsstail-$(VERSION)* mkdir rsstail-$(VERSION) - cp *.c *.1 Makefile* readme.txt license.* rsstail-$(VERSION) + cp *.c *.1 Makefile* README.md license.* rsstail-$(VERSION) tar cf - rsstail-$(VERSION) | gzip -9 > rsstail-$(VERSION).tgz rm -rf rsstail-$(VERSION) + +check: + cppcheck -v --enable=all --std=c++11 --inconclusive -I. . 2> err.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsstail-1.8/README.md new/rsstail-2.1/README.md --- old/rsstail-1.8/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/rsstail-2.1/README.md 2015-10-14 16:25:18.000000000 +0200 @@ -0,0 +1,58 @@ +rsstail +======= +rsstail is tail for RSS feeds + + +## Usage + +Basic usage: + rsstail -u URL -i CHECK_INTERVAL + +For example a command below will check every 5 minutes if anything new was published: + +$ rsstail -u http://www.filmhuisgouda.nl/rss/rss.php -i 300 +Title: Que horas ela volta? +Title: 45 years +Title: Madame Bovary +... + +rsstail -h + will show a list of what rsstail can do for you. + +## Installation + +On Debian/Ubuntu: + sudo apt-get install rsstail + + +## Building + +### Dependencies + +rsstail depends on [`libmrss`](http://www.autistici.org/bakunin/codes.php#libmrss) (version >= 0.7). +On Debian/Ubuntu you can install libmrss by running + sudo apt-get install libmrss0 + +To compile source code you may need to run + sudo apt-get install libmrss0-dev + + +### Compile source code + +$ git clone https://github.com/flok99/rsstail.git +$ cd rsstail +$ sudo make install + + +## Contact + +For everything more or less related to rsstail, please feel free to contact me on m...@vanheusden.com. + +Consider using PGP. My PGP key-id is: 0x1f28d8ae + + +## Donations + +[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=flok&url=https://github.com/flok99/rsstail&title=rsstail&language=&tags=github&category=software) + +[![Support the development of this project](https://pledgie.com/campaigns/28612.png?skin_name=chrome)](https://pledgie.com/campaigns/28612) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsstail-1.8/r2t.c new/rsstail-2.1/r2t.c --- old/rsstail-1.8/r2t.c 2011-09-26 20:11:37.000000000 +0200 +++ new/rsstail-2.1/r2t.c 2015-10-14 16:25:18.000000000 +0200 @@ -5,8 +5,13 @@ #include <time.h> #include <errno.h> #include <mrss.h> +#include <langinfo.h> +#include <locale.h> +#include <iconv.h> -void replace(char *in, char *what, char by_what) +const char name[] = "rsstail " VERSION ", (C) 2006-2015 by folk...@vanheusden.com"; + +void replace(char *const in, const char *const what, char by_what) { int what_len = strlen(what); @@ -22,7 +27,7 @@ } } -char *remove_html_tags(char *in) +char *remove_html_tags(const char *const in) { char *copy = strdup(in); @@ -97,37 +102,62 @@ void version(void) { - printf("rsstail v" VERSION ", (C) 2005-2007 by folk...@vanheusden.com\n\n"); + printf("%s\n", name); +} + +char* my_convert(iconv_t converter, const char *input) +{ + size_t in_size = strlen(input); + size_t out_size = (in_size + 1) * 6; // seems to be enough + + char *output_start = (char *)calloc(1, out_size), *output = output_start; + if (!output_start) + return NULL; + + do + { + size_t converted = iconv(converter, (char **) &input, &in_size, &output, &out_size); + + if (converted == (size_t) -1) + { + free (output_start); + return NULL; + } + } + while(in_size); + + return output_start; } void usage(void) { version(); - printf("-t show timestamp\n"); - printf("-l show link\n"); - printf("-d show description\n"); - printf("-p show publication date\n"); - printf("-a show author\n"); - printf("-c show comments\n"); - printf("-N do not show headings\n"); + printf("-t show timestamp\n"); + printf("-l show link\n"); + printf("-d show description\n"); + printf("-p show publication date\n"); + printf("-a show author\n"); + printf("-c show comments\n"); + printf("-g show guid\n"); + printf("-N do not show headings\n"); printf("-b x limit description/comments to x bytes\n"); - printf("-z continue even if there are XML parser errors in the RSS feed\n"); - printf("-Z x add heading 'x'\n"); + printf("-z continue even if there are XML parser errors in the RSS feed\n"); + printf("-Z x add heading 'x'\n"); printf("-n x initially show x items\n"); - printf("-r reverse output, so it looks more like an RSS feed\n"); - printf("-H strip HTML tags\n"); -/* printf("-o x only show items newer then x[s/M/h/d/m/y]\n"); */ - printf("-A x authenticate against webserver, x is in format username:password\n"); + printf("-r reverse output, so it looks more like an RSS feed\n"); + printf("-H strip HTML tags\n"); + /* printf("-o x only show items newer then x[s/M/h/d/m/y]\n"); */ + printf("-A x authenticate against webserver, x is in format username:password\n"); printf("-u url URL of RSS feed to tail\n"); printf("-i x check interval in seconds (default is 15min)\n"); printf("-x x proxy server to use (host[:port])\n"); printf("-y x proxy authorization (user:password)\n"); - printf("-P do not exit when an error occurs\n"); - printf("-1 one shot\n"); - printf("-v be verbose (add more to be more verbose)\n"); - printf("-V show version and exit\n"); - printf("-h this help\n"); + printf("-P do not exit when an error occurs\n"); + printf("-1 one shot\n"); + printf("-v be verbose (add more to be more verbose)\n"); + printf("-V show version and exit\n"); + printf("-h this help\n"); } int main(int argc, char *argv[]) @@ -137,27 +167,27 @@ int check_interval = 15 * 60; mrss_t **data_prev = NULL; mrss_t **data_cur = NULL; - int data_size; char *proxy = NULL, *proxy_auth = NULL; - int sw; + int sw = 0; int verbose = 0; - char show_timestamp = 0, show_link = 0, show_description = 0, show_pubdate = 0, show_author = 0, show_comments = 0; + char show_timestamp = 0, show_link = 0, show_description = 0, show_pubdate = 0, show_author = 0, show_comments = 0, show_guid = 0; char strip_html = 0, no_error_exit = 0; char one_shot = 0; char no_heading = 0; int bytes_limit = 0; time_t last_changed = (time_t)0; - char continue_on_error = 0, dummy; + char continue_on_error = 0; int show_n = -1; - long int max_age = -1; char *heading = NULL; mrss_options_t mot; char *auth = NULL; + char *current_encoding = NULL; char reverse = 0; + iconv_t converter = 0; memset(&mot, 0x00, sizeof(mot)); - while((sw = getopt(argc, argv, "A:Z:1b:PHztldrpacu:Ni:n:x:y:vVh")) != -1) + while((sw = getopt(argc, argv, "A:Z:1b:PHztldrpacgu:Ni:n:x:y:vVh")) != -1) { switch(sw) { @@ -266,6 +296,10 @@ show_comments = 1; break; + case 'g': + show_guid = 1; + break; + case 'u': url = (char **)realloc(url, sizeof(char *) * (n_url + 1)); if (!url) @@ -273,7 +307,9 @@ fprintf(stderr, "Cannot allocate memory\n"); return 2; } + url[n_url++] = optarg; + break; case 'i': @@ -283,7 +319,7 @@ case 'x': proxy = optarg; break; - + case 'y': proxy_auth = optarg; break; @@ -304,9 +340,9 @@ } mot.timeout = check_interval; - mot.proxy = proxy; + mot.proxy = proxy; mot.proxy_authentication = proxy_auth; - mot.user_agent = "rsstail " VERSION ", (C) 2006-2010 by folk...@vanheusden.com"; + mot.user_agent = (char *)name; mot.authentication = auth; if (n_url == 0) @@ -315,25 +351,28 @@ return 1; } - data_size = sizeof(mrss_t *) * n_url; - data_prev = (mrss_t **)malloc(data_size); - data_cur = (mrss_t **)malloc(data_size); + data_prev = (mrss_t **)calloc(n_url, sizeof(mrss_t *)); + data_cur = (mrss_t **)calloc(n_url, sizeof(mrss_t *)); if (!data_prev || !data_cur) { fprintf(stderr, "Cannot allocate memory\n"); return 2; } - memset(data_prev, 0x00, data_size); - memset(data_cur , 0x00, data_size); + setlocale(LC_ALL, ""); + current_encoding = nl_langinfo(CODESET); if (verbose) { int loop; + printf("Monitoring RSS feeds:\n"); + for(loop=0; loop<n_url; loop++) printf("\t%s\n", url[loop]); + printf("Check interval: %d\n", check_interval); + printf("Output current_encoding: %s\n", current_encoding); } for(;;) @@ -348,7 +387,7 @@ if (verbose) printf("Retrieving RSS feed '%s'...\n", url[cur_url]); - if ((err_read = mrss_get_last_modified(url[cur_url], &cur_last_changed)) != MRSS_OK) + if ((err_read = mrss_get_last_modified_with_options(url[cur_url], &cur_last_changed, &mot)) != MRSS_OK) { if (err_read == MRSS_ERR_POSIX) { @@ -363,20 +402,20 @@ if (no_error_exit) goto goto_next_url; - else - return 2; + + return 2; } if (cur_last_changed == last_changed && cur_last_changed != 0) { if (verbose) printf("Feed did not change since last check.\n"); + goto goto_next_url; } - else if (verbose > 2) - { + + if (verbose > 2) printf("Feed change detected, %s", ctime(&cur_last_changed)); - } last_changed = cur_last_changed; @@ -397,30 +436,53 @@ } fprintf(stderr, "Error reading RSS feed: %s\n", mrss_strerror(err_read)); + if (no_error_exit) goto goto_next_url; - else - return 2; + + return 2; + } + + if (data_cur[cur_url]->encoding == NULL) + data_cur[cur_url]->encoding = strdup("utf-8"); + + if (verbose) + printf("Creating converter %s -> %s\n", data_cur[cur_url] -> encoding, current_encoding); + + converter = iconv_open(current_encoding, data_cur[cur_url] -> encoding); + + if (converter == (iconv_t) -1) + { + fprintf(stderr, "Error creating converter: %s \n", strerror(errno)); + return 2; } item_cur = data_cur[cur_url] -> item; - if (reverse) { + if (reverse) + { if (verbose) - printf("Reversing...\n"); + printf("Reversing...\n"); + mrss_item_t *rev_item_cur = NULL; mrss_item_t *rev_item_last = NULL; - for (;;) { - rev_item_last = rev_item_cur; - rev_item_cur = item_cur; - if (item_cur -> next) { - item_cur = item_cur -> next; - rev_item_cur -> next = rev_item_last; - } - else { - rev_item_cur -> next = rev_item_last; - break; - } + + for (;;) + { + rev_item_last = rev_item_cur; + rev_item_cur = item_cur; + + if (!item_cur) + break; + + if (!item_cur -> next) + { + rev_item_cur -> next = rev_item_last; + break; + } + + item_cur = item_cur -> next; + rev_item_cur -> next = rev_item_last; } } @@ -428,22 +490,17 @@ while(item_cur) { - if ((data_prev[cur_url] && is_new_record(first_item[cur_url], item_cur) != -1) || - (!data_prev[cur_url])) + if ((data_prev[cur_url] && is_new_record(first_item[cur_url], item_cur) != -1) || !data_prev[cur_url]) { -#if 0 - if (/* pubdate */ < max_age && max_age != -1) - continue; -#endif - - if ((!data_prev[cur_url]) && n_shown >= show_n && show_n != -1) + if (!data_prev[cur_url] && n_shown >= show_n && show_n != -1) { item_cur = item_cur -> next; continue; } + n_shown++; - if ((show_link + show_description + show_pubdate + show_author + show_comments ) > 1) + if (show_link + show_description + show_pubdate + show_author + show_comments > 1) printf("\n"); if (show_timestamp) @@ -461,15 +518,29 @@ } if (heading) - { printf(" %s", heading); - } if (item_cur -> title != NULL) - printf("%s%s\n", no_heading?" ":"Title: ", item_cur -> title); + { + char *title = my_convert(converter, item_cur -> title); + + if (title) + { + printf("%s%s\n", no_heading?" ":"Title: ", title); + free(title); + } + } if (show_link && item_cur -> link != NULL) - printf("%s%s\n", no_heading?" ":"Link: ", item_cur -> link); + { + char *link = my_convert(converter, item_cur -> link); + + if (link) + { + printf("%s%s\n", no_heading?" ":"Link: ", item_cur -> link); + free(link); + } + } if (show_description && item_cur -> description != NULL) { @@ -480,7 +551,12 @@ if (bytes_limit != 0 && bytes_limit < strlen(stripped)) stripped[bytes_limit] = 0x00; - printf("%s%s\n", no_heading?" ":"Description: ", stripped); + char *description = my_convert(converter, stripped); + if (description) + { + printf("%s%s\n", no_heading?" ":"Description: ", description); + free(description); + } free(stripped); } @@ -489,23 +565,42 @@ if (bytes_limit != 0 && bytes_limit < strlen(item_cur -> description)) (item_cur -> description)[bytes_limit] = 0x00; - printf("%s%s\n", no_heading?" ":"Description: ", item_cur -> description); + char *description = my_convert(converter, item_cur -> description); + if (description) + { + printf("%s%s\n", no_heading?" ":"Description: ", description); + free(description); + } } } if (show_pubdate && item_cur -> pubDate != NULL) printf("%s%s\n", no_heading?" ":"Pub.date: ", item_cur -> pubDate); - if (show_author && item_cur -> author != NULL) - printf("%s%s\n", no_heading?" ":"Author: ", item_cur -> author); + if (show_author && item_cur -> author != NULL){ + char *author = my_convert(converter, item_cur -> author); + if (author) + { + printf("%s%s\n", no_heading?" ":"Author: ", author); + free(author); + } + } if (show_comments && item_cur -> comments != NULL) { if (bytes_limit != 0 && bytes_limit < strlen(item_cur -> comments)) (item_cur -> comments)[bytes_limit] = 0x00; - printf("%s%s\n", no_heading?" ":"Comments: ", item_cur -> comments); + char *comments = my_convert(converter, item_cur -> comments); + if (comments) + { + printf("%s%s\n", no_heading?" ":"Comments: ", item_cur -> comments); + free(comments); + } } + + if (show_guid && item_cur -> guid != NULL) + printf("%s%s\n", no_heading?" ":"guid: ", item_cur -> guid); } item_cur = item_cur -> next; @@ -517,11 +612,12 @@ if (err_free != MRSS_OK) { - fprintf(stderr, "Error freeing up memory: %s\n", mrss_strerror(err_read)); + fprintf(stderr, "Error freeing up memory: %s\n", mrss_strerror(err_free)); + if (no_error_exit) goto goto_next_url; - else - return 2; + + return 2; } } @@ -530,8 +626,14 @@ first_item[cur_url] = tmp_first_item; goto_next_url: + if (converter) + { + iconv_close(converter); + converter = 0; + } + cur_url++; - if (cur_url == n_url) + if (cur_url >= n_url) cur_url = 0; fflush(stdout); @@ -541,6 +643,7 @@ if (verbose > 2) printf("Sleeping...\n"); + sleep(check_interval / n_url); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsstail-1.8/readme.txt new/rsstail-2.1/readme.txt --- old/rsstail-1.8/readme.txt 2011-09-26 20:11:37.000000000 +0200 +++ new/rsstail-2.1/readme.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -You need 'libmrss': - http://www2.autistici.org/bakunin/codes.php -at least version 0.7! - -Compile & install: -make install - -Usage: -rsstail -u url -i check_interval -e.g.: -rsstail -u http://www.filmhuisgouda.nl/rss/rss.php -i 300 -this will check every 5 minutes if anything new was published. - -Help: -rsstail -h -will show a list of what rsstail can do for you. - - -For everything more or less related to 'rsstail', please feel free -to contact me on: folk...@vanheusden.com -Consider using PGP. My PGP key-id is: 0x1f28d8ae - -Please support my opensource development: http://www.vanheusden.com/wishlist.php diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rsstail-1.8/rsstail.1 new/rsstail-2.1/rsstail.1 --- old/rsstail-1.8/rsstail.1 2011-09-26 20:11:37.000000000 +0200 +++ new/rsstail-2.1/rsstail.1 2015-10-14 16:25:18.000000000 +0200 @@ -27,6 +27,8 @@ Show author .IP "\fB\-c\fB" 10 Show comments +.IP "\fB\-g\fB" 10 +Show guid .IP "\fB\-b X\fB" 10 Where X is the limit in bytes for description/comments .IP "\fB\-z\fB" 10