svn commit: r316477 - head/usr.bin/grep
Bruce Evans
brde at optusnet.com.au
Tue Apr 4 13:06:00 UTC 2017
On Tue, 4 Apr 2017, Andrey Chernov wrote:
> On 04.04.2017 2:16, Ed Maste wrote:
>> if (color)
>> - fprintf(stdout, "\33[m\33[K");
>> + fprintf(stdout, "\33[00m\33[K");
>
> Please back that one out. We don't need to handle internally or print
> remotely excessive 00.
> At least according to
> https://en.wikipedia.org/wiki/ANSI_escape_code
> "With no parameters, CSI m is treated as CSI 0 m (reset / normal), which
> is typical of most of the ANSI escape sequences."
This might be to work around a bug in a terminal driver. I needed the
0 (but just one) to reset the attributes in my attribute tests, on at
least 1 of the tested terminals (current sc, current vt, old sc, old
xterm, old cygwin xterm). CSI m seems to be working for sc now, and the
teken code looks OK.
I first thought that this was a misplaced 0 for \033. 2 digits for
octal looks strange. I would use hex in C anyway. In my user attribute
tests, I have to use printf(1), and noticed that printf(1) is missing too
many features in printf(3), or worse, is incompatible, especially for hex
escape sequences and %c format.
Bruce
More information about the svn-src-all
mailing list