X-Git-Url: https://gapil.gnulinux.it/gitweb/?a=blobdiff_plain;f=listati%2FSetTermAttr.c;fp=listati%2FSetTermAttr.c;h=41656f24769cea4dbb6a1ed7c957095ccc6b1938;hb=06661f47754a536098afe2b30cb04469918f2fa3;hp=0000000000000000000000000000000000000000;hpb=bdf6e88eeb9b3aef06d57930ec8b89083639e56d;p=gapil.git diff --git a/listati/SetTermAttr.c b/listati/SetTermAttr.c new file mode 100644 index 0000000..41656f2 --- /dev/null +++ b/listati/SetTermAttr.c @@ -0,0 +1,21 @@ +#include +#include +#include + +int SetTermAttr(int fd, tcflag_t flag) +{ + struct termios values; + int res; + res = tcgetattr (desc, &values); + if (res) { + perror("Cannot get attributes"); + return res; + } + values.c_lflag |= flag; + res = tcsetattr (desc, TCSANOW, &values); + if (res) { + perror("Cannot set attributes"); + return res; + } + return 0; +}