summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-03-25change echo to printf and for sfeed_opml_export use a control-character ↵Hiltjo Posthuma
separator echo is unportable in this way and names containing characters like an option (-n) or backslash or escape codes (\e, \n, etc) could be messy. For awk set LC_ALL=C for simple collation. This makes sfeed_opml_export slower in some shells that don't have printf builtin though. For example with about 150 feeds in a config file it is a bit slower on OpenBSD ksh. time ./sfeed_opml_export | wc -l 152 0m00.29s real 0m00.05s user 0m00.20s system time sfeed_opml_export | wc -l 152 0m00.02s real 0m00.00s user 0m00.03s system
2022-03-23shellscripts: use [ for test consistentlyHiltjo Posthuma
2022-03-22README: sfeed_download: remove a lineHiltjo Posthuma
2022-03-22README: improve error handling in downloader exampleHiltjo Posthuma
- Return exit code, which makes xargs return 123 when any of the downloads failed. - Write errors to stderr. - Write non-errors to stdout.
2022-03-22sfeed_update: return status in _feed() functionHiltjo Posthuma
This can be useful for scripts, for example the sfeed_update_xargs example script in the README. This way the process can signal an error and xargs will exit with the code 123: "One or more invocations of utility returned a nonzero exit status."
2022-03-21README: update sfeed_update_xargs exampleHiltjo Posthuma
Set exit status non-zero if any of the feeds failed similar to what sfeed_update also does now.
2022-03-21sfeed: make some tables const and read-onlyHiltjo Posthuma
2022-03-21sfeed_update: set exit status non-zero if any of the feeds failedHiltjo Posthuma
In practise this may change the meaning of the examples: sfeed_update && pkill -SIGHUP sfeed_curses An alternative: sfeed_update; pkill -SIGHUP sfeed_curses
2022-03-21util.h: slightly improve portabilityHiltjo Posthuma
Tested with the scc compiler which is a pure c99 compiler. sys/types.h is not needed here anymore (it was used for ssize_t). Side-note: scc can now compile the sfeed parser program! It requires these changes at the time of writing: Add a strcasecmp and strncasecmp function and use getchar instead of getchar_unlocked.
2022-03-21sfeed_update.1: document logging and improve documentation of exit statusHiltjo Posthuma
2022-03-21sfeed_update: log FAILs to stderrTommy Nguyen
2022-03-20check write errors on the output stream after each feedHiltjo Posthuma
This will detect write errors sooner.
2022-03-19rebuild sfeed_curses if the same theme changesNRK
2022-03-19sfeed_curses: refactor DEC function key parsingHiltjo Posthuma
First it expected a single digit number, but this way it makes it more easy and logical to add Sun function keys: ESC [ num z For archive/reference Sun function keys relevant to sfeed_curses: num = 214: home 216: page up 220: end 222: page down Noticed on OpenIndiana/Illumos.
2022-03-19style.css: add dark mode support for example fileHiltjo Posthuma
This stylesheet is for sfeed_frames and sfeed_html.
2022-03-15stricter error checking in file streams (input, output)Hiltjo Posthuma
This also makes the programs exit with a non-zero status when a read or write error occurs. This makes checking the exit status more reliable in scripts. A simple example to simulate a disk with no space left: curl -s 'https://codemadness.org/atom.xml' | sfeed > f /mnt/test: write failed, file system is full echo $? 0 Which now produces: curl -s 'https://codemadness.org/atom.xml' | sfeed > f /mnt/test: write failed, file system is full write error: <stdout> echo $? 1 Tested with a small mfs on OpenBSD, fstab entry: swap /mnt/test mfs rw,nodev,nosuid,-s=1M 0 0
2022-03-14sfeed_curses: use ttywrite() for writing to the tty consistentlyHiltjo Posthuma
This should also suppress a compiler warning of an unchecked write() return value.
2022-03-14improve time(NULL) error checkingHiltjo Posthuma
Use errx, time(NULL) does not set errno. For sfeed_curses reset errno so it doesn't print a random error if it failed. POSIX recommends checking against (time_t)-1 on failure. Note that some implementation, like the OpenBSD man page says time() cannot fail.
2022-03-07bump version to 1.3Hiltjo Posthuma
2022-03-07README: update codemadness.org URLs and use the full content feed by defaultHiltjo Posthuma
2022-03-05README: add a note about mouse button encoding issues in some terminalsHiltjo Posthuma
Maybe this is out-of-scope for the sfeed documentation though.
2022-02-26README: small rewordingHiltjo Posthuma
2022-02-26README: example scripts to count new and unread itemsHiltjo Posthuma
2022-02-25sfeed_curses: cast character for SFEED_AUTOCMD to unsigned charHiltjo Posthuma
Otherwise a character like \xa0 (160) would be negative and goto the event, since a negative return value in readch() is used for errors or reserved for signal handling. Noticed while testing mouse X10 encoding with extended buttons, like button 7: SFEED_AUTOCMD="l$(printf '\x1b[M\xa0!!')j" ./sfeed_curses ~/.sfeed/feeds/*
2022-02-24sfeed_curses: remove continue in application key handlingHiltjo Posthuma
On an unknown or invalid sequence just use the key handling like the other keys do.
2022-02-24sfeed_curses: fix a redraw when reloading a file when reading from stdinHiltjo Posthuma
When reading data from stdin and changing the URL file externally in some way and then pressing 'R' would not redraw (and highlight/unhighlight) the marked items.
2022-02-24sfeed_curses.1: clarify the 'R' keybind or SIGHUP will reload the url file alsoHiltjo Posthuma
... if it is set of course.
2022-02-24sfeed_mbox: use putc, it may be implemented as a macroHiltjo Posthuma
No functional difference intended.
2022-02-24sfeed_curses: die(): use stdio buffered function/macroHiltjo Posthuma
vdprintf() was changed back to vfprintf() in commit 06bb4583, but the write was not changed. Change it to be more consistent and use the stdio buffered functions/macro.
2022-02-24sfeed_curses: fix a wrong comment about the arrow left and right keysHiltjo Posthuma
Add autocmd comment.
2022-02-24sfeed_curses: add keybinds for home key and home and end key in urxvtHiltjo Posthuma
\x1b[1~ home (putty and some terminals). \x1b[7~ urxvt home. \x1b[8~ urxvt end. Refactor repeated code also.
2022-02-19fix a compiler warning with (Net)BSD cursesHiltjo Posthuma
Some curses implementations have tparm(char *) (BSD and older ncurses), some have tparm(const char *). The older POSIX specification had: tparm(char *): https://pubs.opengroup.org/onlinepubs/7908799/xcurses/term.h.html Just cast it to char *. The terminfo variables are defined elsewhere so it should be safe. Also remove an unnecesary cast in minicurses. Hopefully this satisfies all curses variants and versions now.
2022-02-19sfeed_opml_export: improve commentHiltjo Posthuma
In theory feed names can contain newlines, TABS, control-characters or start with echo options like -n. This is not recommended and not checked. URLs cannot have these characters: they should be percent-encoded. echo is typically a shell built-in and fast, so this trade-off is done.
2022-02-06bump version to 1.2Hiltjo Posthuma
2022-02-06fix a warning with tparm on some systemsHiltjo Posthuma
Older POSIX standards also defined it as a char * parameter (not const char *) for tparm(). https://pubs.opengroup.org/onlinepubs/7908799/xcurses/term.h.html
2022-02-06add compile-time option to improve output on dumb non-UTF8 terminalsHiltjo Posthuma
This makes atleast feeds with simple ASCII work.
2022-02-06sfeed_curses: write cmd in a more verbose wayHiltjo Posthuma
This fixes a compile error tested with HaikuOS 32-bit (gcc2h, based on gcc 2.95). It also suppresses a false-positive warning of an unused forkexec function in cppcheck.
2022-02-05sfeed.c: code-style consistency: static functionsHiltjo Posthuma
2022-02-05sfeed: small optimizationHiltjo Posthuma
For feeds with lots of content data: Small performance improvement (~2%) on systems that implement putchar as a macro. On some systems using a function call for putchar it can be easier to replace with putchar_unlocked. (On an older MIPS32 VM changing putchar to putchar_unlocked makes writing 5x faster).
2022-02-05sfeed_curses.1: tiny rewording from previous commitHiltjo Posthuma
There is only one enclosure supported.
2022-02-04improve some code commentsHiltjo Posthuma
2022-02-04sfeed_curses.1: document @ flagAnders Damsgaard
2022-02-01sfeed_curses.1: fix stdin -> ttyHiltjo Posthuma
Because the tty (/dev/tty). is reopened when reading feed data from stdin.
2022-02-01parsetime: no need to check `tp`. it must be setHiltjo Posthuma
2022-01-22add feature to go to the next bold row and previous bold row with J and KHiltjo Posthuma
This replaces the current J and K keybind, which was rarely useful. Thanks to IanJ for the suggestion and feedback!
2022-01-19sfeed_curses: code-style: remove variable name in definitionHiltjo Posthuma
2022-01-19sfeed_curses: fix a pedantic sign comparisonHiltjo Posthuma
2022-01-19fix inconsistencies in commentsHiltjo Posthuma
2022-01-19sfeed: extend the time range, use long long instead of time_tHiltjo Posthuma
This allows to parse the time as a number in the 64-bit range, even on 32-bit platforms. Note that the sfeed formatting tools can still truncate/wrap the value to time_t, which can be 32-bit.
2022-01-19sfeed_curses.1: clarify an exception with SIGINTHiltjo Posthuma
SIGTERM is the best way to quit the program, because SIGINT can cancel only the line editor prompt when using it.