tail
Dennis Lee Bieber
wlfraed at ix.netcom.com
Mon May 9 17:05:46 EDT 2022
On Mon, 9 May 2022 21:11:23 +0200, Marco Sulla
<Marco.Sulla.Python at gmail.com> declaimed the following:
>Nevertheless, tail is a fundamental tool in *nix. It's fast and
>reliable. Also the tail command can't handle different encodings?
Based upon
https://github.com/coreutils/coreutils/blob/master/src/tail.c the ONLY
thing tail looks at is single byte "\n". It does not handle other line
endings, and appears to performs BINARY I/O, not text I/O. It does nothing
for bytes that are not "\n". Split multi-byte encodings are irrelevant
since, if it does not find enough "\n" bytes in the buffer (chunk) it reads
another binary chunk and seeks for additional "\n" bytes. Once it finds the
desired amount, it is synchronized on the byte following the "\n" (which,
for multi-byte encodings might be a NUL, but in any event, should be a safe
location for subsequent I/O).
Interpretation of encoding appears to fall to the console driver
configuration when displaying the bytes output by tail.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed at ix.netcom.com http://wlfraed.microdiversity.freeddns.org/
More information about the Python-list
mailing list