Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
|
|
This will detect write errors sooner.
|
|
|
|
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 stylesheet is for sfeed_frames and sfeed_html.
|
|
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
|
|
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.
|
|
|
|
|
|
Maybe this is out-of-scope for the sfeed documentation though.
|
|
|
|
|
|
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.
|
|
... if it is set of course.
|
|
No functional difference intended.
|
|
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.
|
|
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.
|
|
|
|
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.
|
|
|
|
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).
|
|
There is only one enclosure supported.
|
|
|
|
|
|
Because the tty (/dev/tty). is reopened when reading feed data from stdin.
|
|
|
|
This replaces the current J and K keybind, which was rarely useful.
Thanks to IanJ for the suggestion and feedback!
|
|
|
|
|
|
|
|
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.
|
|
SIGTERM is the best way to quit the program, because SIGINT can cancel only the
line editor prompt when using it.
|
|
|
|
|
|
Specified in RFC2822 Section 3.3. Date and Time Specification
"[...] the time-of-day MUST be in the range 00:00:00 through 23:59:60 (the
number of seconds allowing for a leap second; see [STD12]) [...]"
To test:
<entry><updated>2016-12-31T23:59:60Z</updated></entry>
|
|
Also tested on MIPS32BE which has 32-bit time_t and which wraps the time value.
|
|
|
|
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
|
|
|
|
|