On Monday, August 15, 2016 15:55:13 Pádraig Brady wrote: > The signal catching functionality originated trying to restore terminal > color: > http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v4.5.3-89-g854 > 9068 > > That was adjusted to only outputting reset chars once for multiple signals, > http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v5.2.1-357-geae > 1b7f > > and not outputting reset chars at arbitrary places as that messes up > multi-byte chars: > http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v5.2.1-368-gad > c30a8 > > Maybe we should just buffer internally at put_indicator > (&color_indicator[C_LEFT]); and output only at put_indicator > (&color_indicator[C_RIGHT]) or equivalent. That wouldn't introduce > significant overhead I think.
Internal buffering is certainly doable. I guess there is some gnulib module that already implements such a buffer? However, what to do with signal handling then? Drop the SA_RESTART flag and implement EINTR loop only for the fwrite() call that writes data with escape sequences to the terminal? Kamil > Pádraig
