[Toybox] [PATCH] microcom: Flush after writing to stdout

Yi-Yo Chiang yochiang at google.com
Thu May 16 04:47:23 PDT 2024


Right now the output from the microcom program itself is buffered and
not shown to the user as soon as possible, resulting in strange
artifacts like:
  * Start of program "Escape character is ..." prompt is not shown until
    the user first hit the escape character.
  * "Filename: " prompt is not visible to the user.

This patch changes buffered write to stdout to unbuffered write.
Also changes the "paste file" command to be able to recover from open()
errors, so that errors like "file not found" don't crash the whole
console program:
  * Change xprintf to dprintf or xputs, so that written output is
    not unbuffered and immediately flushed.
  * If 'Esc' is pressed to cancel the "paste file" command, clear the
    "Filename:" prompt.
  * If "paste file" command gets an empty filename, clear the prompt.
    (same behavior as the previous case)
  * If "paste file" command failed to open() the file, just print the
    error text and then return. Don't crash.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240516/024511a9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-microcom-Flush-after-writing-to-stdout.patch
Type: text/x-patch
Size: 3299 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240516/024511a9/attachment.bin>


More information about the Toybox mailing list