fix: fix apple only code

This commit is contained in:
violette 2025-05-02 11:45:13 -04:00
parent e10a07c784
commit b3873798f3

7
main.c
View file

@ -325,9 +325,7 @@ printCV(char face, struct json_object_element_s *r)
void void
printAscii(struct json_value_s *json) printAscii(struct json_value_s *json)
{ {
#ifdef __APPLE__
fcntl(STDOUT_FILENO, F_SETFL, ~O_NONBLOCK); fcntl(STDOUT_FILENO, F_SETFL, ~O_NONBLOCK);
#endif
char face = chooseMainFace(); char face = chooseMainFace();
struct json_object_element_s *root = json_value_as_object(json)->start; struct json_object_element_s *root = json_value_as_object(json)->start;
printCV(face, root); printCV(face, root);
@ -335,9 +333,7 @@ printAscii(struct json_value_s *json)
for (int k = 0; k < SCREEN_WIDTH * SCREEN_HEIGHT; ++k) for (int k = 0; k < SCREEN_WIDTH * SCREEN_HEIGHT; ++k)
printf("%s", k % SCREEN_WIDTH ? chooseColor(output[k]) : "\r\n"); printf("%s", k % SCREEN_WIDTH ? chooseColor(output[k]) : "\r\n");
printf("\r\n"); printf("\r\n");
#ifdef __APPLE__
fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK); fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK);
#endif
} }
void void
@ -537,9 +533,6 @@ main()
char keyboardInput = 0; char keyboardInput = 0;
signal(SIGINT, intHandler); signal(SIGINT, intHandler);
tcgetattr(STDIN_FILENO, &originalTerm); tcgetattr(STDIN_FILENO, &originalTerm);
#ifndef __APPLE__
fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK);
#endif
struct termios t = {}; struct termios t = {};
cfmakeraw(&t); cfmakeraw(&t);