From owner-svn-src-head@freebsd.org Tue Apr 4 13:06:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BBC4D2DE18; Tue, 4 Apr 2017 13:06:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3598FDE1; Tue, 4 Apr 2017 13:05:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 262243CDEA7; Tue, 4 Apr 2017 23:05:51 +1000 (AEST) Date: Tue, 4 Apr 2017 23:05:51 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andrey Chernov cc: Ed Maste , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r316477 - head/usr.bin/grep In-Reply-To: <4ceb1a18-3a72-c0e3-b2e2-f71d687cd153@freebsd.org> Message-ID: <20170404222532.X2274@besplex.bde.org> References: <201704032316.v33NGpbo037305@repo.freebsd.org> <4ceb1a18-3a72-c0e3-b2e2-f71d687cd153@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=AYLBJzfG c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=8pif782wAAAA:8 a=jjjBKoQsI9oc35qS1gEA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Apr 2017 13:06:00 -0000 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