enabled raw mode with no echo, character input rather than line input, ignore to stop build files being pushed

This commit is contained in:
2025-12-23 16:09:03 +00:00
parent 84f3049da0
commit 455a0aaf53
4 changed files with 34 additions and 6 deletions

30
kilo.c
View File

@@ -1,8 +1,28 @@
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
int main() {
char c;
while (read(STDIN_FILENO, &c, 1) == 1)
;
return 0;
struct termios orig_termios;
void disableRawMode() {
tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}
void enableRawMode() {
tcgetattr(STDIN_FILENO, &orig_termios);
atexit(disableRawMode);
struct termios raw = orig_termios;
raw.c_lflag &= ~(ECHO);
raw.c_lflag &= ~(ICANON);
tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}
int main() {
enableRawMode();
char c;
while (read(STDIN_FILENO, &c, 1) == 1 && c != 'q');
return 0;
}