Kill most warnings in lib/DtTerm.
Mostly missing headers, explicit parentheses and new prototypes.
Some Caveats:
* I haven't compile-tested the SVR4 getpty file, it might need another tweak
* There were operator precedence bugs in TermPrimCursor.c and TermPrimRender.c
(^ vs. !=). This might change behaviour, but at least I haven't experienced
any crashes ...
* This adds a little more dependencies for include ordering, but unless we
want to play the "headers that include headers that include headers..." game,
this is unavoidable.