From owner-freebsd-questions@FreeBSD.ORG Mon Sep 22 21:57:46 2008 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 158E71065676 for ; Mon, 22 Sep 2008 21:57:46 +0000 (UTC) (envelope-from abc@ai1.anchorage.mtaonline.net) Received: from ai1.anchorage.mtaonline.net (ai1.anchorage.mtaonline.net [12.21.201.252]) by mx1.freebsd.org (Postfix) with ESMTP id 52CB88FC0C for ; Mon, 22 Sep 2008 21:57:43 +0000 (UTC) (envelope-from abc@ai1.anchorage.mtaonline.net) Received: from en26.ai1.anchorage.mtaonline.net (root@en26 [192.168.0.26]) by ai1.anchorage.mtaonline.net (8.13.1/8.13.1) with ESMTP id m8MLvini072341 for ; Mon, 22 Sep 2008 13:57:44 -0800 (AKDT) (envelope-from abc@ai1.anchorage.mtaonline.net) Received: (from abc@localhost) by en26.ai1.anchorage.mtaonline.net (8.13.1/8.13.1) id m8MLveol046801; Mon, 22 Sep 2008 21:57:40 GMT (envelope-from abc@ai1.anchorage.mtaonline.net) Date: Mon, 22 Sep 2008 21:57:40 GMT From: abc@ai1.anchorage.mtaonline.net Message-Id: <200809222157.m8MLveol046801@en26.ai1.anchorage.mtaonline.net> X-Authentication-Warning: en26.ai1.anchorage.mtaonline.net: abc set sender to abc@ai1.anchorage.mtaonline.net using -f To: "freebsd-questions" X-Mailer: Umail v2.9.7 Cc: Subject: ANSI bug? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Sep 2008 21:57:46 -0000 i am thinking there is a flaw in the ANSI code, and this program demonstrates this 'flaw'. when the 'inverse' attribute is set on the ANSI color string, the 'clear to EOL' ANSI string does so without respect to the 'inverse' attribute. for example: NORMAL Foreground=White Background=Red CLEAR-TO-EOL=Red Background. INVERSE Foreground=Red Background=White CLEAR-TO-EOL=Red Background. (it makes more sense for CLEAR-TO-EOL to make a White Background in this instance). /////////////////////////////////////////////////////////////////////////////// int main (int argc, char* argv[]) { // ESC [ [at] ; 3 [fg] ; 4 [bg] m char a[]={ 0x1b,0x5b, 0x30, 0x3b,0x33, 0x37, 0x3b,0x34, 0x31, 0x6d }; char b[]={ 0x1b,0x5b, 0x31, 0x3b,0x33, 0x37, 0x3b,0x34, 0x31, 0x6d }; char c[]={ 0x1b,0x5b, 0x37, 0x3b,0x33, 0x37, 0x3b,0x34, 0x31, 0x6d }; char d[]={ 0x1b,0x5b, 0x30, 0x3b,0x33, 0x31, 0x3b,0x34, 0x37, 0x6d }; char e[]={ 0x1b,0x5b, 0x31, 0x3b,0x33, 0x31, 0x3b,0x34, 0x37, 0x6d }; char f[]={ 0x1b,0x5b, 0x37, 0x3b,0x33, 0x31, 0x3b,0x34, 0x37, 0x6d }; char k[]={ 0x1b,0x5b,0x4b }; // clear to EOL ... char* s="0123456789"; write(STDO, a, 10); write(STDO, k, 3); write(STDO, s, 10); printf("\n"); write(STDO, b, 10); write(STDO, k, 3); write(STDO, s, 10); printf("\n"); write(STDO, c, 10); write(STDO, k, 3); write(STDO, s, 10); printf("\n"); write(STDO, d, 10); write(STDO, k, 3); write(STDO, s, 10); printf("\n"); write(STDO, e, 10); write(STDO, k, 3); write(STDO, s, 10); printf("\n"); write(STDO, f, 10); write(STDO, k, 3); write(STDO, s, 10); printf("\n"); // 'c' and 'f' do not "inverse" the "clear to EOL" ... exit(0); } ///////////////////////////////////////////////////////////////////////////////