summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-05-14sfeed_curses.c: make struct urls static like the other variablesHiltjo Posthuma
2023-05-14xml.h: _XML_H_: macro name with an underscore is a reserved identifierHiltjo Posthuma
Found with clang -Wreserved-macro-identifier See also: https://wiki.sei.cmu.edu/confluence/display/c/DCL37-C.+Do+not+declare+or+define+a+reserved+identifier
2023-05-07iterate on previous commit which adds $SFEED_NEW_MAX_SECSHiltjo Posthuma
Separate the common pattern to get the time to compare new items in format tools to the new util function: getcomparetime(). Some changes and notes: - Change it so it is OK to set this value to 0 or negative (in the future). - sfeed_curses: truncating newmaxsecs to an int would limit the value too much. - Just use strtotime() and parse the value to time_t. This is a signed long (32-bit, until 2038) or signed long long (64-bit) on most platforms. - sfeed_curses gets the comparison time on reload aswell and it needs errno = 0, because it uses die(). time() is not guaranteed to set an errno if it fails. - Rename environment variable to $SFEED_NEW_AGE.
2023-05-07sfeed: datetounix: code-style, change , to separate lines (-Wcomma)Hiltjo Posthuma
2023-05-07sfeed_{curses,frames,gopher,html,plain}: SFEED_NEW_MAX_SECSAlvar Penning
By introducing the new environment variable $SFEED_NEW_MAX_SECS in all sfeed_* utilities marking feeds as new based on comparing their age, it is now possible to override this age limit. This allows, for example, to be notified about new feeds within the last hour with SFEED_NEW_MAX_SECS=3600 sfeed_plain ~/.sfeed/feeds/* while creating a beautiful web report for last week's news by SFEED_NEW_MAX_SECS=604800 sfeed_html ~/.sfeed/feeds/*
2023-04-23bump version to 1.8Hiltjo Posthuma
2023-04-14use errno ENOMEM instead of EOVERFLOWHiltjo Posthuma
This matches the behaviour of setting errno for malloc/calloc on the following systems too: glibc, musl libc, OpenBSD libc. It is also more portable for (older) systems.
2023-04-14slightly reduce stack size for entitiesHiltjo Posthuma
A numeric entity could be 5 bytes, so use a round number of 8 bytes.
2023-04-13atom, json, mbox: fix reading past the buffer with an escaped NUL byte (\ NUL)Hiltjo Posthuma
This would skip checking the end of the string of checking a NUL byte, because the iteration was done before checking it. It would proceed into the data that comes after. Note that sfeed itself can't generate such malformed data itself. Example input: 0 title link content\ html Would incorrect print "contenthtml" as the content.
2023-04-12fix some typosHiltjo Posthuma
2023-04-10sfeed_json: add JSON output format toolHiltjo Posthuma
This outputs the TSV data to JSON. It uses a subset of JSON Feed 1.1: https://www.jsonfeed.org/version/1.1/
2023-04-10sfeed.c: slightly reduce stack size for entitiesHiltjo Posthuma
A numeric entity could be 5 bytes, so use a round number of 8 bytes. No other change intended and no performance difference noticed.
2023-04-10remove sfeed "branding" in outputsHiltjo Posthuma
Technically for sfeed_atom this violates the RFC standard. There must be an author in the feed or for an item. However sfeed is not the author, it is a generator. All readers will read these feeds anyway. https://www.rfc-editor.org/rfc/rfc4287#section-4.1.1 "atom:feed elements MUST contain one or more atom:author elements, unless all of the atom:feed element's child atom:entry elements contain at least one atom:author element." *shrug*
2023-04-10sfeed_atom: in Atom the default for a type is textHiltjo Posthuma
Save a few bytes in the output by removing it. https://www.rfc-editor.org/rfc/rfc4287 3.1.1. The "type" Attribute The title is an atomTextConstruct.
2023-04-07sfeed.c: datetounix: add commentsHiltjo Posthuma
2023-04-06README: sfeed_download: change youtube-dl to yt-dlpHiltjo Posthuma
This is an active maintained fork.
2023-04-06README: improve error checking for temporary files in examplesHiltjo Posthuma
Similar to the recent fix for sfeed_update in commit 5a27c58675ddf4113d64a84f715cb3fecb681a6d
2023-04-06README: fix typo JSONfeed -> JSON FeedHiltjo Posthuma
https://www.jsonfeed.org/version/1.1/
2023-04-05sfeed_update: fail early if creating a temporary directory or status file failsHiltjo Posthuma
If creating a temporary directory for the feed files failed then $sfeedtmpdir would be empty and it would try to: mkdir -p "/feed" touch "/feed/ok" After failing it would also still try to process all the feeds. Now just fail early. mktemp or touch themselve will print the actual error to stderr.
2023-03-26sfeed.c: parsetime improve parsing RFC2822 obsolete short yearHiltjo Posthuma
https://datatracker.ietf.org/doc/html/rfc2822#section-4.3 "Where a two or three digit year occurs in a date, the year is to be interpreted as follows: If a two digit year is encountered whose value is between 00 and 49, the year is interpreted by adding 2000, ending up with a value between 2000 and 2049. If a two digit year is encountered with a value between 50 and 99, or any three digit year is encountered, the year is interpreted by adding 1900." Improvement on commit 7086670e4335714e1df982bf1058082b7400b653 For example (output from TZ=UTC sfeed_plain): input: Sun, 26 Jul 049 19:26:34 was: 2049-07-26 19:26 now: 1949-07-26 19:26 (because this is a 3-digit year) input: Sun, 26 Jul 1 19:26:34 was: 2001-07-26 19:26 now: 0001-07-26 19:26 (because this is a 1-digit year and doesn't match the short year rule) input: Sun, 26 Jul 001 19:26:34 was: 2001-07-26 19:26 now: 1901-07-26 19:26 (because this is a 3 digit year) These cases are all added to the tests in the sfeed_tests repo (times.xml file).
2023-03-26sfeed.c: datetounix: simplify calculation and make it slightly easier to readHiltjo Posthuma
This also fixes a calculation (possibly a compiler bug) with Open Watcom 1.9.
2023-03-26README: add Open Watcom as a tested compilerHiltjo Posthuma
Tested sfeed, sfeed_plain and sfeed_html for now. There are minor changes required for sfeed and some additional compatibility function changes required to make the format tools compile. Rough list of changes required: - xml.c: rename getchar_unlocked -> getchar - sfeed.c: EOVERFLOW -> ENOMEM - wcwidth: just filter ASCII range < 32 = -1 and > 127 = 0, rest = 1. - getline - localtime_r -> just do a localtime + memcpy. Make sure to increase stack size when compiling: owcc -k32768 -Os -s -o sfeed.exe sfeed.c util.c xml.c Resulting .exe binary is 27KB, 17KB compressed with UPX. The HTML output looks fine in Netscape Navigator and Internet Explorer 3 :)
2023-03-26sfeed.c: datetounix: fix incorrect int type to longHiltjo Posthuma
Found while testing sfeed on MS-DOS with Open Watcom (for fun :)). There an int is 16-bit and sfeed incorrectly wrapped the value, which produced incorrect parsed UNIX timestamps as output.
2023-03-14Makefile: remove duplicate CPPFLAGS for sfeed_cursesHiltjo Posthuma
2023-03-07sfeed_curses: fix (very hard to trigger) memleak when getline() returns EOF ↵Hiltjo Posthuma
for lazyloaded items Fix the code pattern of freeing the line when getline returns -1 but no error flag is set on the stream (such as EOF). Note that on errors (even ENOMEM: out-of-memory) an error flag is set on the stream and the process would exit and clean up all it's resources. This would be very hard to trigger. The following conditions would have to be true: * Lazyloading of items is enabled: SFEED_LAZYLOAD=1 is set. * Items of the feed are read and their offsets stored. * The line is read/lazy-loaded again by it's offset but returns EOF (not a read error) this time. This could maybe happen if the feed file was changed and made smaller while sfeed_curses is running and the remembered offset is now beyond the file. Note that the sfeed_curses(1) man page describes a workaround for a similar condition by sending SIGHUP if the sfeed(5) data was changed to reload the feed file. References: * https://man.openbsd.org/getline "It is the responsibility of the caller to free(3) *lineptr when it is no longer needed. Even when it fails, getdelim() may update *lineptr." * https://pubs.opengroup.org/onlinepubs/9699919799/functions/getline.html
2023-02-25bump version to 1.7Hiltjo Posthuma
2023-02-17sfeed_update, sfeed_opml_export, README: reference the example sfeedrc man pageHiltjo Posthuma
... and some small rewording.
2023-02-16sfeed_curses: add SUN keys supportHiltjo Posthuma
This fixes the keys on the sun-color console on OpenIndiana/Illumos/OpenSolaris (and other systems using these keys). See also the table: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html Section "Non-Function Keys".
2023-02-16sfeed_curses: add SCO keys for next, prior (CSI I and CSI G)Hiltjo Posthuma
This fixes the page up and page down keys in the cons25 console on DragonFlyBSD. See also the table: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html Section "Non-Function Keys".
2023-02-16README: small rewording in how to add new parsed tags and fieldsHiltjo Posthuma
2023-02-04README: describe how to add new parsed tags and fields to sfeed.cHiltjo Posthuma
2023-02-04fix comment for ASCII symbols for dumb terminalsHiltjo Posthuma
This was a copy-pasta.
2023-02-04sfeed_gopher: remove PATH_MAX and restricting the path lengthHiltjo Posthuma
This make it also cleanly compile without any other changes on GNU/Hurd. Reference: https://www.gnu.org/software/hurd/hurd/porting/guidelines.html Section: "PATH_MAX, MAX_PATH, MAXPATHLEN, _POSIX_PATH_MAX" The fopen() functions will return NULL when the path is too long and set errno = ENAMETOOLONG. "The length of a pathname exceeds {PATH_MAX}, or pathname resolution of a symbolic link produced an intermediate result with a length that exceeds {PATH_MAX}." Reference: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html
2023-01-18sfeedrc.5: improve documentation a bitHiltjo Posthuma
- Fix a typo "Url" -> "URL". - Be a bit more clear some overridable functions read from stdin. - Some small rewording.
2023-01-07sfeed.1: reference sfeed_opml_importHiltjo Posthuma
It is used in the examples. (Do not directly reference iconv to keep some kind of clear reference list)
2023-01-07sfeed.5: remove a caveat in the file format man pageHiltjo Posthuma
It is a caveat while parsing the data in the sfeed(1) program. Keep it described in the sfeed(1) man page.
2022-12-28README: small rewording "can be supported" -> "are supported"Hiltjo Posthuma
2022-12-20LICENSE: bump yearHiltjo Posthuma
2022-12-20sfeed_curses.1: small rewording and tweaks in the exampleHiltjo Posthuma
2022-12-15sfeed_update.1: "return status" -> "exit status"Hiltjo Posthuma
2022-08-26improve comment: uppercase cdata -> CDATAHiltjo Posthuma
2022-08-17bump version to 1.6Hiltjo Posthuma
2022-08-17sfeed_curses: fix a memleak caused by a mistake in refactoring the codeHiltjo Posthuma
Introduced by a code cleanup/refactor in commit 59ba2ed29bcbe67de6e9ee1e7fb18744f7490c22
2022-07-20slightly improve some commentsHiltjo Posthuma
2022-07-17sfeed_curses: cleanup code for handling read items from an URL fileHiltjo Posthuma
This makes it easier to reuse the code from reading plain-text list of items from a file and uses a struct urls to keep its state in a cleaner way. + some small code-style improvements and reshuffling. Inspired by a question from NRK by mail about implementing a "read later" feature. (A quick local experiment shows it can be done in ~70 lines of added code).
2022-07-05remove __dead codeNRK
this check is already done in util.h and is no longer needed after the `sfeed_curses -> sfeed` merge.
2022-07-05sfeed_curses: write out plumbercmd argument in a verbose mannerHiltjo Posthuma
Write it in a more verbose, clear and C90-style manner. This workarounds a bug in scc too (reported upstream and will be fixed of course). All tools in sfeed can now be compiled with minicurses-mode with the scc compiler and musl libc without any modifications needed. scc: http://www.simple-cc.org/
2022-06-21fix some typisNRK
found via codespell $ codespell --ignore-regex Nd
2022-06-20sfeed: reword a poorly-worded commentHiltjo Posthuma
2022-06-20sfeed: fix a wrong commentHiltjo Posthuma