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

Diff for /src/usr.bin/tip/Attic/cmds.c between version 1.1 and 1.2

version 1.1, 1995/10/18 08:46:16 version 1.2, 1995/12/14 03:12:14
Line 1 
Line 1 
 /*      $NetBSD: cmds.c,v 1.5 1995/09/26 06:02:08 jtc Exp $     */  /*      $NetBSD: cmds.c,v 1.6 1995/10/29 00:49:38 pk Exp $      */
   
 /*  /*
  * Copyright (c) 1983, 1993   * Copyright (c) 1983, 1993
Line 37 
Line 37 
 #if 0  #if 0
 static char sccsid[] = "@(#)cmds.c      8.1 (Berkeley) 6/6/93";  static char sccsid[] = "@(#)cmds.c      8.1 (Berkeley) 6/6/93";
 #endif  #endif
 static char rcsid[] = "$NetBSD: cmds.c,v 1.5 1995/09/26 06:02:08 jtc Exp $";  static char rcsid[] = "$NetBSD: cmds.c,v 1.6 1995/10/29 00:49:38 pk Exp $";
 #endif /* not lint */  #endif /* not lint */
   
 #include "tip.h"  #include "tip.h"
Line 144 
Line 144 
         pwrite(FD, &r, 1);          pwrite(FD, &r, 1);
         do          do
                 read(FD, &c, 1);                  read(FD, &c, 1);
         while ((c&0177) != '\n');          while ((c&STRIP_PAR) != '\n');
         ioctl(0, TIOCSETC, &defchars);          tcsetattr(0, TCSAFLUSH, &defchars);
   
         (void) setjmp(intbuf);          (void) setjmp(intbuf);
         f = signal(SIGINT, intcopy);          f = signal(SIGINT, intcopy);
         start = time(0);          start = time(0);
         for (ct = 0; !quit;) {          for (ct = 0; !quit;) {
                 eof = read(FD, &c, 1) <= 0;                  eof = read(FD, &c, 1) <= 0;
                 c &= 0177;                  c &= STRIP_PAR;
                 if (quit)                  if (quit)
                         continue;                          continue;
                 if (eof || any(c, eofchars))                  if (eof || any(c, eofchars))
Line 179 
Line 179 
   
         if (boolean(value(VERBOSE)))          if (boolean(value(VERBOSE)))
                 prtime(" lines transferred in ", time(0)-start);                  prtime(" lines transferred in ", time(0)-start);
         ioctl(0, TIOCSETC, &tchars);          tcsetattr(0, TCSAFLUSH, &term);
         write(fildes[1], (char *)&ccc, 1);          write(fildes[1], (char *)&ccc, 1);
         signal(SIGINT, f);          signal(SIGINT, f);
         close(fd);          close(fd);
Line 271 
Line 271 
                 return;                  return;
         }          }
         transmit(fd, value(EOFWRITE), NULL);          transmit(fd, value(EOFWRITE), NULL);
         if (!boolean(value(ECHOCHECK))) {          if (!boolean(value(ECHOCHECK)))
                 struct sgttyb buf;                  tcdrain(FD);
   
                 ioctl(FD, TIOCGETP, &buf);      /* this does a */  
                 ioctl(FD, TIOCSETP, &buf);      /*   wflushtty */  
         }  
 }  }
   
 /*  /*
Line 295 
Line 291 
         kill(pid, SIGIOT);      /* put TIPOUT into a wait state */          kill(pid, SIGIOT);      /* put TIPOUT into a wait state */
         stop = 0;          stop = 0;
         f = signal(SIGINT, stopsnd);          f = signal(SIGINT, stopsnd);
         ioctl(0, TIOCSETC, &defchars);          tcsetattr(0, TCSAFLUSH, &defchars);
         read(repdes[0], (char *)&ccc, 1);          read(repdes[0], (char *)&ccc, 1);
         if (command != NULL) {          if (command != NULL) {
                 for (pc = command; *pc; pc++)                  for (pc = command; *pc; pc++)
Line 303 
Line 299 
                 if (boolean(value(ECHOCHECK)))                  if (boolean(value(ECHOCHECK)))
                         read(FD, (char *)&c, 1);        /* trailing \n */                          read(FD, (char *)&c, 1);        /* trailing \n */
                 else {                  else {
                         struct sgttyb buf;                          tcdrain(FD);
   
                         ioctl(FD, TIOCGETP, &buf);      /* this does a */  
                         ioctl(FD, TIOCSETP, &buf);      /*   wflushtty */  
                         sleep(5); /* wait for remote stty to take effect */                          sleep(5); /* wait for remote stty to take effect */
                 }                  }
         }          }
Line 357 
Line 350 
                                         alarm(0);                                          alarm(0);
                                         goto out;                                          goto out;
                                 }                                  }
                         } while ((c&0177) != character(value(PROMPT)));                          } while ((c&STRIP_PAR) != character(value(PROMPT)));
                         alarm(0);                          alarm(0);
                 }                  }
         }          }
Line 377 
Line 370 
                 else                  else
                         prtime(" lines transferred in ", stop_t-start_t);                          prtime(" lines transferred in ", stop_t-start_t);
         write(fildes[1], (char *)&ccc, 1);          write(fildes[1], (char *)&ccc, 1);
         ioctl(0, TIOCSETC, &tchars);          tcsetattr(0, TCSAFLUSH, &term);
 }  }
   
 /*  /*
Line 472 
Line 465 
         kill(pid, SIGIOT);      /* put TIPOUT into a wait state */          kill(pid, SIGIOT);      /* put TIPOUT into a wait state */
         signal(SIGINT, SIG_IGN);          signal(SIGINT, SIG_IGN);
         signal(SIGQUIT, SIG_IGN);          signal(SIGQUIT, SIG_IGN);
         ioctl(0, TIOCSETC, &defchars);          tcsetattr(0, TCSAFLUSH, &defchars);
         read(repdes[0], (char *)&ccc, 1);          read(repdes[0], (char *)&ccc, 1);
         /*          /*
          * Set up file descriptors in the child and           * Set up file descriptors in the child and
Line 499 
Line 492 
         if (boolean(value(VERBOSE)))          if (boolean(value(VERBOSE)))
                 prtime("away for ", time(0)-start);                  prtime("away for ", time(0)-start);
         write(fildes[1], (char *)&ccc, 1);          write(fildes[1], (char *)&ccc, 1);
         ioctl(0, TIOCSETC, &tchars);          tcsetattr(0, TCSAFLUSH, &term);
         signal(SIGINT, SIG_DFL);          signal(SIGINT, SIG_DFL);
         signal(SIGQUIT, SIG_DFL);          signal(SIGQUIT, SIG_DFL);
 }  }
Line 523 
Line 516 
         kill(pid, SIGIOT);      /* put TIPOUT into a wait state */          kill(pid, SIGIOT);      /* put TIPOUT into a wait state */
         signal(SIGINT, SIG_IGN);          signal(SIGINT, SIG_IGN);
         signal(SIGQUIT, SIG_IGN);          signal(SIGQUIT, SIG_IGN);
         ioctl(0, TIOCSETC, &defchars);          tcsetattr(0, TCSAFLUSH, &defchars);
         read(repdes[0], (char *)&ccc, 1);          read(repdes[0], (char *)&ccc, 1);
         /*          /*
          * Set up file descriptors in the child and           * Set up file descriptors in the child and
Line 551 
Line 544 
         if (boolean(value(VERBOSE)))          if (boolean(value(VERBOSE)))
                 prtime("away for ", time(0)-start);                  prtime("away for ", time(0)-start);
         write(fildes[1], (char *)&ccc, 1);          write(fildes[1], (char *)&ccc, 1);
         ioctl(0, TIOCSETC, &tchars);          tcsetattr(0, TCSAFLUSH, &term);
         signal(SIGINT, SIG_DFL);          signal(SIGINT, SIG_DFL);
         signal(SIGQUIT, SIG_DFL);          signal(SIGQUIT, SIG_DFL);
 }  }
Line 771 
Line 764 
 tandem(option)  tandem(option)
         char *option;          char *option;
 {  {
         struct sgttyb rmtty;          struct termios  rmtty;
   
         ioctl(FD, TIOCGETP, &rmtty);          tcgetattr(FD, &rmtty);
         if (strcmp(option,"on") == 0) {          if (strcmp(option, "on") == 0) {
                 rmtty.sg_flags |= TANDEM;                  rmtty.c_iflag |= IXOFF;
                 arg.sg_flags |= TANDEM;                  term.c_iflag |= IXOFF;
         } else {          } else {
                 rmtty.sg_flags &= ~TANDEM;                  rmtty.c_iflag &= ~IXOFF;
                 arg.sg_flags &= ~TANDEM;                  term.c_iflag &= ~IXOFF;
         }          }
         ioctl(FD, TIOCSETP, &rmtty);          tcsetattr(FD, TCSADRAIN, &rmtty);
         ioctl(0,  TIOCSETP, &arg);          tcsetattr(0, TCSADRAIN, &term);
 }  }
   
 /*  /*

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