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

Diff for /src/usr.bin/ftp/main.c between version 1.9 and 1.10

version 1.9, 1996/12/17 02:11:45 version 1.10, 1996/12/18 01:59:15
Line 173 
Line 173 
                         extern char *__progname;                          extern char *__progname;
                         char portstr[20], *p, *bufp = NULL;                          char portstr[20], *p, *bufp = NULL;
                         char *host = NULL, *dir = NULL, *file = NULL;                          char *host = NULL, *dir = NULL, *file = NULL;
                         int xargc = 2, tmp;                          int xargc = 2, looping = 0, tmp;
   
                         if (setjmp(toplevel))                          if (setjmp(toplevel))
                                 exit(0);                                  exit(0);
Line 190 
Line 190 
                                 http_fetch(host);                                  http_fetch(host);
                                 goto bail;                                  goto bail;
                         }                          }
                         if (strncmp(host, "ftp://", sizeof("ftp://")-1) == 0) {                          if (strncmp(host, "ftp://", strlen("ftp://")) == 0) {
                                 host += sizeof("ftp://") - 1;                                  host += strlen("ftp://");
                                 p = strchr(host, '/');                                  p = strchr(host, '/');
                         } else                          }
                           else
                                 p = strchr(host, ':');                                  p = strchr(host, ':');
                         *p = '\0';                          *p = '\0';
                         dir = ++p;  
                         p = strrchr(p, '/');  
                         if (p) {  
                                 *p = '\0';  
                                 file = ++p;  
                         } else {  
                                 file = dir;  
                                 dir = NULL;  
                         }  
   
                         xargv[1] = host;                          xargv[1] = host;
                         xargc = 2;                          xargc = 2;
Line 214 
Line 206 
                                     force_port);                                      force_port);
                         }                          }
                         xargv[xargc] = NULL;                          xargv[xargc] = NULL;
                         setpeer(xargc, xargv);                          setpeer(xargc, xargv);
                         if (!connected) {                          if (!connected) {
                                 printf("failed to connect to %s\n", host);                                  printf("failed to connect to %s\n", host);
                                 ret = 1;                                  ret = 1;
                                 goto bail;                                  goto bail;
                         }                          }
                           *argv = strchr(argv[0], ':') + 1;
                         if (dir != NULL && *dir != '\0') {                          do {
                                 xargv[1] = dir;                                  dir = *argv;
                                   p = strrchr(dir, '/');
                                   if (p != NULL) {
                                           *p = '\0';
                                           file = ++p;
                                   } else {
                                           file = dir;
                                           dir = NULL;
                                   }
                                   if (dir != NULL && *dir != '\0') {
                                           xargv[1] = dir;
                                           xargv[2] = NULL;
                                           xargc = 2;
                                           cd(xargc, xargv);
                                   }
                                   xargv[1] = *file == '\0' ? "/" : file;
                                 xargv[2] = NULL;                                  xargv[2] = NULL;
                                 xargc = 2;                                  xargc = 2;
                                 cd(xargc, xargv);                                  tmp = verbose;
                         }                                  verbose = -1;
                         /*                                  if (cd(xargc, xargv) == 0) {
                          * either "file" is the file user wants, or he wants                                          verbose = tmp;
                          * to cd to "file" aswell, so try cd first, after                                          goto CLINE_CD;
                          * switcing of verbose (already got a CWD from above).                                  }
                         */  
                         xargv[1] = *file == '\0' ? "/" : file;  
                         xargv[2] = NULL;  
                         xargc = 2;  
                         tmp = verbose;  
                         verbose = 0;  
                         if (cd(xargc, xargv) == 0) {  
                                 verbose = tmp;                                  verbose = tmp;
                                 goto CLINE_CD;                                  if (!looping) {
                         }                                          setbinary(NULL, 0);
                         verbose = tmp;                                          looping = 1;
                         setbinary(NULL, 0);                                  }
                                   /* fetch file */
                                   xargv[1] = file;
                                   xargv[2] = NULL;
                                   xargc = 2;
                                   get(xargc, xargv);
                                   --argc;
                                   argv++;
                   } while (argc > 0 && strchr(argv[0], ':') == NULL);
   
                         /* fetch file */  
                         xargv[1] = file;  
                         xargv[2] = NULL;  
                         xargc = 2;  
                         get(xargc, xargv);  
   
                         /* get ready for the next file */                          /* get ready for the next file */
 bail:  bail:
                         if (bufp) {                          if (bufp) {
Line 258 
Line 260 
                         }                          }
                         if (connected)                          if (connected)
                                 disconnect(1, xargv);                                  disconnect(1, xargv);
                         --argc;  
                         argv++;  
                 }                  }
                 exit(ret);                  exit(ret);
         }          }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10