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

Re: ESC[4m does not produce underline



Le 01/03/2013 20:35, Thomas D. Dean a écrit :
The ANSI standard lists ESC[4m as the code to produce an underline

> export TERM=ansi80x25
> printf "\033[4masdfasdfasdf"

produces green text, not underline text as stated in the standard.

If I put the same in c code, it works

#include <stdio.h>
int main() {
fputs("\033[4masdfasdf",stdout);
return 0;
}

I get underlined text.

Why?

Tom Dean



I think you get it wrong. Setting TERM=ansi80x25 does not says that Esc-codes should behave as specified in ANSI.

It tells to applications that your terminal does indeed use this specification and that if they want to do color/underline/whatever they should look the code in the terminfo database for this terminal. But if your hardware/software is not an ANSI terminal or emulation, you won't get the ANSI behaviour. That's why the tput way is better because it gets the right code in terminfo. That's it provided that your TERM variable is the correct one for your terminal.


Reply to: