[RFC] Partial C99 cleanup of term.c

Since term.c is such a huge file with some large and hairy functions, this is a partial C99 cleanup for ease of review.