dead assignments, reported by clang analyzer
dead increments, reported by clang analyzer
dead initializations, reported by clang analyzer
Remove not used #defines
Replace tty.sh with tty.c

It just replaced IF(x) with #if defined(X) do something; #endif /* X */, etc.
Remove comment about being generated from script