From: Linonut on
* Bill Marcum peremptorily fired off this memo:

> On 2008-06-12, xzen <tianshizhiluan(a)gmail.com> wrote:
>>
>>
>> how can i write tty with color?
>
> Why do you ask this question in networking?
> In scripts, use the tput command. In C programs, use ncurses.
> man 5 terminfo

Or just add something like these escape sequences to your text output:

#define COLOR_STR_DEBUG "\x1B[01;35m>\x1B[00m"
#define COLOR_STR_INFO "\x1B[01;34m*\x1B[00m"
#define COLOR_STR_WARN "\x1B[01;32m!\x1B[00m"
#define COLOR_STR_ERROR "\x1B[01;31m?\x1B[00m"
#define COLOR_STR_END "\x1B[00m"

--
Microsoft looks at new ideas, they don't evaluate whether the idea will move
the industry forward, they ask, 'how will it help us sell more copies of
Windows?'
-- Bill Gates, The Seattle Weekly, (April 30, 1998)[2]
From: Lew Pitcher on
In comp.os.linux.networking, Linonut wrote:

> * Bill Marcum peremptorily fired off this memo:
>
>> On 2008-06-12, xzen <tianshizhiluan(a)gmail.com> wrote:
>>>
>>>
>>> how can i write tty with color?
>>
>> Why do you ask this question in networking?
>> In scripts, use the tput command. In C programs, use ncurses.
>> man 5 terminfo
>
> Or just add something like these escape sequences to your text output:

And hope to heck that your terminal emulation understands them. Better to
use the escape sequences that your terminal supports, like the ones that
the terminfo database makes available through tput

--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------


From: Linonut on
* Lew Pitcher peremptorily fired off this memo:

> In comp.os.linux.networking, Linonut wrote:
>
>> * Bill Marcum peremptorily fired off this memo:
>>
>>> On 2008-06-12, xzen <tianshizhiluan(a)gmail.com> wrote:
>>>>
>>>> how can i write tty with color?
>>>
>>> Why do you ask this question in networking?
>>> In scripts, use the tput command. In C programs, use ncurses.
>>> man 5 terminfo
>>
>> Or just add something like these escape sequences to your text output:
>
> And hope to heck that your terminal emulation understands them. Better to
> use the escape sequences that your terminal supports, like the ones that
> the terminfo database makes available through tput

Aren't VT-100 sequences pretty much the standard now? Else how would
/etc/DIR_COLORS work consistently?

Thanks for the heads up about tput, by the way. Looks like I'll be
upgrading my quick-n-dirty solution some day. I sure wish I had a wider
variety of UNIX/Windows machines to test on!

Looking at the man page for terminfo, though, it recommends using
ncurses [ color(3NCURSES) ].

Chris

--
I'm a big believer that as much as possible, and there's obviously political
limitations, freedom of migration is a good thing. -- Bill Gates, "Bill Gates
backs immigration reform on Mexico trip" Reuters (21 March 2007)
From: xzen on
thks all.