Versione finale del client ECHO su TCP, con esempio di uso della funzione
[gapil.git] / listati / SetTermAttr.c
1 #include <unistd.h>
2 #include <termios.h>
3 #include <errno.h>
4
5 int SetTermAttr(int fd, tcflag_t flag) 
6 {
7     struct termios values;
8     int res;
9     res = tcgetattr (desc, &values);
10     if (res) {
11         perror("Cannot get attributes");
12         return res;
13     }
14     values.c_lflag |= flag;
15     res = tcsetattr (desc, TCSANOW, &values);
16     if (res) {
17         perror("Cannot set attributes");
18         return res;
19     }
20     return 0;
21 }