From 05b0eb217dbec0d94b3faf064dfef2253fff3393 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 12 Nov 2018 22:37:15 -0500 Subject: Use typedefs uint and byte --- bin/hnel.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bin/hnel.c') diff --git a/bin/hnel.c b/bin/hnel.c index 50ad6bf7..64fe8226 100644 --- a/bin/hnel.c +++ b/bin/hnel.c @@ -33,6 +33,8 @@ #include #endif +typedef unsigned char byte; + static struct termios saveTerm; static void restoreTerm(void) { tcsetattr(STDIN_FILENO, TCSADRAIN, &saveTerm); @@ -43,10 +45,10 @@ int main(int argc, char *argv[]) { if (argc < 4) return EX_USAGE; - char table[256] = {0}; + byte table[256] = {0}; if (strlen(argv[1]) != strlen(argv[2])) return EX_USAGE; for (const char *from = argv[1], *to = argv[2]; *from; ++from, ++to) { - table[(unsigned)*from] = *to; + table[(byte)*from] = *to; } error = tcgetattr(STDERR_FILENO, &saveTerm); @@ -73,7 +75,7 @@ int main(int argc, char *argv[]) { bool enable = true; - char buf[4096]; + byte buf[4096]; struct pollfd fds[2] = { { .fd = STDIN_FILENO, .events = POLLIN }, { .fd = pty, .events = POLLIN }, @@ -89,7 +91,7 @@ int main(int argc, char *argv[]) { continue; } - unsigned char c = buf[0]; + byte c = buf[0]; if (enable && table[c]) buf[0] = table[c]; } -- cgit 1.4.1