From fdedca4e02bfcafc1cac049c98c8fa202f8d4c24 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Mon, 6 Feb 2023 01:50:56 -0800 Subject: more correct program structure --- conio.h | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'conio.h') diff --git a/conio.h b/conio.h index fa866f2..520e146 100644 --- a/conio.h +++ b/conio.h @@ -1,14 +1,6 @@ -#include -#include -#include -int getch(void) { - struct termios oldattr, newattr; - int ch; - tcgetattr(STDIN_FILENO, &oldattr); - newattr = oldattr; - newattr.c_lflag &= ~(ICANON | ECHO); - tcsetattr(STDIN_FILENO, TCSANOW, &newattr); - ch = getchar(); - tcsetattr(STDIN_FILENO, TCSANOW, &oldattr); - return ch; -} +#ifndef CONIO_H +#define CONIO_H + +int getch(void); + +#endif -- cgit v1.3.1