summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-03-29sfeed.1: add an example to convert to UTF-8 using iconvHiltjo Posthuma
2022-03-29compatibility: reduce the assumption the builtin libc locale is ASCII-compatibleHiltjo Posthuma
This is not clearly defined by the C99 standard. Define ctype-like macros to force it to be ASCII / UTF-8 (not extended ASCII or something like noticed on OpenBSD 3.8). (In practise modern libc libraries are all ASCII and UTF-8-compatible. Otherwise this would break many programs)
2022-03-28compatibility: replace iscntrl with own ISCNTRL macroHiltjo Posthuma
It is unspecified if the C locale iscntrl is compatible with ASCII or not. Noticed when testing on OpenBSD 3.8 which uses extended ASCII and also uses the C1 range for control-characters. This breaks support with UTF-8. Reference: https://en.wikipedia.org/wiki/C0_and_C1_control_codes#C1_control_codes_for_general_use C1 table. Force an own definition of an ASCII-compatible control-character range since sfeed expects input to be UTF-8 (or converted from iconv) and so output to be UTF-8 aswell.
2022-03-28sfeed_curses: fix-up from previous commit: properly initialize struct sigactionHiltjo Posthuma
2022-03-28sfeed_curses: ignore SIGCHLD only for non-interactive programsHiltjo Posthuma
This is a regression from the introduced change. Else wait(&status) returned -1 and status was uninitialized. The status of the returned program in the markread() function is used to visually show it as read/unread. If the program failed it is assumed the program could not mark it and so it is visually unchanged. Just to be sure also initialize status to -1 (which can never happen normally) since the exitstatus range is 0-255. https://man.openbsd.org/wait#ERRORS [ECHILD]: "No status from the terminated child process is available because the calling process has asked the system to discard such status by ignoring the signal SIGCHLD or setting the flag SA_NOCLDWAIT for that signal."
2022-03-28sfeed_update: change return to exit in mainHiltjo Posthuma
Pedantic change: Make main more consistent since other functions in it exit too and main is not supposed to return or used like that.
2022-03-28update documentation of sfeed_update example and clarify return statusHiltjo Posthuma
Change the example to reload the feeds anyway, even if one of the feeds (temporarily) failed to update.
2022-03-27sfeed_curses: remove unneeded ctype.h includeHiltjo Posthuma
2022-03-27Revert "rm sys/types.h include and improve portability"Hiltjo Posthuma
This reverts commit db1dcafd03997127f2cbc82376e2cc8df9b77356. This is needed. Tested on an (old) Slackware 11 install.
2022-03-27sfeed_curses: tiny rewording in commentHiltjo Posthuma
2022-03-27sfeed_curses: processexit: do not set and reset SIGINT for non-interactive ↵Hiltjo Posthuma
plumbing Only set/override it in the interactive case. Also add some comments. No functional change intended.
2022-03-27sfeed_curses: avoid non-interactive plumb process becoming a zombieHiltjo Posthuma
From POSIX: Consequences of Process Termination: https://pubs.opengroup.org/onlinepubs/9699919799/functions/_Exit.html#tag_16_01_03_01 " [XSI] [Option Start] If the parent process of the calling process has set its SA_NOCLDWAIT flag or has set the action for the SIGCHLD signal to SIG_IGN: The process' status information (see Status Information), if any, shall be discarded. The lifetime of the calling process shall end immediately. If SA_NOCLDWAIT is set, it is implementation-defined whether a SIGCHLD signal is sent to the parent process. If a thread in the parent process of the calling process is blocked in wait(), waitpid(), or waitid(), and the parent process has no remaining child processes in the set of waited-for children, the wait(), waitid(), or waitpid() function shall fail and set errno to [ECHILD]. " Noticed on Linux (but not on OpenBSD). To reproduce: - SFEED_PLUMBER_INTERACTIVE=0 SFEED_PLUMBER="less" sfeed_curses ~/.sfeed/feeds/* - Then open and close the child program. - Notice it becoming a zombie or "<defunct>" in the process table.
2022-03-25rm sys/types.h include and improve portabilityHiltjo Posthuma
This include is not needed. It was intended for ssize_t but this is already defined by stdio.h for getline().
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.