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

Diff for /src/usr.bin/telnet/sys_bsd.c between version 1.33 and 1.34

version 1.33, 2017/07/07 09:14:26 version 1.34, 2017/07/19 12:25:52
Line 181 
Line 181 
  */   */
   
 static void susp();  static void susp();
 #ifdef SIGINFO  
 static void ayt();  static void ayt();
 #endif  
   
 void  void
 TerminalNewMode(int f)  TerminalNewMode(int f)
Line 318 
Line 316 
   
     if (f != -1) {      if (f != -1) {
         (void) signal(SIGTSTP, susp);          (void) signal(SIGTSTP, susp);
 #ifdef  SIGINFO  
         (void) signal(SIGINFO, ayt);          (void) signal(SIGINFO, ayt);
 #endif  
 #if     defined(NOKERNINFO)  #if     defined(NOKERNINFO)
         tmp_tc.c_lflag |= NOKERNINFO;          tmp_tc.c_lflag |= NOKERNINFO;
 #endif  #endif
Line 352 
Line 348 
         }          }
     } else {      } else {
         sigset_t mask;          sigset_t mask;
 #ifdef  SIGINFO  
         (void) signal(SIGINFO, ayt_status);          (void) signal(SIGINFO, ayt_status);
 #endif  
         (void) signal(SIGTSTP, SIG_DFL);          (void) signal(SIGTSTP, SIG_DFL);
         sigemptyset(&mask);          sigemptyset(&mask);
         sigaddset(&mask, SIGTSTP);          sigaddset(&mask, SIGTSTP);
Line 368 
Line 362 
     ioctl(tout, FIONBIO, &onoff);      ioctl(tout, FIONBIO, &onoff);
 }  }
   
 /*  
  * Try to guess whether speeds are "encoded" (4.2BSD) or just numeric (4.4BSD).  
  */  
 #if B4800 != 4800  
 #define DECODE_BAUD  
 #endif  
   
 #ifdef  DECODE_BAUD  
 #ifndef B7200  
 #define B7200   B4800  
 #endif  
   
 #ifndef B14400  
 #define B14400  B9600  
 #endif  
   
 #ifndef B19200  
 # define B19200 B14400  
 #endif  
   
 #ifndef B28800  
 #define B28800  B19200  
 #endif  
   
 #ifndef B38400  
 # define B38400 B28800  
 #endif  
   
 #ifndef B57600  
 #define B57600  B38400  
 #endif  
   
 #ifndef B76800  
 #define B76800  B57600  
 #endif  
   
 #ifndef B115200  
 #define B115200 B76800  
 #endif  
   
 #ifndef B230400  
 #define B230400 B115200  
 #endif  
   
   
 /*  
  * This code assumes that the values B0, B50, B75...  
  * are in ascending order.  They do not have to be  
  * contiguous.  
  */  
 struct termspeeds {  
         long speed;  
         long value;  
 } termspeeds[] = {  
         { 0,      B0 },      { 50,    B50 },    { 75,     B75 },  
         { 110,    B110 },    { 134,   B134 },   { 150,    B150 },  
         { 200,    B200 },    { 300,   B300 },   { 600,    B600 },  
         { 1200,   B1200 },   { 1800,  B1800 },  { 2400,   B2400 },  
         { 4800,   B4800 },   { 7200,  B7200 },  { 9600,   B9600 },  
         { 14400,  B14400 },  { 19200, B19200 }, { 28800,  B28800 },  
         { 38400,  B38400 },  { 57600, B57600 }, { 115200, B115200 },  
         { 230400, B230400 }, { -1,    B230400 }  
 };  
 #endif  /* DECODE_BAUD */  
   
 void  void
 TerminalSpeeds(long *ispeed, long *ospeed)  TerminalSpeeds(long *ispeed, long *ospeed)
 {  {
 #ifdef  DECODE_BAUD  
     struct termspeeds *tp;  
 #endif  /* DECODE_BAUD */  
     long in, out;      long in, out;
   
     out = cfgetospeed(&old_tc);      out = cfgetospeed(&old_tc);
Line 446 
Line 372 
     if (in == 0)      if (in == 0)
         in = out;          in = out;
   
 #ifdef  DECODE_BAUD      *ispeed = in;
     tp = termspeeds;      *ospeed = out;
     while ((tp->speed != -1) && (tp->value < in))  
         tp++;  
     *ispeed = tp->speed;  
   
     tp = termspeeds;  
     while ((tp->speed != -1) && (tp->value < out))  
         tp++;  
     *ospeed = tp->speed;  
 #else   /* DECODE_BAUD */  
         *ispeed = in;  
         *ospeed = out;  
 #endif  /* DECODE_BAUD */  
 }  }
   
 int  int
 TerminalWindowSize(long *rows, long *cols)  TerminalWindowSize(long *rows, long *cols)
 {  {
 #ifdef  TIOCGWINSZ  
     struct winsize ws;      struct winsize ws;
   
     if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) >= 0) {      if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) >= 0) {
Line 473 
Line 386 
         *cols = ws.ws_col;          *cols = ws.ws_col;
         return 1;          return 1;
     }      }
 #endif  /* TIOCGWINSZ */  
     return 0;      return 0;
 }  }
   
Line 522 
Line 434 
         sendsusp();          sendsusp();
 }  }
   
 #ifdef  SIGWINCH  
 void  void
 sendwin(int sig)  sendwin(int sig)
 {  {
Line 530 
Line 441 
         sendnaws();          sendnaws();
     }      }
 }  }
 #endif  
   
 #ifdef  SIGINFO  
 void  void
 ayt(int sig)  ayt(int sig)
 {  {
Line 541 
Line 450 
     else      else
         ayt_status(sig);          ayt_status(sig);
 }  }
 #endif  
   
   
 void  void
Line 552 
Line 460 
     (void) signal(SIGINT, intr);      (void) signal(SIGINT, intr);
     (void) signal(SIGQUIT, intr2);      (void) signal(SIGQUIT, intr2);
     (void) signal(SIGPIPE, deadpeer);      (void) signal(SIGPIPE, deadpeer);
 #ifdef  SIGWINCH  
     (void) signal(SIGWINCH, sendwin);      (void) signal(SIGWINCH, sendwin);
 #endif  
     (void) signal(SIGTSTP, susp);      (void) signal(SIGTSTP, susp);
 #ifdef  SIGINFO  
     (void) signal(SIGINFO, ayt);      (void) signal(SIGINFO, ayt);
 #endif  
   
     setconnmode(0);      setconnmode(0);
   

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34