[BACK]Return to tset.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tset

Diff for /src/usr.bin/tset/tset.c between version 1.40 and 1.41

version 1.40, 2019/03/12 11:01:25 version 1.41, 2019/06/28 13:35:05
Line 142 
Line 142 
 exit_error(void)  exit_error(void)
 {  {
     if (can_restore)      if (can_restore)
         SET_TTY(STDERR_FILENO, &original);          tcsetattr(STDERR_FILENO, TCSADRAIN, &original);
     (void) fprintf(stderr, "\n");      (void) fprintf(stderr, "\n");
     fflush(stderr);      fflush(stderr);
     ExitProgram(EXIT_FAILURE);      ExitProgram(EXIT_FAILURE);
Line 820 
Line 820 
         );          );
 #endif  #endif
   
     SET_TTY(STDERR_FILENO, &mode);      tcsetattr(STDERR_FILENO, TCSADRAIN, &mode);
 }  }
   
 /*  /*
Line 950 
Line 950 
 #ifdef TAB3  #ifdef TAB3
     if (oldmode.c_oflag & (TAB3 | ONLCR | OCRNL | ONLRET)) {      if (oldmode.c_oflag & (TAB3 | ONLCR | OCRNL | ONLRET)) {
         oldmode.c_oflag &= (TAB3 | ONLCR | OCRNL | ONLRET);          oldmode.c_oflag &= (TAB3 | ONLCR | OCRNL | ONLRET);
         SET_TTY(STDERR_FILENO, &oldmode);          tcsetattr(STDERR_FILENO, TCSADRAIN, &oldmode);
     }      }
 #endif  #endif
     settle = set_tabs();      settle = set_tabs();
Line 1209 
Line 1209 
     if (!opt_c && !opt_w)      if (!opt_c && !opt_w)
         opt_c = opt_w = TRUE;          opt_c = opt_w = TRUE;
   
     if (GET_TTY(STDERR_FILENO, &mode) < 0)      if (tcgetattr(STDERR_FILENO, &mode) < 0)
         failed("standard error");          failed("standard error");
     can_restore = TRUE;      can_restore = TRUE;
     original = oldmode = mode;      original = oldmode = mode;
Line 1234 
Line 1234 
         if (opt_w) {          if (opt_w) {
             struct winsize win;              struct winsize win;
             /* Set window size if not set already */              /* Set window size if not set already */
             (void) ioctl(STDERR_FILENO, TIOCGWINSZ, &win);              if (ioctl(STDERR_FILENO, TIOCGWINSZ, &win) == 0) {
             if (win.ws_row == 0 &&                  if (win.ws_row == 0 &&
                 win.ws_col == 0 &&                      win.ws_col == 0 &&
                 tlines > 0 && tcolumns > 0) {                      tlines > 0 && tcolumns > 0) {
                 win.ws_row = tlines;                      win.ws_row = tlines;
                 win.ws_col = tcolumns;                      win.ws_col = tcolumns;
                 (void) ioctl(STDERR_FILENO, TIOCSWINSZ, &win);                      (void) ioctl(STDERR_FILENO, TIOCSWINSZ, &win);
                   }
             }              }
         }          }
 #endif  #endif
Line 1253 
Line 1254 
   
             /* Set the modes if they've changed. */              /* Set the modes if they've changed. */
             if (memcmp(&mode, &oldmode, sizeof(mode))) {              if (memcmp(&mode, &oldmode, sizeof(mode))) {
                 SET_TTY(STDERR_FILENO, &mode);                  tcsetattr(STDERR_FILENO, TCSADRAIN, &mode);
             }              }
         }          }
     }      }

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41