summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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
2022-06-18README: add setsid exampleHiltjo Posthuma
2022-06-06themes: simplify empty macros, remove do { } while(0)Hiltjo Posthuma
Multiple function calls should still be nested in a do { } while(0), but this is hopefully obvious looking at the other lines. While testing, gcc with -O0 created the same binary. clang added a single jmp instruction.
2022-06-05sfeed_curses: processexit(): remove unneeded code for non-interactive processesHiltjo Posthuma
This was used in commit a58fa45f25da4f18d7b8c1a815884f67b965406f and previous, but the code for non-interactive process cleanup was later removed, so clearing the struct is not not needed anymore, because it is unused.
2022-05-31README: fix bug in an example for counting the new items of the last dayHiltjo Posthuma
This should not use the plain-text URL file ($SFEED_URL_FILE).
2022-05-31minicurses.h: remove unneeded includeHiltjo Posthuma
In the past there was an ioctl() call in setupterm(), so this include is not needed anymore.
2022-05-21bump version to 1.5Hiltjo Posthuma
2022-05-19README: make sure sfeed_update errors don't write to stderrHiltjo Posthuma
It would mess up the output since the progress bar writes to stderr aswell.
2022-05-14README: add progress indicator scriptHiltjo Posthuma
2022-05-14manual pages: reword a few things a bit more clearlyHiltjo Posthuma
2022-05-07sfeed_curses: improve commentHiltjo Posthuma
Do not restart the syscall waitpid, explicitly mention not setting SA_RESTART.
2022-05-07sfeed_curses: interrupt waitpid while interactive child program is runningHiltjo Posthuma
This now handles SIGTERM on sfeed_curses properly while an interactive child program is running. Test-case program: https://git.codemadness.org/sfeed_tests/commit/cd4268d4f71b5d7ab0df593d95e70188475d76bb.html
2022-05-05sfeed_curses: close stdin for spawning a plumb program in non-interactive modeHiltjo Posthuma
This is only for plumbing in non-interactive mode in forkexec(), but not piping content. Probably obvious what the descriptors are, but also add a few comments to dup2 of the file descriptors (stdin, stdout, stderr). To reproduce a behaviour: Plumb script: #!/bin/sh dmenu Then launch it: SFEED_PLUMB_INTERACTIVE=0 SFEED_PLUMB=thescript sfeed_curses ~/.sfeed/feeds/* The program now waits on input while in non-interactive mode and only seems to hang. After: The program starts but just has no input passed to it.
2022-05-04sfeed_curses.1: more details about signals and (non-)interactive programsHiltjo Posthuma
- SIGINT: reword, canceling the line editor is the exception. - Document the order of signal handling. - Document interactive and non-interactive behaviour in a separate section and in more detail. Remove repetition for each *_INTERACTIVE environment variable. - Document SIGINT and SIGTERM exit status. - Typo: "statusbar" -> "status bar". - Reword a few sentences. With additional changes and feedback from adc, thanks!
2022-05-02manual pages: properly escape some more backslashesHiltjo Posthuma
... and bump the date also.
2022-05-02manual pages: properly escape backslashesAnders Damsgaard
From the mdoc(7) extended introduction[0]: >To output a backslash, use the escape sequence ‘\e’. Never use the >escape sequence ‘\\’ in any context. 0: https://mandoc.bsd.lv/mdoc/intro/escaping.html
2022-04-10sfeed_curses.1: fix typo: automaticly -> automaticallyHiltjo Posthuma
Noticed by the Debian scanner for typos (typo-in-manual-page): https://mentors.debian.net/package/sfeed/
2022-04-02bump version to 1.4Hiltjo Posthuma
2022-04-02sfeed_curses: code-style: mouse mode: just use a constantHiltjo Posthuma
No functional change intended. Just slightly more clear.
2022-04-02sfeed_curses: line editor: handle SIGCHLD directlyHiltjo Posthuma
This makes sure when processes exit they are reaped immediately (instead of after closing the line editor).
2022-04-02sfeed_curses: line editor, temporarily disable the mouse when using the line ↵Hiltjo Posthuma
editor This allows pasting in the terminal and also doesnt spam mouse events, which are not useful here.
2022-04-01sfeed_curses: don't use bitmasks to keep the states for signalsHiltjo Posthuma
Reported by Leon Fisher, thanks! "Each signal should have its own sig_atomic_t variable if you want to keep state for all of them independently." A similar issue was referenced in a OpenBSD tech mailinglist thread: https://marc.info/?l=openbsd-tech&m=162940120614641&w=2
2022-04-01sfeed_curses: small code-style changeHiltjo Posthuma
2022-04-01README: reflect example with the descriptionHiltjo Posthuma
2022-04-01sfeed_curses: improve multiple signal handlingHiltjo Posthuma
Keep a bitmask of the received signals and handle them all. Also handle them in a particular order now.
2022-03-31sfeed_curses: improve waiting on processes and reaping themHiltjo Posthuma
- Wait on the exact process id and get its status. - Handle SIGCHLD explicitly and reap zombie children: ignoring them by using sigaction(SIGCHLD, &sa, NULL); would be racy in this case because sfeed_curses has interactive and non-interactive programs. Note while testing: if the markread program would be slow and in the meantime a plumb process would exit. This signal is now pending and is a zombie process until the SIGCHLD signal can be processed. This is fine. This also fixes a regression from commit 30a70fa2dab1925b0eaea04f67e3f86b360386dd because SIGCHLD was ignored in the parent for interactive processes aswell. This broke reading the exit status of the markread program, reproducable by plumbing an item and then trying to mark it as read (with SFEED_URL_FILE set).
2022-03-31sfeed.c: rm ctype.h its not neededHiltjo Posthuma
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