[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.76 and 1.77

version 1.76, 2009/04/27 22:51:51 version 1.77, 2009/05/05 19:35:30
Line 76 
Line 76 
 #include <unistd.h>  #include <unistd.h>
   
 #include "ftp_var.h"  #include "ftp_var.h"
   #include "cmds.h"
   
 int family = PF_UNSPEC;  int family = PF_UNSPEC;
   
Line 112 
Line 113 
         hist = NULL;          hist = NULL;
         cookiefile = NULL;          cookiefile = NULL;
         resume = 0;          resume = 0;
           marg_sl = sl_init();
 #endif /* !SMALL */  #endif /* !SMALL */
         mark = HASHBYTES;          mark = HASHBYTES;
         marg_sl = sl_init();  
 #ifdef INET6  #ifdef INET6
         epsv4 = 1;          epsv4 = 1;
 #else  #else
Line 318 
Line 319 
                         if (rval >= 0)          /* -1 == connected and cd-ed */                          if (rval >= 0)          /* -1 == connected and cd-ed */
                                 exit(rval);                                  exit(rval);
                 } else {                  } else {
   #ifndef SMALL
                         char *xargv[5];                          char *xargv[5];
   
                         if (setjmp(toplevel))                          if (setjmp(toplevel))
Line 334 
Line 336 
                                 if (!retry_connect)                                  if (!retry_connect)
                                         break;                                          break;
                                 if (!connected) {                                  if (!connected) {
 #ifndef SMALL  
                                         macnum = 0;                                          macnum = 0;
 #endif /* !SMALL */  
                                         fputs("Retrying...\n", ttyout);                                          fputs("Retrying...\n", ttyout);
                                         sleep(retry_connect);                                          sleep(retry_connect);
                                 }                                  }
                         } while (!connected);                          } while (!connected);
                         retry_connect = 0; /* connected, stop hiding msgs */                          retry_connect = 0; /* connected, stop hiding msgs */
   #endif /* !SMALL */
                 }                  }
         }          }
 #ifndef SMALL  #ifndef SMALL
         controlediting();          controlediting();
 #endif /* !SMALL */  
         top = setjmp(toplevel) == 0;          top = setjmp(toplevel) == 0;
         if (top) {          if (top) {
                 (void)signal(SIGINT, (sig_t)intr);                  (void)signal(SIGINT, (sig_t)intr);
Line 356 
Line 356 
                 cmdscanner(top);                  cmdscanner(top);
                 top = 1;                  top = 1;
         }          }
   #else /* !SMALL */
           usage();
   #endif /* !SMALL */
 }  }
   
 void  void
Line 399 
Line 402 
         errno = save_errno;          errno = save_errno;
 }  }
   
   #ifndef SMALL
 /*  /*
  * Generate a prompt   * Generate a prompt
  */   */
Line 416 
Line 420 
 {  {
         struct cmd *c;          struct cmd *c;
         int num;          int num;
 #ifndef SMALL  
         HistEvent hev;          HistEvent hev;
 #endif /* !SMALL */  
   
         if (!top          if (!top && !editing)
 #ifndef SMALL  
             && !editing  
 #endif /* !SMALL */  
             )  
                 (void)putc('\n', ttyout);                  (void)putc('\n', ttyout);
         for (;;) {          for (;;) {
 #ifndef SMALL  
                 if (!editing) {                  if (!editing) {
 #endif /* !SMALL */  
                         if (fromatty) {                          if (fromatty) {
                                 fputs(prompt(), ttyout);                                  fputs(prompt(), ttyout);
                                 (void)fflush(ttyout);                                  (void)fflush(ttyout);
Line 449 
Line 445 
                                         /* void */;                                          /* void */;
                                 break;                                  break;
                         } /* else it was a line without a newline */                          } /* else it was a line without a newline */
 #ifndef SMALL  
                 } else {                  } else {
                         const char *buf;                          const char *buf;
                         cursor_pos = NULL;                          cursor_pos = NULL;
Line 468 
Line 463 
                         line[num] = '\0';                          line[num] = '\0';
                         history(hist, &hev, H_ENTER, buf);                          history(hist, &hev, H_ENTER, buf);
                 }                  }
 #endif /* !SMALL */  
   
                 makeargv();                  makeargv();
                 if (margc == 0)                  if (margc == 0)
Line 479 
Line 473 
                         continue;                          continue;
                 }                  }
                 if (c == 0) {                  if (c == 0) {
 #ifndef SMALL  
                         /*                          /*
                          * Give editline(3) a shot at unknown commands.                           * Give editline(3) a shot at unknown commands.
                          * XXX - bogus commands with a colon in                           * XXX - bogus commands with a colon in
Line 487 
Line 480 
                          */                           */
                         if (editing &&                          if (editing &&
                             el_parse(el, margc, (const char **)margv) != 0)                              el_parse(el, margc, (const char **)margv) != 0)
 #endif /* !SMALL */  
                                 fputs("?Invalid command.\n", ttyout);                                  fputs("?Invalid command.\n", ttyout);
                         continue;                          continue;
                 }                  }
Line 558 
Line 550 
                 if (argp == NULL)                  if (argp == NULL)
                         break;                          break;
         }          }
 #ifndef SMALL  
         if (cursor_pos == line) {          if (cursor_pos == line) {
                 cursor_argc = 0;                  cursor_argc = 0;
                 cursor_argo = 0;                  cursor_argo = 0;
Line 566 
Line 557 
                 cursor_argc = margc;                  cursor_argc = margc;
                 cursor_argo = strlen(margv[margc-1]);                  cursor_argo = strlen(margv[margc-1]);
         }          }
 #endif /* !SMALL */  
 }  }
   
 #ifdef SMALL  
 #define INC_CHKCURSOR(x)        (x)++  
 #else  /* SMALL */  
 #define INC_CHKCURSOR(x)        { (x)++ ; \  #define INC_CHKCURSOR(x)        { (x)++ ; \
                                 if (x == cursor_pos) { \                                  if (x == cursor_pos) { \
                                         cursor_argc = margc; \                                          cursor_argc = margc; \
                                         cursor_argo = ap-argbase; \                                          cursor_argo = ap-argbase; \
                                         cursor_pos = NULL; \                                          cursor_pos = NULL; \
                                 } }                                  } }
   
 #endif /* SMALL */  
   
 /*  /*
  * Parse string into argbuf;   * Parse string into argbuf;
Line 753 
Line 738 
                                 c->c_name, c->c_help);                                  c->c_name, c->c_help);
         }          }
 }  }
   #endif /* !SMALL */
   
 void  void
 usage(void)  usage(void)
 {  {
         (void)fprintf(stderr,          (void)fprintf(stderr, "usage: %s "
             "usage: %s [-46Aa"  
 #ifndef SMALL  #ifndef SMALL
             "d"              "[-46AadEegimnptVv] [-k seconds] [-P port] "
               "[-r seconds] [host [port]]\n"
               "       %s [-C] "
 #endif /* !SMALL */  #endif /* !SMALL */
             "EegimnptVv] [-k seconds] [-P port] [-r seconds] [host [port]]\n"  
             "       %s "  
 #ifndef SMALL  
             "[-C] "  
 #endif /* !SMALL */  
             "[-o output] "              "[-o output] "
             "ftp://[user:password@]host[:port]/file[/]\n"              "ftp://[user:password@]host[:port]/file[/]\n"
             "       %s "              "       %s "
Line 787 
Line 769 
 #ifndef SMALL  #ifndef SMALL
             __progname, __progname, __progname, __progname, __progname);              __progname, __progname, __progname, __progname, __progname);
 #else /* !SMALL */  #else /* !SMALL */
             __progname, __progname, __progname, __progname);              __progname, __progname, __progname);
 #endif /* !SMALL */  #endif /* !SMALL */
         exit(1);          exit(1);
 }  }
   

Legend:
Removed from v.1.76  
changed lines
  Added in v.1.77