From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6158 invoked by alias); 26 May 2007 20:19:58 -0000 Received: (qmail 6150 invoked by uid 22791); 26 May 2007 20:19:57 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 26 May 2007 20:19:55 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Hs2jr-0006sL-5D for ecos-discuss@sources.redhat.com; Sat, 26 May 2007 22:19:47 +0200 Received: from c-76-17-159-202.hsd1.mn.comcast.net ([76.17.159.202]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 26 May 2007 22:19:47 +0200 Received: from grante by c-76-17-159-202.hsd1.mn.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 26 May 2007 22:19:47 +0200 To: ecos-discuss@sources.redhat.com From: Grant Edwards Date: Sat, 26 May 2007 22:56:00 -0000 Message-ID: References: <20070526163810.GA13155@ubuntu> User-Agent: slrn/0.9.8.1 (Linux) X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Re: diag_printf refuses to print ANSI escape sequences? X-SW-Source: 2007-05/txt/msg00133.txt.bz2 On 2007-05-26, Sergei Gavrikov wrote: > On Sat, May 26, 2007 at 03:19:42PM +0000, Grant Edwards wrote: >> In the "not a big deal" department... >> >> I'm trying to send ANSI escape sequences using diag_printf, and >> diag_printf refuses. If I put the escape character in the format >> string it says >> >> > FB93FFDC> >> >> If there's an escape character in a string that is to be printed using >> the "%s" format, it says: >> >> >> >> I understand that it's useful to attempt to avoid printing random >> binary garbage, but I would think that ASCII ESC might be allowed in >> strings. >> >> I've found that insterting the escape characters using %c works, but >> that's a bit awkward. > > There are nice diag_dump_buf* functions in the eCos infra layer > (cyg/infra/diag.h). I do use that. I'm aware of the daig_dump_buf fuctions, but I don't see how they solve my problem. AFAIR, they dump out buffer contents in hex. What I'm trying to do is: diag_printf("\033[34mBlue Text \033[31mRed Text \033[mNormal Text\n"); diag_printf refuses to do that, so I have to do something like this instead: diag_printf("%c[34mBlue Text %c[31mRed Text %c[mNormal Text\n",033,033,033); and that seems awkward to me. One could argue that embedding escape seqences in strings is a bit hackish... -- Grant Edwards grante Yow! NEWARK has been at REZONED!! DES MOINES has visi.com been REZONED!! -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss