[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.173 and 1.174

version 1.173, 2016/04/08 08:19:17 version 1.174, 2016/05/25 23:48:45
Line 31 
Line 31 
 #include <libgen.h>  #include <libgen.h>
 #include <locale.h>  #include <locale.h>
 #include <signal.h>  #include <signal.h>
   #include <stdarg.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <stdio.h>  #include <stdio.h>
 #include <string.h>  #include <string.h>
Line 43 
Line 44 
 #include "log.h"  #include "log.h"
 #include "pathnames.h"  #include "pathnames.h"
 #include "misc.h"  #include "misc.h"
   #include "utf8.h"
   
 #include "sftp.h"  #include "sftp.h"
 #include "ssherr.h"  #include "ssherr.h"
Line 622 
Line 624 
   
                 resume |= global_aflag;                  resume |= global_aflag;
                 if (!quiet && resume)                  if (!quiet && resume)
                         printf("Resuming %s to %s\n", g.gl_pathv[i], abs_dst);                          mprintf("Resuming %s to %s\n",
                               g.gl_pathv[i], abs_dst);
                 else if (!quiet && !resume)                  else if (!quiet && !resume)
                         printf("Fetching %s to %s\n", g.gl_pathv[i], abs_dst);                          mprintf("Fetching %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 (download_dir(conn, g.gl_pathv[i], abs_dst, NULL,                          if (download_dir(conn, g.gl_pathv[i], abs_dst, NULL,
                             pflag || global_pflag, 1, resume,                              pflag || global_pflag, 1, resume,
Line 713 
Line 717 
   
                 resume |= global_aflag;                  resume |= global_aflag;
                 if (!quiet && resume)                  if (!quiet && resume)
                         printf("Resuming upload of %s to %s\n", g.gl_pathv[i],                          mprintf("Resuming upload of %s to %s\n",
                                 abs_dst);                              g.gl_pathv[i], abs_dst);
                 else if (!quiet && !resume)                  else if (!quiet && !resume)
                         printf("Uploading %s to %s\n", g.gl_pathv[i], abs_dst);                          mprintf("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, resume,                              pflag || global_pflag, 1, resume,
Line 817 
Line 822 
                                 attrib_to_stat(&d[n]->a, &sb);                                  attrib_to_stat(&d[n]->a, &sb);
                                 lname = ls_file(fname, &sb, 1,                                  lname = ls_file(fname, &sb, 1,
                                     (lflag & LS_SI_UNITS));                                      (lflag & LS_SI_UNITS));
                                 printf("%s\n", lname);                                  mprintf("%s\n", lname);
                                 free(lname);                                  free(lname);
                         } else                          } else
                                 printf("%s\n", d[n]->longname);                                  mprintf("%s\n", d[n]->longname);
                 } else {                  } else {
                         printf("%-*s", colspace, fname);                          mprintf("%-*s", colspace, fname);
                         if (c >= columns) {                          if (c >= columns) {
                                 printf("\n");                                  printf("\n");
                                 c = 1;                                  c = 1;
Line 903 
Line 908 
                         }                          }
                         lname = ls_file(fname, g.gl_statv[i], 1,                          lname = ls_file(fname, g.gl_statv[i], 1,
                             (lflag & LS_SI_UNITS));                              (lflag & LS_SI_UNITS));
                         printf("%s\n", lname);                          mprintf("%s\n", lname);
                         free(lname);                          free(lname);
                 } else {                  } else {
                         printf("%-*s", colspace, fname);                          mprintf("%-*s", colspace, fname);
                         if (c >= columns) {                          if (c >= columns) {
                                 printf("\n");                                  printf("\n");
                                 c = 1;                                  c = 1;
Line 1434 
Line 1439 
                 remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g);                  remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g);
                 for (i = 0; g.gl_pathv[i] && !interrupted; i++) {                  for (i = 0; g.gl_pathv[i] && !interrupted; i++) {
                         if (!quiet)                          if (!quiet)
                                 printf("Removing %s\n", g.gl_pathv[i]);                                  mprintf("Removing %s\n", g.gl_pathv[i]);
                         err = do_rm(conn, g.gl_pathv[i]);                          err = do_rm(conn, g.gl_pathv[i]);
                         if (err != 0 && err_abort)                          if (err != 0 && err_abort)
                                 break;                                  break;
Line 1534 
Line 1539 
                 remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g);                  remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g);
                 for (i = 0; g.gl_pathv[i] && !interrupted; i++) {                  for (i = 0; g.gl_pathv[i] && !interrupted; i++) {
                         if (!quiet)                          if (!quiet)
                                 printf("Changing mode on %s\n", g.gl_pathv[i]);                                  mprintf("Changing mode on %s\n",
                                       g.gl_pathv[i]);
                         err = do_setstat(conn, g.gl_pathv[i], &a);                          err = do_setstat(conn, g.gl_pathv[i], &a);
                         if (err != 0 && err_abort)                          if (err != 0 && err_abort)
                                 break;                                  break;
Line 1564 
Line 1570 
                         aa->flags &= SSH2_FILEXFER_ATTR_UIDGID;                          aa->flags &= SSH2_FILEXFER_ATTR_UIDGID;
                         if (cmdnum == I_CHOWN) {                          if (cmdnum == I_CHOWN) {
                                 if (!quiet)                                  if (!quiet)
                                         printf("Changing owner on %s\n",                                          mprintf("Changing owner on %s\n",
                                             g.gl_pathv[i]);                                              g.gl_pathv[i]);
                                 aa->uid = n_arg;                                  aa->uid = n_arg;
                         } else {                          } else {
                                 if (!quiet)                                  if (!quiet)
                                         printf("Changing group on %s\n",                                          mprintf("Changing group on %s\n",
                                             g.gl_pathv[i]);                                              g.gl_pathv[i]);
                                 aa->gid = n_arg;                                  aa->gid = n_arg;
                         }                          }
Line 1579 
Line 1585 
                 }                  }
                 break;                  break;
         case I_PWD:          case I_PWD:
                 printf("Remote working directory: %s\n", *pwd);                  mprintf("Remote working directory: %s\n", *pwd);
                 break;                  break;
         case I_LPWD:          case I_LPWD:
                 if (!getcwd(path_buf, sizeof(path_buf))) {                  if (!getcwd(path_buf, sizeof(path_buf))) {
Line 1587 
Line 1593 
                         err = -1;                          err = -1;
                         break;                          break;
                 }                  }
                 printf("Local working directory: %s\n", path_buf);                  mprintf("Local working directory: %s\n", path_buf);
                 break;                  break;
         case I_QUIT:          case I_QUIT:
                 /* Processed below */                  /* Processed below */
Line 1655 
Line 1661 
         for (y = 0; list[y]; y++) {          for (y = 0; list[y]; y++) {
                 llen = strlen(list[y]);                  llen = strlen(list[y]);
                 tmp = llen > len ? list[y] + len : "";                  tmp = llen > len ? list[y] + len : "";
                 printf("%-*s", colspace, tmp);                  mprintf("%-*s", colspace, tmp);
                 if (m >= columns) {                  if (m >= columns) {
                         printf("\n");                          printf("\n");
                         m = 1;                          m = 1;
Line 2036 
Line 2042 
   
                 if (remote_is_dir(conn, dir) && file2 == NULL) {                  if (remote_is_dir(conn, dir) && file2 == NULL) {
                         if (!quiet)                          if (!quiet)
                                 printf("Changing to: %s\n", dir);                                  mprintf("Changing to: %s\n", dir);
                         snprintf(cmd, sizeof cmd, "cd \"%s\"", dir);                          snprintf(cmd, sizeof cmd, "cd \"%s\"", dir);
                         if (parse_dispatch_command(conn, cmd,                          if (parse_dispatch_command(conn, cmd,
                             &remote_path, 1) != 0) {                              &remote_path, 1) != 0) {
Line 2082 
Line 2088 
                                 break;                                  break;
                         }                          }
                         if (!interactive) { /* Echo command */                          if (!interactive) { /* Echo command */
                                 printf("sftp> %s", cmd);                                  mprintf("sftp> %s", cmd);
                                 if (strlen(cmd) > 0 &&                                  if (strlen(cmd) > 0 &&
                                     cmd[strlen(cmd) - 1] != '\n')                                      cmd[strlen(cmd) - 1] != '\n')
                                         printf("\n");                                          printf("\n");

Legend:
Removed from v.1.173  
changed lines
  Added in v.1.174