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

Diff for /src/usr.bin/tip/Attic/tip.c between version 1.47 and 1.48

version 1.47, 2010/07/01 20:24:19 version 1.48, 2010/07/01 21:28:01
Line 54 
Line 54 
         int i, pair[2];          int i, pair[2];
   
         /* XXX preserve previous braindamaged behavior */          /* XXX preserve previous braindamaged behavior */
         setboolean(value(DC), 1);          vsetnum(DC, 1);
   
         if (strcmp(__progname, "cu") == 0) {          if (strcmp(__progname, "cu") == 0) {
                 cumode = 1;                  cumode = 1;
Line 86 
Line 86 
   
                 case '0': case '1': case '2': case '3': case '4':                  case '0': case '1': case '2': case '3': case '4':
                 case '5': case '6': case '7': case '8': case '9':                  case '5': case '6': case '7': case '8': case '9':
                         setnumber(value(BAUDRATE), atoi(&argv[1][1]));                          vsetnum(BAUDRATE, atoi(&argv[1][1]));
                         break;                          break;
   
                 default:                  default:
Line 116 
Line 116 
         vinit();                                /* init variables */          vinit();                                /* init variables */
         setparity("none");                      /* set the parity table */          setparity("none");                      /* set the parity table */
   
         if (ttysetup(number(value(BAUDRATE)))) {          if (ttysetup(vgetnum(BAUDRATE))) {
                 fprintf(stderr, "%s: bad baud rate %ld\n", __progname,                  fprintf(stderr, "%s: bad baud rate %ld\n", __progname,
                     number(value(BAUDRATE)));                      vgetnum(BAUDRATE));
                 (void)uu_unlock(uucplock);                  (void)uu_unlock(uucplock);
                 exit(3);                  exit(3);
         }          }
Line 157 
Line 157 
   
         (void)signal(SIGALRM, timeout);          (void)signal(SIGALRM, timeout);
   
         if (value(LINEDISC) != TTYDISC) {          if (vgetnum(LINEDISC) != TTYDISC) {
                 int ld = (int)value(LINEDISC);                  int ld = (int)vgetnum(LINEDISC);
                 ioctl(FD, TIOCSETD, &ld);                  ioctl(FD, TIOCSETD, &ld);
         }          }
   
         if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pair) != 0) {          if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pair) != 0) {
                 (void)uu_unlock(uucplock);                  (void)uu_unlock(uucplock);
Line 196 
Line 196 
 void  void
 con(void)  con(void)
 {  {
         if (value(CONNECT) != NULL)          if (vgetstr(CONNECT) != NULL)
                 parwrite(FD, value(CONNECT), size(value(CONNECT)));                  parwrite(FD, vgetstr(CONNECT), size(vgetstr(CONNECT)));
         logent(value(HOST), value(DEVICE), "call completed");          logent(vgetstr(HOST), vgetstr(DEVICE), "call completed");
 }  }
   
 void  void
Line 295 
Line 295 
          *   send a SIGEMT before tipout has a chance to set up catching           *   send a SIGEMT before tipout has a chance to set up catching
          *   it; so wait a second, then setscript()           *   it; so wait a second, then setscript()
          */           */
         if (boolean(value(SCRIPT))) {          if (vgetnum(SCRIPT)) {
                 sleep(1);                  sleep(1);
                 setscript();                  setscript();
         }          }
Line 303 
Line 303 
         while (1) {          while (1) {
                 gch = getchar()&STRIP_PAR;                  gch = getchar()&STRIP_PAR;
                 /* XXX does not check for EOF */                  /* XXX does not check for EOF */
                 if ((gch == character(value(ESCAPE))) && bol) {                  if (gch == vgetnum(ESCAPE) && bol) {
                         if (!noesc) {                          if (!noesc) {
                                 if (!(gch = escape()))                                  if (!(gch = escape()))
                                         continue;                                          continue;
                         }                          }
                 } else if (!cumode && gch == character(value(RAISECHAR))) {                  } else if (!cumode && gch == vgetnum(RAISECHAR)) {
                         setboolean(value(RAISE), !boolean(value(RAISE)));                          vsetnum(RAISE, !vgetnum(RAISE));
                         continue;                          continue;
                 } else if (gch == '\r') {                  } else if (gch == '\r') {
                         bol = 1;                          bol = 1;
                         ch = gch;                          ch = gch;
                         parwrite(FD, &ch, 1);                          parwrite(FD, &ch, 1);
                         if (boolean(value(HALFDUPLEX)))                          if (vgetnum(HALFDUPLEX))
                                 printf("\r\n");                                  printf("\r\n");
                         continue;                          continue;
                 } else if (!cumode && gch == character(value(FORCE)))                  } else if (!cumode && gch == vgetnum(FORCE))
                         gch = getchar()&STRIP_PAR;                          gch = getchar() & STRIP_PAR;
                 bol = any(gch, value(EOL));                  bol = any(gch, vgetstr(EOL));
                 if (boolean(value(RAISE)) && islower(gch))                  if (vgetnum(RAISE) && islower(gch))
                         gch = toupper(gch);                          gch = toupper(gch);
                 ch = gch;                  ch = gch;
                 parwrite(FD, &ch, 1);                  parwrite(FD, &ch, 1);
                 if (boolean(value(HALFDUPLEX)))                  if (vgetnum(HALFDUPLEX))
                         printf("%c", ch);                          printf("%c", ch);
         }          }
 }  }
Line 341 
Line 341 
 {  {
         int gch;          int gch;
         esctable_t *p;          esctable_t *p;
         char c = character(value(ESCAPE));          char c = vgetnum(ESCAPE);
   
         gch = (getchar()&STRIP_PAR);          gch = (getchar()&STRIP_PAR);
         /* XXX does not check for EOF */          /* XXX does not check for EOF */
Line 428 
Line 428 
   
         printf("%c\r\n", c);          printf("%c\r\n", c);
         for (p = etable; p->e_char; p++) {          for (p = etable; p->e_char; p++) {
                 printf("%2s", ctrl(character(value(ESCAPE))));                  printf("%2s", ctrl(vgetnum(ESCAPE)));
                 printf("%-2s     %s\r\n", ctrl(p->e_char), p->e_help);                  printf("%-2s     %s\r\n", ctrl(p->e_char), p->e_help);
         }          }
 }  }
Line 446 
Line 446 
         cfsetspeed(&cntrl, speed);          cfsetspeed(&cntrl, speed);
         cntrl.c_cflag &= ~(CSIZE|PARENB);          cntrl.c_cflag &= ~(CSIZE|PARENB);
         cntrl.c_cflag |= CS8;          cntrl.c_cflag |= CS8;
         if (boolean(value(DC)))          if (vgetnum(DC))
                 cntrl.c_cflag |= CLOCAL;                  cntrl.c_cflag |= CLOCAL;
         if (boolean(value(HARDWAREFLOW)))          if (vgetnum(HARDWAREFLOW))
                 cntrl.c_cflag |= CRTSCTS;                  cntrl.c_cflag |= CRTSCTS;
         cntrl.c_iflag &= ~(ISTRIP|ICRNL);          cntrl.c_iflag &= ~(ISTRIP|ICRNL);
         cntrl.c_oflag &= ~OPOST;          cntrl.c_oflag &= ~OPOST;
         cntrl.c_lflag &= ~(ICANON|ISIG|IEXTEN|ECHO);          cntrl.c_lflag &= ~(ICANON|ISIG|IEXTEN|ECHO);
         cntrl.c_cc[VMIN] = 1;          cntrl.c_cc[VMIN] = 1;
         cntrl.c_cc[VTIME] = 0;          cntrl.c_cc[VTIME] = 0;
         if (boolean(value(TAND)))          if (vgetnum(TAND))
                 cntrl.c_iflag |= IXOFF;                  cntrl.c_iflag |= IXOFF;
         return (tcsetattr(FD, TCSAFLUSH, &cntrl));          return (tcsetattr(FD, TCSAFLUSH, &cntrl));
 }  }
Line 483 
Line 483 
                 if (errno == EIO)                  if (errno == EIO)
                         tipabort("Lost carrier.");                          tipabort("Lost carrier.");
                 /* this is questionable */                  /* this is questionable */
                   abort();;//
                 perror("write");                  perror("write");
         }          }
 }  }
Line 497 
Line 498 
         char *parity;          char *parity;
         extern const unsigned char evenpartab[];          extern const unsigned char evenpartab[];
   
         if (value(PARITY) == NULL)          if (vgetstr(PARITY) == NULL)
                 value(PARITY) = defparity;                  vsetstr(PARITY, defparity);
         parity = value(PARITY);          parity = vgetstr(PARITY);
         if (strcmp(parity, "none") == 0) {          if (strcmp(parity, "none") == 0) {
                 bits8 = 1;                  bits8 = 1;
                 return;                  return;

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48