#include <unistd.h> /* unix standard library */
#include <termios.h> /* terminals constants, types and functions */
#include <errno.h> /* error definitions and routines */
+#include <stdio.h> /* standard I/O library */
int SetTermAttr(int fd, tcflag_t flag)
{
struct termios values;
int res;
- res = tcgetattr (desc, &values);
+ res = tcgetattr (fd, &values);
if (res) {
perror("Cannot get attributes");
return res;
}
values.c_lflag |= flag;
- res = tcsetattr (desc, TCSANOW, &values);
+ res = tcsetattr (fd, TCSANOW, &values);
if (res) {
perror("Cannot set attributes");
return res;
struct termios values;
int res;
- res = tcgetattr (desc, &values);
+ res = tcgetattr (fd, &values);
if (res) {
perror("Cannot get attributes");
return res;
}
values.c_lflag &= (~flag);
- res = tcsetattr (desc, TCSANOW, &values);
+ res = tcsetattr (fd, TCSANOW, &values);
if (res) {
perror("Cannot set attributes");
return res;