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
(cherry picked from commit 8ad7a14ab49b93240676e15f404354775be931f4)
getty: code cleanup, part 2
- Clean up whitespace
- Reindent
Sponsored by: Klara, Inc.
(cherry picked from commit f285f41498ebe0bfc1dbe47d67af12ec2d131521)
getty: Avoid NULL deref if stdin is not a tty.
Sponsored by: Klara, Inc.
Obtained from: Apple OSS Distributions
Differential Revision: https://reviews.freebsd.org/D37265
(cherry picked from commit eb4d86d529e2523a19fd7454976923319954a49d)