bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Translate or remove escape codes from stream


From: Jeff Barnes
Subject: Translate or remove escape codes from stream
Date: Mon, 6 Jun 2011 13:59:55 -0700 (PDT)

A couple of weeks ago, the Bug-ncurses list provided very helpful tips for 
capturing the stderr output from a library and printw'ing it to a WINDOW *.

Some of what I'm getting in the WINDOW * includes stuff like the following:

0:00:10.491677352 ^[[333m18212^[[00m  0x80efa30 ^[[32;01mINFO   ^[[00m 
^[[00;01;37;41m GST_ELEMENT_FACTORY 
gstelementfactory.c:403:gst_element_factory_create:^[[00m creating element 
"pipeline"

0:00:10.494354913 ^[[333m18212^[[00m  0x80efa30 ^[[32;01mINFO   ^[[00m 
^[[00;01;36m  GST_PLUGIN_LOADING gstplugin.c:660:gst_plugin_load_file:^[[00m 
plugin "/opt/fsmd/lib/gstreamer-0.10/libgstneonhttpsrc.so" loaded

...

Ewwwwww

>From gst-launch, the output looks great! Nice colors. No escape codes. But 
>from my program, well, I'd like to have human readable text. What would be 
>really great is if there were a quick and easy fix to translate the escape 
>codes to their ncurses attributes counterparts. But I'd bet that the escape 
>codes are different from terminal to terminal and the GST_DEBUG output uses 
>terminfo and such to figure out what the escape codes are.

If I can't translate the escape codes in a strait-forward way, the second best 
option would be to just remove them from the string that goes to the window.

Anybody know of code examples to do either?

Thanks in advance.

Jeff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]