progress-bar: Add unbuffered variant
authorAdrian Vovk <adrianvovk@gmail.com>
Sat, 31 Aug 2024 02:39:17 +0000 (22:39 -0400)
committerAdrian Vovk <adrianvovk@gmail.com>
Sat, 31 Aug 2024 02:50:24 +0000 (22:50 -0400)
commit5f9dd9c64d20e7cdf8b509421e28cfebf31b7c32
treef529da57f9280a033346d3f97579059a740df262
parentca7490c5ad180614926d1d126333ec6632b31180
progress-bar: Add unbuffered variant

The progress_bar functions do their own buffering: they reconfigure
stderr, then print, then flush and disable buffering on their own. In
situations where multiple progress bars are being drawn at a time (for
example, in updatectl), it's even more efficient to hoist the buffering
and flushing to the call site, and avoid drawing each progress bar
individually.

To that end, new _unbuffered variants of the progress_bar functions. And
we use them in updatectl.
src/shared/pretty-print.c
src/shared/pretty-print.h
src/sysupdate/updatectl.c