| ... | ... |
@@ -16,9 +16,11 @@ void tty_reset(tty_t *tty){
|
| 16 | 16 |
void tty_init(tty_t *tty, const char *tty_filename){
|
| 17 | 17 |
tty->fdin = open(tty_filename, O_RDONLY); |
| 18 | 18 |
tty->fout = fopen(tty_filename, "w"); |
| 19 |
- setvbuf(tty->fout, NULL, _IOFBF, 4096); |
|
| 19 |
+ if(setvbuf(tty->fout, NULL, _IOFBF, 4096)) |
|
| 20 |
+ perror("setvbuf");
|
|
| 20 | 21 |
|
| 21 |
- tcgetattr(tty->fdin, &tty->original_termios); |
|
| 22 |
+ if(tcgetattr(tty->fdin, &tty->original_termios)) |
|
| 23 |
+ perror("tcgetattr");
|
|
| 22 | 24 |
|
| 23 | 25 |
struct termios new_termios = tty->original_termios; |
| 24 | 26 |
|
| ... | ... |
@@ -29,7 +31,8 @@ void tty_init(tty_t *tty, const char *tty_filename){
|
| 29 | 31 |
*/ |
| 30 | 32 |
new_termios.c_lflag &= ~(ICANON | ECHO); |
| 31 | 33 |
|
| 32 |
- tcsetattr(tty->fdin, TCSANOW, &new_termios); |
|
| 34 |
+ if(tcsetattr(tty->fdin, TCSANOW, &new_termios)) |
|
| 35 |
+ perror("tcsetattr");
|
|
| 33 | 36 |
|
| 34 | 37 |
tty_getwinsz(tty); |
| 35 | 38 |
|