[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.7 and 1.8

version 1.7, 1997/08/25 16:30:13 version 1.8, 1997/09/01 23:24:26
Line 71 
Line 71 
 char    *sname();  char    *sname();
 char    PNbuf[256];                     /* This limits the size of a number */  char    PNbuf[256];                     /* This limits the size of a number */
   
   int
 main(argc, argv)  main(argc, argv)
           int argc;
         char *argv[];          char *argv[];
 {  {
         char *system = NOSTR;          char *system = NOSTR;
Line 136 
Line 138 
         for (p = system; *p; p++)          for (p = system; *p; p++)
                 *p = '\0';                  *p = '\0';
         PN = PNbuf;          PN = PNbuf;
         (void)snprintf(sbuf, sizeof(sbuf), "tip%d", BR);          (void)snprintf(sbuf, sizeof(sbuf), "tip%ld", BR);
         system = sbuf;          system = sbuf;
   
 notnumber:  notnumber:
Line 175 
Line 177 
         vinit();                                /* init variables */          vinit();                                /* init variables */
         setparity("even");                      /* set the parity table */          setparity("even");                      /* set the parity table */
         if ((i = speed(number(value(BAUDRATE)))) == 0) {          if ((i = speed(number(value(BAUDRATE)))) == 0) {
                 printf("tip: bad baud rate %d\n", number(value(BAUDRATE)));                  printf("tip: bad baud rate %ld\n", number(value(BAUDRATE)));
                 daemon_uid();                  daemon_uid();
                 (void)uu_unlock(uucplock);                  (void)uu_unlock(uucplock);
                 exit(3);                  exit(3);
Line 188 
Line 190 
          */           */
         if (HW)          if (HW)
                 ttysetup(i);                  ttysetup(i);
         if (p = connect()) {          if ((p = connect())) {
                 printf("\07%s\n[EOT]\n", p);                  printf("\07%s\n[EOT]\n", p);
                 daemon_uid();                  daemon_uid();
                 (void)uu_unlock(uucplock);                  (void)uu_unlock(uucplock);
Line 226 
Line 228 
          * so, fork one process for local side and one for remote.           * so, fork one process for local side and one for remote.
          */           */
         printf(cumode ? "Connected\r\n" : "\07connected\r\n");          printf(cumode ? "Connected\r\n" : "\07connected\r\n");
         if (pid = fork())          if ((pid = fork()))
                 tipin();                  tipin();
         else          else
                 tipout();                  tipout();
         /*NOTREACHED*/          /*NOTREACHED*/
           exit(0);
 }  }
   
 void  void
Line 254 
Line 257 
  */   */
 static int uidswapped;  static int uidswapped;
   
   void
 user_uid()  user_uid()
 {  {
         if (uidswapped == 0) {          if (uidswapped == 0) {
Line 262 
Line 266 
         }          }
 }  }
   
   void
 daemon_uid()  daemon_uid()
 {  {
   
Line 271 
Line 276 
         }          }
 }  }
   
   void
 shell_uid()  shell_uid()
 {  {
         setegid(gid);          setegid(gid);
Line 280 
Line 286 
 /*  /*
  * put the controlling keyboard into raw mode   * put the controlling keyboard into raw mode
  */   */
   void
 raw()  raw()
 {  {
         tcsetattr(0, TCSADRAIN, &term);          tcsetattr(0, TCSADRAIN, &term);
Line 289 
Line 296 
 /*  /*
  * return keyboard to normal mode   * return keyboard to normal mode
  */   */
   void
 unraw()  unraw()
 {  {
         tcsetattr(0, TCSADRAIN, &defterm);          tcsetattr(0, TCSADRAIN, &defterm);
Line 301 
Line 309 
  *  in from the terminal.  Handles signals & allows use of   *  in from the terminal.  Handles signals & allows use of
  *  normal erase and kill characters.   *  normal erase and kill characters.
  */   */
   int
 prompt(s, p, sz)  prompt(s, p, sz)
         char *s;          char *s;
         register char *p;          char *p;
         size_t sz;          size_t sz;
 {  {
         register int c;          register int c;
Line 342 
Line 351 
 /*  /*
  * ****TIPIN   TIPIN****   * ****TIPIN   TIPIN****
  */   */
   void
 tipin()  tipin()
 {  {
         char gch, bol = 1;          char gch, bol = 1;
Line 389 
Line 399 
  * Escape handler --   * Escape handler --
  *  called on recognition of ``escapec'' at the beginning of a line   *  called on recognition of ``escapec'' at the beginning of a line
  */   */
   int
 escape()  escape()
 {  {
         register char gch;          register char gch;
Line 410 
Line 421 
         return (gch);          return (gch);
 }  }
   
   int
 speed(n)  speed(n)
         int n;          int n;
 {  {
Line 421 
Line 433 
         return 0;          return 0;
 }  }
   
 any(c, p)  int
         register char c, *p;  any(cc, p)
           register int cc;
           char *p;
 {  {
           char c = cc;
         while (p && *p)          while (p && *p)
                 if (*p++ == c)                  if (*p++ == c)
                         return (1);                          return (1);
         return (0);          return (0);
 }  }
   
   int
 size(s)  size(s)
         register char   *s;          register char   *s;
 {  {
Line 447 
Line 463 
         static char buf[256];          static char buf[256];
         register char *p = buf, c, *q;          register char *p = buf, c, *q;
   
         while (c = *s++) {          while ((c = *s++)) {
                 for (q = "\nn\rr\tt\ff\033E\bb"; *q; q++)                  for (q = "\nn\rr\tt\ff\033E\bb"; *q; q++)
                         if (*q++ == c) {                          if (*q++ == c) {
                                 *p++ = '\\'; *p++ = *q;                                  *p++ = '\\'; *p++ = *q;
Line 486 
Line 502 
 /*  /*
  * Help command   * Help command
  */   */
   void
 help(c)  help(c)
         char c;          char c;
 {  {
Line 504 
Line 521 
 /*  /*
  * Set up the "remote" tty's state   * Set up the "remote" tty's state
  */   */
   void
 ttysetup(speed)  ttysetup(speed)
         int speed;          int speed;
 {  {
Line 549 
Line 567 
  * We are doing 8 bit wide output, so we just generate a character   * We are doing 8 bit wide output, so we just generate a character
  * with the right parity and output it.   * with the right parity and output it.
  */   */
   void
 pwrite(fd, buf, n)  pwrite(fd, buf, n)
         int fd;          int fd;
         char *buf;          char *buf;
Line 575 
Line 594 
 /*  /*
  * Build a parity table with appropriate high-order bit.   * Build a parity table with appropriate high-order bit.
  */   */
   void
 setparity(defparity)  setparity(defparity)
         char *defparity;          char *defparity;
 {  {

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8