Varie correzioni, completata revisione capitolo sull'I/O su file
[gapil.git] / sources / SetTermAttr.c
index d509d2665abd49dea9f48cd294e80ec46e644902..c0e79c3a0affb370bc3a0332c94e77dc5b60dd9a 100644 (file)
 #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;
@@ -52,13 +53,13 @@ int UnSetTermAttr(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;