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

Diff for /src/usr.bin/mg/ttyio.c between version 1.1 and 1.2

version 1.1, 2000/02/25 19:08:52 version 1.2, 2000/02/25 19:09:48
Line 19 
Line 19 
   
 #include        <sys/types.h>  #include        <sys/types.h>
 #include        <fcntl.h>  #include        <fcntl.h>
 #include        <termio.h>  #include        <termios.h>
   
 #define NOBUF   512                     /* Output buffer size.          */  #define NOBUF   512                     /* Output buffer size.          */
   
 char    obuf[NOBUF];                    /* Output buffer.               */  char    obuf[NOBUF];                    /* Output buffer.               */
 int     nobuf;                          /* buffer count                 */  int     nobuf;                          /* buffer count                 */
   
 static struct termio    ot;             /* entry state of the terminal  */  static struct termios   ot;             /* entry state of the terminal  */
 static struct termio    nt;             /* editor's terminal state      */  static struct termios   nt;             /* editor's terminal state      */
   
 static int ttyactivep = FALSE;          /* terminal in editor mode?     */  static int ttyactivep = FALSE;          /* terminal in editor mode?     */
 static int ttysavedp = FALSE;           /* terminal state saved?        */  static int ttysavedp = FALSE;           /* terminal state saved?        */
Line 58 
Line 58 
   
         if( !ttysavedp )          if( !ttysavedp )
         {          {
                 if (ioctl(0, TCGETA, &ot) < 0)                  if (tcgetattr(0, &ot) < 0)
                         abort();                          abort();
                 nt = ot;                /* save entry state             */                  nt = ot;                /* save entry state             */
                 nt.c_cc[VMIN] = 1;      /* one character read is OK     */                  nt.c_cc[VMIN] = 1;      /* one character read is OK     */
Line 75 
Line 75 
                 ttysavedp = TRUE;                  ttysavedp = TRUE;
         }          }
   
         if (ioctl(0, TCSETAF, &nt) < 0)          if (tcsetattr(0, TCSAFLUSH, &nt) < 0)
                 abort();                  abort();
   
         /* This really belongs in tty/termcap... */          /* This really belongs in tty/termcap... */
Line 126 
Line 126 
         if(!ttysavedp || !ttyactivep)          if(!ttysavedp || !ttyactivep)
                 return;                  return;
         ttflush();          ttflush();
         if (ioctl(0, TCSETAF, &ot) < 0 || fcntl( 0, F_SETFL, kbdflgs ) < 0)          if (tcsetattr(0, TCSAFLUSH, &ot) < 0 ||
               fcntl( 0, F_SETFL, kbdflgs ) < 0)
                 abort();                  abort();
         ttyactivep = FALSE;          ttyactivep = FALSE;
 }  }
Line 251 
Line 252 
   
 ttwait()  ttwait()
 {  {
         int alrm();  
   
         if (kbdqp)          if (kbdqp)
                 return FALSE;           /* already pending input        */                  return FALSE;           /* already pending input        */
         if (setjmp(tohere))          if (setjmp(tohere))

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2