Age | Commit message (Collapse) | Author |
|
No functional change intended. Just slightly more clear.
|
|
This makes sure when processes exit they are reaped immediately (instead of
after closing the line editor).
|
|
editor
This allows pasting in the terminal and also doesnt spam mouse events, which
are not useful here.
|
|
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
|
|
|
|
Keep a bitmask of the received signals and handle them all.
Also handle them in a particular order now.
|
|
- 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).
|
|
|
|
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."
|
|
|
|
This reverts commit db1dcafd03997127f2cbc82376e2cc8df9b77356.
This is needed. Tested on an (old) Slackware 11 install.
|
|
|
|
plumbing
Only set/override it in the interactive case.
Also add some comments.
No functional change intended.
|
|
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.
|
|
This include is not needed. It was intended for ssize_t but this is already
defined by stdio.h for getline().
|
|
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.
|
|
This should also suppress a compiler warning of an unchecked write() return
value.
|
|
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.
|
|
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/*
|
|
On an unknown or invalid sequence just use the key handling like the other keys
do.
|
|
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.
|
|
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.
|
|
Add autocmd comment.
|
|
\x1b[1~ home (putty and some terminals).
\x1b[7~ urxvt home.
\x1b[8~ urxvt end.
Refactor repeated code also.
|
|
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.
|
|
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
|
|
This makes atleast feeds with simple ASCII work.
|
|
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.
|
|
|
|
This replaces the current J and K keybind, which was rarely useful.
Thanks to IanJ for the suggestion and feedback!
|
|
|
|
|
|
|
|
|
|
|
|
When a new URL file is used with no URL entries then NULL is passed to qsort()
and bsearch(). This is reported by clang UBsan as undefined behaviour
(debatable), but no issue in practise with many implementations. Fix it anyway.
To reproduce with clang UBsan:
Compile with clang or gcc with CFLAGS and LDFLAGS -fsanitize=undefined
touch /tmp/urls # new file which should be empty.
SFEED_URL_FILE=/tmp/urls sfeed_curses 2>/tmp/log
^D
q
cat /tmp/log
|
|
|
|
Import sfeed_curses into sfeed.
The files are based of the commit 8e151ce48b503ad0ff0e24cb1be3bc93d6fbd895
|