Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bold text in UNIX and Windows

12 views
Skip to first unread message

Walter Usyk

unread,
Nov 2, 2001, 10:19:56 PM11/2/01
to
I was wondering if it is possible to do output the following line of
text with some bold words inside of the text output. I need to do this
in UNIX and Windows:

I would like to display the following :

28-Nov.16:04 DBUZULOI branch type "dbuzuloi_ott.20" (locked)

If anyone is familiar, this is the way ClearCase does it for their
command output.

I tried using the ANSIColor package but it only works in UNIX and in
Windows NT I got fuuny looking results like this:

F:\Downloads\Perl>perl color.pl
?[31mDanger, Will Robinson!
?[0mThis is just normal text.
?[1mDo you hurt yet?
?[0m?[31;40mvenom lack
?[31;43mkill that fellow
?[32;46;5mgarish!
?[0m?[31;40mvenom lack
?[0m?[31;43mkill that fellow
?[0m?[32;46;5mgarish!
?[0m?[1;34mThis text is bold blue.
?[0mThis text is normal.
?[33;45mYellow on magenta.
?[0mThis text is normal.
?[33;45mYellow on magenta.
?[0m

Thanks for your help

--
Walter Usyk - Tools Developer
Software Development Environment Tools (1P67)
email: wu...@nortelnetworks.com
ESN: 398-4603
Tel: (613) 768-4603

R. A. Larsen

unread,
Nov 3, 2001, 1:28:08 PM11/3/01
to
Walter Usyk <us...@home.com> wrote:
>
> I was wondering if it is possible to do output the following line of
> text with some bold words inside of the text output. I need to do this
> in UNIX and Windows:
>
> I would like to display the following :
>
> 28-Nov.16:04 DBUZULOI branch type "dbuzuloi_ott.20" (locked)
>
> If anyone is familiar, this is the way ClearCase does it for their
> command output.
>
> I tried using the ANSIColor package but it only works in UNIX and in
> Windows NT I got fuuny looking results like this:
>
> F:\Downloads\Perl>perl color.pl
> ?[31mDanger, Will Robinson!

It looks to me like you haven't installed the ANSI.SYS device driver. I'm using
Win95 and I have the following line in C:\CONFIG.SYS :

Device=C:\Windows\Command\Ansi.sys

I don't know if ANSI.SYS exists in Windows NT.

Regards, René
--
Using Virtual Access
http://www.vamail.com

Clinton A. Pierce

unread,
Nov 3, 2001, 2:27:34 PM11/3/01
to
[Posted and mailed]

In article <3BE36277...@home.com>,


Walter Usyk <us...@home.com> writes:
> I was wondering if it is possible to do output the following line of
> text with some bold words inside of the text output. I need to do this
> in UNIX and Windows:

Portably? hmm. Best thing to do is assume ANSI for windows (like you're
doing). For Unix -- because there's lots and lots of terminal types --
you're going to have to interrogate the termcap database (or terminfo)
to find out the control codes to use.

Then the best thing to do would be to write wrapper functions for
everything, or store the control strings in well-known variables that
you can just print appropriately. Something like:

if ($^O =~ /Win/) {
$inverse=...... # The ANSI module's idea of inverse...
$normal=...... # The ANSI module's idea of normal...
} else {
$inverse=`tput smso`;
$normal=`tput rmso`;
}

print "This is a ${inverse}Hoot!${normal}.";

--
Clinton A. Pierce Teach Yourself Perl in 24 Hours *and*
cli...@geeksalad.org Perl Developer's Dictionary
"If you rush a Miracle Man, for details, see http://geeksalad.org
you get rotten Miracles." --Miracle Max, The Princess Bride

0 new messages