Merge branch 'master' of ssh://gapil.gnulinux.it/srv/git/gapil
[gapil.git] / listati / SetTermAttr.c
1 #include <unistd.h>
2 #include <termios.h>
3 #include <errno.h>
4 int SetTermAttr(int fd, tcflag_t flag) 
5 {
6     struct termios values;
7     int res;
8     if (res = tcgetattr(desc, &values)) {
9         perror("Cannot get attributes");
10         return res;
11     }
12     values.c_lflag |= flag;
13     if (res = tcsetattr(desc, TCSANOW, &values)) {
14         perror("Cannot set attributes");
15         return res;
16     }
17     return 0;
18 }