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

Diff for /src/usr.bin/telnet/commands.c between version 1.85 and 1.86

version 1.85, 2017/07/19 12:25:52 version 1.86, 2018/09/30 14:35:32
Line 58 
Line 58 
         int     needconnect;    /* Do we need to be connected to execute? */          int     needconnect;    /* Do we need to be connected to execute? */
 } Command;  } Command;
   
   #define        MAXARGV         20
   
 static char line[256];  static char line[256];
 static int margc;  static int margc;
 static char *margv[20];  static char *margv[MAXARGV+1];
   
 static void  static int
 makeargv(void)  makeargv(void)
 {  {
     char *cp, *cp2, c;      char *cp, *cp2, c;
     char **argp = margv;      char **argp = margv;
       int ret = 0;
   
     margc = 0;      margc = 0;
     cp = line;      cp = line;
     while ((c = *cp)) {      while ((c = *cp)) {
           if (margc >= MAXARGV) {
               printf("too many arguments\n");
               ret = 1;
               break;
           }
         int inquote = 0;          int inquote = 0;
         while (isspace((unsigned char)c))          while (isspace((unsigned char)c))
             c = *++cp;              c = *++cp;
Line 105 
Line 113 
         cp++;          cp++;
     }      }
     *argp++ = 0;      *argp++ = 0;
       return (ret);
 }  }
   
 /*  /*
Line 1703 
Line 1712 
                 continue;                  continue;
             gotmachine = 1;              gotmachine = 1;
         }          }
         makeargv();          if (makeargv())
               continue;
         if (margv[0] == 0)          if (margv[0] == 0)
             continue;              continue;
         c = getcmd(margv[0]);          c = getcmd(margv[0]);
Line 1747 
Line 1757 
         strlcpy(line, "open ", sizeof(line));          strlcpy(line, "open ", sizeof(line));
         printf("(to) ");          printf("(to) ");
         (void) fgets(&line[strlen(line)], sizeof(line) - strlen(line), stdin);          (void) fgets(&line[strlen(line)], sizeof(line) - strlen(line), stdin);
         makeargv();          if (makeargv())
               return 0;
         argc = margc;          argc = margc;
         argv = margv;          argv = margv;
     }      }
Line 2017 
Line 2028 
         }          }
         if (line[0] == 0)          if (line[0] == 0)
             break;              break;
         makeargv();          if (makeargv())
               break;
         if (margv[0] == 0) {          if (margv[0] == 0) {
             break;              break;
         }          }

Legend:
Removed from v.1.85  
changed lines
  Added in v.1.86