| 119 | } |
| 120 | |
| 121 | void cleanup() { |
| 122 | // Reset console display |
| 123 | set_display(reset); |
| 124 | |
| 125 | #if !defined(_WIN32) |
| 126 | // Restore settings on POSIX systems |
| 127 | if (!simple_io) { |
| 128 | if (tty != nullptr) { |
| 129 | out = stdout; |
| 130 | fclose(tty); |
| 131 | tty = nullptr; |
| 132 | } |
| 133 | tcsetattr(STDIN_FILENO, TCSANOW, &initial_state); |
| 134 | } |
| 135 | #endif |
| 136 | } |
| 137 | |
| 138 | // |
| 139 | // Display and IO |