[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.38 and 1.39

version 1.38, 2003/10/08 08:27:36 version 1.39, 2004/01/13 09:25:05
Line 37 
Line 37 
 #include "sftp-client.h"  #include "sftp-client.h"
 #include "sftp-int.h"  #include "sftp-int.h"
   
 FILE* infile;  FILE* infile = stdin;
   int batchmode = 0;
 size_t copy_buffer_len = 32768;  size_t copy_buffer_len = 32768;
 size_t num_requests = 16;  size_t num_requests = 16;
 static pid_t sshpid = -1;  static pid_t sshpid = -1;
Line 134 
Line 135 
         addargs(&args, "-oForwardAgent no");          addargs(&args, "-oForwardAgent no");
         addargs(&args, "-oClearAllForwardings yes");          addargs(&args, "-oClearAllForwardings yes");
         ll = SYSLOG_LEVEL_INFO;          ll = SYSLOG_LEVEL_INFO;
         infile = stdin;         /* Read from STDIN unless changed by -b */  
   
         while ((ch = getopt(argc, argv, "1hvCo:s:S:b:B:F:P:R:")) != -1) {          while ((ch = getopt(argc, argv, "1hvCo:s:S:b:B:F:P:R:")) != -1) {
                 switch (ch) {                  switch (ch) {
Line 164 
Line 164 
                         ssh_program = optarg;                          ssh_program = optarg;
                         break;                          break;
                 case 'b':                  case 'b':
                         if (infile == stdin) {                          if (batchmode)
                                 infile = fopen(optarg, "r");                                  fatal("Batch file already specified.");
                                 if (infile == NULL)  
                                         fatal("%s (%s).", strerror(errno), optarg);                          /* Allow "-" as stdin */
                         } else                          if (strcmp(optarg, "-") != 0 &&
                                 fatal("Filename already specified.");                             (infile = fopen(optarg, "r")) == NULL)
                                   fatal("%s (%s).", strerror(errno), optarg);
                         showprogress = 0;                          showprogress = 0;
                           batchmode = 1;
                         break;                          break;
                 case 'P':                  case 'P':
                         sftp_direct = optarg;                          sftp_direct = optarg;
Line 234 
Line 236 
                     sftp_server : "sftp"));                      sftp_server : "sftp"));
                 args.list[0] = ssh_program;                  args.list[0] = ssh_program;
   
                 fprintf(stderr, "Connecting to %s...\n", host);                  if (!batchmode)
                           fprintf(stderr, "Connecting to %s...\n", host);
                 connect_to_server(ssh_program, args.list, &in, &out);                  connect_to_server(ssh_program, args.list, &in, &out);
         } else {          } else {
                 args.list = NULL;                  args.list = NULL;
                 addargs(&args, "sftp-server");                  addargs(&args, "sftp-server");
   
                 fprintf(stderr, "Attaching to %s...\n", sftp_direct);                  if (!batchmode)
                           fprintf(stderr, "Attaching to %s...\n", sftp_direct);
                 connect_to_server(sftp_direct, args.list, &in, &out);                  connect_to_server(sftp_direct, args.list, &in, &out);
         }          }
   
Line 248 
Line 252 
   
         close(in);          close(in);
         close(out);          close(out);
         if (infile != stdin)          if (batchmode)
                 fclose(infile);                  fclose(infile);
   
         while (waitpid(sshpid, NULL, 0) == -1)          while (waitpid(sshpid, NULL, 0) == -1)

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39