[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.24 and 1.25

version 1.24, 1997/03/14 05:36:02 version 1.25, 1997/03/21 20:59:30
Line 1 
Line 1 
 /*      $OpenBSD$       */  /*      $OpenBSD$       */
 /*      $NetBSD: main.c,v 1.18 1997/03/13 06:23:19 lukem Exp $  */  /*      $NetBSD: main.c,v 1.20 1997/03/16 14:24:21 lukem Exp $  */
   
 /*  /*
  * Copyright (c) 1985, 1989, 1993, 1994   * Copyright (c) 1985, 1989, 1993, 1994
Line 92 
Line 92 
         preserve = 1;          preserve = 1;
         verbose = 0;          verbose = 0;
         progress = 0;          progress = 0;
 #ifndef SMALLFTP  #ifndef SMALL
         editing = 0;          editing = 0;
 #endif  #endif
         mark = HASHBYTES;          mark = HASHBYTES;
Line 106 
Line 106 
         fromatty = isatty(fileno(stdin));          fromatty = isatty(fileno(stdin));
         if (fromatty) {          if (fromatty) {
                 verbose = 1;            /* verbose if from a tty */                  verbose = 1;            /* verbose if from a tty */
 #ifndef SMALLFTP  #ifndef SMALL
                 editing = 1;            /* editing mode on if from a tty */                  editing = 1;            /* editing mode on if from a tty */
 #endif  #endif
         }          }
Line 125 
Line 125 
                         break;                          break;
   
                 case 'e':                  case 'e':
 #ifndef SMALLFTP  #ifndef SMALL
                         editing = 0;                          editing = 0;
 #endif  #endif
                         break;                          break;
Line 198 
Line 198 
                 (void)strcpy(home, pw->pw_dir);                  (void)strcpy(home, pw->pw_dir);
         }          }
   
 #ifndef SMALLFTP  #ifndef SMALL
         if (editing) {          if (editing) {
                 el = el_init(__progname, stdin, stdout); /* init editline */                  el = el_init(__progname, stdin, stdout); /* init editline */
   
Line 217 
Line 217 
   
                 el_source(el, NULL);    /* read ~/.editrc */                  el_source(el, NULL);    /* read ~/.editrc */
         }          }
 #endif /* !SMALLFTP */  #endif /* !SMALL */
   
         setttywidth(0);          setttywidth(0);
         (void)signal(SIGWINCH, setttywidth);          (void)signal(SIGWINCH, setttywidth);
 #ifndef SMALLFTP  #ifndef SMALL
         if (editing)          if (editing)
                 el_set(el, EL_SIGNAL, 1);                  el_set(el, EL_SIGNAL, 1);
 #endif /* !SMALLFTP */  #endif /* !SMALL */
   
         if (argc > 0) {          if (argc > 0) {
                 if (strchr(argv[0], ':') != NULL) {                  if (strchr(argv[0], ':') != NULL) {
Line 326 
Line 326 
         int num;          int num;
   
         if (!top          if (!top
 #ifndef SMALLFTP  #ifndef SMALL
             && !editing              && !editing
 #endif /* !SMALLFTP */  #endif /* !SMALL */
             )              )
                 (void)putchar('\n');                  (void)putchar('\n');
         for (;;) {          for (;;) {
 #ifndef SMALLFTP  #ifndef SMALL
                 if (!editing) {                  if (!editing) {
 #endif /* !SMALLFTP */  #endif /* !SMALL */
                         if (fromatty) {                          if (fromatty) {
                                 fputs(prompt(), stdout);                                  fputs(prompt(), stdout);
                                 (void)fflush(stdout);                                  (void)fflush(stdout);
Line 354 
Line 354 
                                         /* void */;                                          /* void */;
                                 break;                                  break;
                         } /* else it was a line without a newline */                          } /* else it was a line without a newline */
 #ifndef SMALLFTP  #ifndef SMALL
                 } else {                  } else {
                         const char *buf;                          const char *buf;
                         cursor_pos = NULL;                          cursor_pos = NULL;
Line 372 
Line 372 
                         line[num] = '\0';                          line[num] = '\0';
                         history(hist, H_ENTER, buf);                          history(hist, H_ENTER, buf);
                 }                  }
 #endif /* !SMALLFTP */  #endif /* !SMALL */
   
                 makeargv();                  makeargv();
                 if (margc == 0)                  if (margc == 0)
Line 383 
Line 383 
                         continue;                          continue;
                 }                  }
                 if (c == 0) {                  if (c == 0) {
 #ifndef SMALLFTP  #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
                          *       them will not elicit an error.                           *       them will not elicit an error.
                          */                           */
                         if (el_parse(el, margc, margv) != 0)                          if (el_parse(el, margc, margv) != 0)
 #endif /* !SMALLFTP */  #endif /* !SMALL */
                                 puts("?Invalid command.");                                  puts("?Invalid command.");
                         continue;                          continue;
                 }                  }
Line 462 
Line 462 
                 if (argp == NULL)                  if (argp == NULL)
                         break;                          break;
         }          }
 #ifndef SMALLFTP  #ifndef SMALL
         if (cursor_pos == line) {          if (cursor_pos == line) {
                 cursor_argc = 0;                  cursor_argc = 0;
                 cursor_argo = 0;                  cursor_argo = 0;
Line 470 
Line 470 
                 cursor_argc = margc;                  cursor_argc = margc;
                 cursor_argo = strlen(margv[margc-1]);                  cursor_argo = strlen(margv[margc-1]);
         }          }
 #endif /* !SMALLFTP */  #endif /* !SMALL */
 }  }
   
 #ifdef SMALLFTP  #ifdef SMALL
 #define INC_CHKCURSOR(x)        (x)++  #define INC_CHKCURSOR(x)        (x)++
 #else  /* !SMALLFTP */  #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; \
Line 483 
Line 483 
                                         cursor_pos = NULL; \                                          cursor_pos = NULL; \
                                 } }                                  } }
   
 #endif /* !SMALLFTP */  #endif /* !SMALL */
   
 /*  /*
  * Parse string into argbuf;   * Parse string into argbuf;

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25