getty: code cleanup, part 1
- Avoid unnecessary use of unsigned char *
- Use explicit casts when assigning unsigned char * to char * or vice versa
- Drop unused global variables (and fix memory leak in gettable())
- Use snprintf() instead of strcpy() + strcat()
- Drop spurious braces in switch
Sponsored by: Klara, Inc.
Obtained from: Apple OSS Distributions (in part)
Differential Revision: https://reviews.freebsd.org/D37263