still that annoing setterm

Rob Landley rob at landley.net
Wed Sep 7 04:45:17 UTC 2005


On Tuesday 06 September 2005 20:57, Lord Sidiuz wrote:

> > and the last line of your #if case is the same as
> > the entire body of your #else case.  (And that's
> > not even getting into the if(ENABLE_)
> > infrastructure it seems I'm still debugging...)
>
> ????

Each of the CONFIG_THINGY options (which are checked with #ifdef or #ifndef) 
now have an ENABLE_THINGY defined as well (which is always defined, as 0 or 
1), which can be used in normal if(ENABLE_THINGY) tests that get optimized 
out by the compiler when it's set to 0.  This way you can use normal C code 
rather than preprocessor directives to handle configuration symbols.

You can also go "#if ENABLE_THINGY" in place of an #ifdef, so you can use the 
one symbol everywhere.

Unfortunately, gcc's preprocessor isn't smart enough to chop out static 
functions that never get called, so you still need to #if those out.

> > So all this does is save an ansi escape sequence
> > in a variable?
> > Rob.
>
> yes, simple and effective ha ?

True, but the original setterm does more than this.  (And not just redoing 
terminal screen blanking, which is also just another funky escape sequence 
sent to the kernel, but resetting the default color so that when you esc[0m 
you get the new default color back...)

Strangely, that only seems to work on linux kernel controlled text termals and 
not on konsole, so probably it's not important...

> happy coding .

You too,

Rob



More information about the busybox mailing list