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

Diff for /src/usr.bin/ssh/sftp.c between version 1.158 and 1.159

version 1.158, 2013/11/20 20:54:10 version 1.159, 2014/04/21 14:36:16
Line 69 
Line 69 
 /* When this option is set, we always recursively download/upload directories */  /* When this option is set, we always recursively download/upload directories */
 int global_rflag = 0;  int global_rflag = 0;
   
 /* When this option is set, we resume download if possible */  /* When this option is set, we resume download or upload if possible */
 int global_aflag = 0;  int global_aflag = 0;
   
 /* When this option is set, the file transfers will always preserve times */  /* When this option is set, the file transfers will always preserve times */
Line 138 
Line 138 
         I_VERSION,          I_VERSION,
         I_PROGRESS,          I_PROGRESS,
         I_REGET,          I_REGET,
           I_REPUT
 };  };
   
 struct CMD {  struct CMD {
Line 180 
Line 181 
         { "quit",       I_QUIT,         NOARGS  },          { "quit",       I_QUIT,         NOARGS  },
         { "reget",      I_REGET,        REMOTE  },          { "reget",      I_REGET,        REMOTE  },
         { "rename",     I_RENAME,       REMOTE  },          { "rename",     I_RENAME,       REMOTE  },
           { "reput",      I_REPUT,        LOCAL   },
         { "rm",         I_RM,           REMOTE  },          { "rm",         I_RM,           REMOTE  },
         { "rmdir",      I_RMDIR,        REMOTE  },          { "rmdir",      I_RMDIR,        REMOTE  },
         { "symlink",    I_SYMLINK,      REMOTE  },          { "symlink",    I_SYMLINK,      REMOTE  },
Line 229 
Line 231 
             "exit                               Quit sftp\n"              "exit                               Quit sftp\n"
             "get [-Ppr] remote [local]          Download file\n"              "get [-Ppr] remote [local]          Download file\n"
             "reget remote [local]               Resume download file\n"              "reget remote [local]               Resume download file\n"
               "reput [local] remote               Resume upload file\n"
             "help                               Display this help text\n"              "help                               Display this help text\n"
             "lcd path                           Change local directory to 'path'\n"              "lcd path                           Change local directory to 'path'\n"
             "lls [ls-options [path]]            Display local directory listing\n"              "lls [ls-options [path]]            Display local directory listing\n"
Line 639 
Line 642 
   
 static int  static int
 process_put(struct sftp_conn *conn, char *src, char *dst, char *pwd,  process_put(struct sftp_conn *conn, char *src, char *dst, char *pwd,
     int pflag, int rflag, int fflag)      int pflag, int rflag, int resume, int fflag)
 {  {
         char *tmp_dst = NULL;          char *tmp_dst = NULL;
         char *abs_dst = NULL;          char *abs_dst = NULL;
Line 702 
Line 705 
                 }                  }
                 free(tmp);                  free(tmp);
   
                 if (!quiet)                  resume |= global_aflag;
                   if (!quiet && resume)
                           printf("Resuming upload of  %s to %s\n", g.gl_pathv[i],
                                   abs_dst);
                   else if (!quiet && !resume)
                         printf("Uploading %s to %s\n", g.gl_pathv[i], abs_dst);                          printf("Uploading %s to %s\n", g.gl_pathv[i], abs_dst);
                 if (pathname_is_dir(g.gl_pathv[i]) && (rflag || global_rflag)) {                  if (pathname_is_dir(g.gl_pathv[i]) && (rflag || global_rflag)) {
                         if (upload_dir(conn, g.gl_pathv[i], abs_dst,                          if (upload_dir(conn, g.gl_pathv[i], abs_dst,
                             pflag || global_pflag, 1,                              pflag || global_pflag, 1, resume,
                             fflag || global_fflag) == -1)                              fflag || global_fflag) == -1)
                                 err = -1;                                  err = -1;
                 } else {                  } else {
                         if (do_upload(conn, g.gl_pathv[i], abs_dst,                          if (do_upload(conn, g.gl_pathv[i], abs_dst,
                             pflag || global_pflag,                              pflag || global_pflag, resume,
                             fflag || global_fflag) == -1)                              fflag || global_fflag) == -1)
                                 err = -1;                                  err = -1;
                 }                  }
Line 1165 
Line 1172 
 }  }
   
 static int  static int
 parse_args(const char **cpp, int *ignore_errors, int *aflag, int *fflag,  parse_args(const char **cpp, int *ignore_errors, int *aflag,
     int *hflag, int *iflag, int *lflag, int *pflag, int *rflag, int *sflag,            int *fflag, int *hflag, int *iflag, int *lflag, int *pflag,
             int *rflag, int *sflag,
     unsigned long *n_arg, char **path1, char **path2)      unsigned long *n_arg, char **path1, char **path2)
 {  {
         const char *cmd, *cp = *cpp;          const char *cmd, *cp = *cpp;
Line 1218 
Line 1226 
         switch (cmdnum) {          switch (cmdnum) {
         case I_GET:          case I_GET:
         case I_REGET:          case I_REGET:
           case I_REPUT:
         case I_PUT:          case I_PUT:
                 if ((optidx = parse_getput_flags(cmd, argv, argc,                  if ((optidx = parse_getput_flags(cmd, argv, argc,
                     aflag, fflag, pflag, rflag)) == -1)                      aflag, fflag, pflag, rflag)) == -1)
Line 1235 
Line 1244 
                         /* Destination is not globbed */                          /* Destination is not globbed */
                         undo_glob_escape(*path2);                          undo_glob_escape(*path2);
                 }                  }
                 if (*aflag && cmdnum == I_PUT) {  
                         /* XXX implement resume for uploads */  
                         error("Resume is not supported for uploads");  
                         return -1;  
                 }  
                 break;                  break;
         case I_LINK:          case I_LINK:
                 if ((optidx = parse_link_flags(cmd, argv, argc, sflag)) == -1)                  if ((optidx = parse_link_flags(cmd, argv, argc, sflag)) == -1)
Line 1361 
Line 1365 
     int err_abort)      int err_abort)
 {  {
         char *path1, *path2, *tmp;          char *path1, *path2, *tmp;
         int ignore_errors = 0, aflag = 0, fflag = 0, hflag = 0, iflag = 0;          int ignore_errors = 0, aflag = 0, fflag = 0, hflag = 0,
           iflag = 0;
         int lflag = 0, pflag = 0, rflag = 0, sflag = 0;          int lflag = 0, pflag = 0, rflag = 0, sflag = 0;
         int cmdnum, i;          int cmdnum, i;
         unsigned long n_arg = 0;          unsigned long n_arg = 0;
Line 1394 
Line 1399 
                 err = process_get(conn, path1, path2, *pwd, pflag,                  err = process_get(conn, path1, path2, *pwd, pflag,
                     rflag, aflag, fflag);                      rflag, aflag, fflag);
                 break;                  break;
           case I_REPUT:
                   aflag = 1;
                   /* FALLTHROUGH */
         case I_PUT:          case I_PUT:
                 err = process_put(conn, path1, path2, *pwd, pflag,                  err = process_put(conn, path1, path2, *pwd, pflag,
                     rflag, fflag);                      rflag, aflag, fflag);
                 break;                  break;
         case I_RENAME:          case I_RENAME:
                 path1 = make_absolute(path1, *pwd);                  path1 = make_absolute(path1, *pwd);

Legend:
Removed from v.1.158  
changed lines
  Added in v.1.159