groff
[Top][All Lists]
Advanced

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

Re: [Groff] preserve ascii escape characters from input


From: Ralph Corderoy
Subject: Re: [Groff] preserve ascii escape characters from input
Date: Sat, 27 Feb 2010 12:25:31 +0000

Hi Leonardo,

> Hey, thanks for the contact.  That's an interesting observation.  I'm
> curious -- what sort of terminal support ANSI-like attributes (color,
> bold etc.) but not the ANSI escape sequences? I.e. if I output ANSI
> directly, I'm running the risk of breaking what?

Keith's answered that already, but others include the Lear Siegler
family of ADM terminals.  I used to use the ADM3a and ADM11.

    $ for t in xterm adm1178; do
    >    (TERM=$t; tput rev; tput bold) | hd
    > done
    00000000  1b 5b 37 6d 1b 5b 31 6d             |.[7m.[1m|
    00000008
    00000000  1b 47 34 1b 28                      |.G4.(|
    00000005
    $ 

> > It's horrible when commands hard-code ANSI escape sequences, e.g.
> > the otherwise good dstat(1).
> 
> I think it's pretty common these days, though.  I took a quick peek
> and ls, grep, colordiff and git all hard-code ANSI.

ls(1) looks at LS_COLORS environment variable, possibly set up by
dircolors(1).  I can easily have ls output non-ANSI escape codes.

    $ LS_COLORS='lc=<lc>:rc=<rc>:no=<normal>:di=<dir>:fi=<file>' \
    > ls -d /etc /etc/passwd
    <lc><normal><rc><lc><dir><rc>/etc<lc><normal><rc>  
<lc><file><rc>/etc/passwd<lc><normal><rc>
    <lc><rc>$ 

ls and grep also only use colour if I request it.  I don't think a man
page should output ANSI codes without regard for whether everything
downstream can cope.

Cheers,
Ralph.





reply via email to

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