summaryrefslogtreecommitdiff
path: root/sfeed_atom.c
AgeCommit message (Collapse)Author
2023-04-13atom, json, mbox: fix reading past the buffer with an escaped NUL byte (\ NUL)Hiltjo Posthuma
This would skip checking the end of the string of checking a NUL byte, because the iteration was done before checking it. It would proceed into the data that comes after. Note that sfeed itself can't generate such malformed data itself. Example input: 0 title link content\ html Would incorrect print "contenthtml" as the content.
2023-04-10remove sfeed "branding" in outputsHiltjo Posthuma
Technically for sfeed_atom this violates the RFC standard. There must be an author in the feed or for an item. However sfeed is not the author, it is a generator. All readers will read these feeds anyway. https://www.rfc-editor.org/rfc/rfc4287#section-4.1.1 "atom:feed elements MUST contain one or more atom:author elements, unless all of the atom:feed element's child atom:entry elements contain at least one atom:author element." *shrug*
2023-04-10sfeed_atom: in Atom the default for a type is textHiltjo Posthuma
Save a few bytes in the output by removing it. https://www.rfc-editor.org/rfc/rfc4287 3.1.1. The "type" Attribute The title is an atomTextConstruct.
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-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-20check write errors on the output stream after each feedHiltjo Posthuma
This will detect write errors sooner.
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-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.
2021-12-23sfeed_atom: add category field(s)Hiltjo Posthuma
2021-07-19code-style: change gmtime to the reentrant/thread-safe gmtime_rHiltjo Posthuma
No functional or performance difference (intended) because these programs are not threaded.
2021-06-01portability and standards: add BSD-like err() and errx() functionsHiltjo Posthuma
These are BSD functions. - HaikuOS now compiles without having to use libbsd. - Tested on SerenityOS (for fun), which doesn't have these functions (yet). With a small change to support wcwidth() sfeed works on SerenityOS.
2021-01-08sfeed_atom: code-style: use conditional with pledge, like the other toolsHiltjo Posthuma
2020-07-05sfeed_atom: minor simplification, gmtime_r is not needed hereHiltjo Posthuma
2020-07-05sfeed_atom: the updated field is mandatory: use the current time...Hiltjo Posthuma
... if it is missing/invalid.
2020-07-05sfeed_atom: fix timezone, output if timestamp is setHiltjo Posthuma
Timezone should be GMT (as intended), do not convert to localtime.
2020-06-04sfeed_atom: make the output more conformHiltjo Posthuma
- Set mandatory entry tags: id, updated. - Change entry published (optional tag) to updated (mandatory). - Add <feed> tags: author name, id, updated, title. Thanks lich for the feedback and testing.
2020-04-01util: improve/cleanup parseline()Hiltjo Posthuma
- remove a check that has no use/can never happen. - remove the return value as it's unused and the input size is known. - fix an old comment that doesn't reflect what the function does anymore.
2020-01-24cleanup some includesHiltjo Posthuma
2019-05-10remove unused variablesHiltjo Posthuma
2019-04-25sfeed_atom: add content too (for completeness)Hiltjo Posthuma
2019-04-22sfeed_atom: if the link is empty, don't print itHiltjo Posthuma
2019-04-20add sfeed_atom: convert one or more feeds from TSV (back to) AtomHiltjo Posthuma