Networking Forums

Networking Forums > Computer Networking > Linux Networking > tty

Reply
 
 
xzen
Guest
Posts: n/a

 
      06-12-2008, 07:32 AM
how can i write tty with color?
 
Reply With Quote
 
 
 
 
Bill Marcum
Guest
Posts: n/a

 
      06-12-2008, 01:39 PM
On 2008-06-12, xzen <(E-Mail Removed)> 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
 
Reply With Quote
 
Linonut
Guest
Posts: n/a

 
      06-13-2008, 03:10 PM
* Bill Marcum peremptorily fired off this memo:

> On 2008-06-12, xzen <(E-Mail Removed)> 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]
 
Reply With Quote
 
Lew Pitcher
Guest
Posts: n/a

 
      06-13-2008, 03:21 PM
In comp.os.linux.networking, Linonut wrote:

> * Bill Marcum peremptorily fired off this memo:
>
>> On 2008-06-12, xzen <(E-Mail Removed)> 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. ------


 
Reply With Quote
 
Linonut
Guest
Posts: n/a

 
      06-14-2008, 02:15 PM
* 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 <(E-Mail Removed)> 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)
 
Reply With Quote
 
xzen
Guest
Posts: n/a

 
      06-15-2008, 12:55 PM
thks all.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




1 2 3 4 5 6 7 8 9 10 11