[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.65 and 1.66

version 1.65, 2005/07/17 07:17:55 version 1.66, 2005/08/08 13:22:48
Line 1230 
Line 1230 
         char *dir = NULL;          char *dir = NULL;
         char cmd[2048];          char cmd[2048];
         struct sftp_conn *conn;          struct sftp_conn *conn;
         int err;          int err, interactive;
         EditLine *el = NULL;          EditLine *el = NULL;
         History *hl = NULL;          History *hl = NULL;
         HistEvent hev;          HistEvent hev;
Line 1289 
Line 1289 
         setvbuf(stdout, NULL, _IOLBF, 0);          setvbuf(stdout, NULL, _IOLBF, 0);
         setvbuf(infile, NULL, _IOLBF, 0);          setvbuf(infile, NULL, _IOLBF, 0);
   
           interactive = !batchmode && isatty(STDIN_FILENO);
         err = 0;          err = 0;
         for (;;) {          for (;;) {
                 char *cp;                  char *cp;
Line 1298 
Line 1299 
                 signal(SIGINT, SIG_IGN);                  signal(SIGINT, SIG_IGN);
   
                 if (el == NULL) {                  if (el == NULL) {
                         printf("sftp> ");                          if (interactive)
                                   printf("sftp> ");
                         if (fgets(cmd, sizeof(cmd), infile) == NULL) {                          if (fgets(cmd, sizeof(cmd), infile) == NULL) {
                                 printf("\n");                                  if (interactive)
                                           printf("\n");
                                 break;                                  break;
                         }                          }
                         if (batchmode) /* Echo command */                          if (!interactive) { /* Echo command */
                                 printf("%s", cmd);                                  printf("sftp> %s", cmd);
                                   if (strlen(cmd) > 0 &&
                                       cmd[strlen(cmd) - 1] != '\n')
                                           printf("\n");
                           }
                 } else {                  } else {
                         if ((line = el_gets(el, &count)) == NULL || count <= 0)                          if ((line = el_gets(el, &count)) == NULL || count <= 0) {
                                   printf("\n");
                                 break;                                  break;
                           }
                         history(hl, &hev, H_ENTER, line);                          history(hl, &hev, H_ENTER, line);
                         if (strlcpy(cmd, line, sizeof(cmd)) >= sizeof(cmd)) {                          if (strlcpy(cmd, line, sizeof(cmd)) >= sizeof(cmd)) {
                                 fprintf(stderr, "Error: input line too long\n");                                  fprintf(stderr, "Error: input line too long\n");
Line 1328 
Line 1337 
                         break;                          break;
         }          }
         xfree(pwd);          xfree(pwd);
   
           if (el != NULL)
                   el_end(el);
   
         /* err == 1 signifies normal "quit" exit */          /* err == 1 signifies normal "quit" exit */
         return (err >= 0 ? 0 : -1);          return (err >= 0 ? 0 : -1);

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.66