[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.27 and 1.28

version 1.27, 1997/04/05 19:53:10 version 1.28, 1997/04/10 00:17:10
Line 1 
Line 1 
 /*      $OpenBSD$       */  /*      $OpenBSD$       */
 /*      $NetBSD: main.c,v 1.20 1997/03/16 14:24:21 lukem Exp $  */  /*      $NetBSD: main.c,v 1.21 1997/04/05 03:27:39 lukem Exp $  */
   
 /*  /*
  * Copyright (c) 1985, 1989, 1993, 1994   * Copyright (c) 1985, 1989, 1993, 1994
Line 74 
Line 74 
         int ch, top, port, rval;          int ch, top, port, rval;
         struct passwd *pw = NULL;          struct passwd *pw = NULL;
         char *cp, homedir[MAXPATHLEN];          char *cp, homedir[MAXPATHLEN];
         int from_emacs;          int dumb_terminal = 0;
   
         sp = getservbyname("ftp", "tcp");          sp = getservbyname("ftp", "tcp");
         if (sp == 0)          if (sp == 0)
Line 95 
Line 95 
         progress = 0;          progress = 0;
 #ifndef SMALL  #ifndef SMALL
         editing = 0;          editing = 0;
           el = NULL;
           hist = NULL;
 #endif  #endif
         mark = HASHBYTES;          mark = HASHBYTES;
         marg_sl = sl_init();          marg_sl = sl_init();
Line 104 
Line 106 
         if (strcmp(cp, "pftp") == 0)          if (strcmp(cp, "pftp") == 0)
                 passivemode = 1;                  passivemode = 1;
   
         from_emacs = !strcmp(getenv("TERM"), "dumb");          dumb_terminal =
               (!strcmp(getenv("TERM"), "dumb") || !strcmp(getenv("TERM"), "su"));
         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 SMALL  #ifndef SMALL
                 if (!from_emacs)                  if (!dumb_terminal)
                         editing = 1;    /* editing mode on if from a tty */                          editing = 1;    /* editing mode on if from a tty */
 #endif  #endif
         }          }
         if (isatty(fileno(stdout)) && !from_emacs)          if (isatty(fileno(stdout)) && !dumb_terminal)
                 progress = 1;           /* progress bar on if going to a tty */                  progress = 1;           /* progress bar on if going to a tty */
   
         while ((ch = getopt(argc, argv, "adeginpPr:tvV")) != -1) {          while ((ch = getopt(argc, argv, "adeginpPr:tvV")) != -1) {
Line 127 
Line 130 
                         debug++;                          debug++;
                         break;                          break;
   
                 case 'e':       /* XXX should TERM=dumb be the only way to */                  case 'e':
 #ifndef SMALL                   /* turn off editing or not? */  #ifndef SMALL
                         editing = 0;                          editing = 0;
 #endif  #endif
                         break;                          break;
Line 201 
Line 204 
                 (void)strcpy(home, pw->pw_dir);                  (void)strcpy(home, pw->pw_dir);
         }          }
   
 #ifndef SMALL  
         if (argc > 0)                           /* batch mode */  
                 editing = 0;  
         if (editing) {  
                 el = el_init(__progname, stdin, stdout); /* init editline */  
   
                 hist = history_init();          /* init the builtin history */  
                 history(hist, H_EVENT, 100);    /* remember 100 events */  
                 el_set(el, EL_HIST, history, hist);     /* use history */  
   
                 el_set(el, EL_EDITOR, "emacs"); /* default editor is emacs */  
                 el_set(el, EL_PROMPT, prompt);  /* set the prompt function */  
   
                 /* add local file completion, bind to TAB */  
                 el_set(el, EL_ADDFN, "ftp-complete",  
                     "Context sensitive argument completion",  
                     complete);  
                 el_set(el, EL_BIND, "^I", "ftp-complete", NULL);  
   
                 el_source(el, NULL);    /* read ~/.editrc */  
         }  
 #endif /* !SMALL */  
   
         setttywidth(0);          setttywidth(0);
         (void)signal(SIGWINCH, setttywidth);          (void)signal(SIGWINCH, setttywidth);
 #ifndef SMALL  
         if (editing)  
                 el_set(el, EL_SIGNAL, 1);  
 #endif /* !SMALL */  
   
         if (argc > 0) {          if (argc > 0) {
                 if (strchr(argv[0], ':') != NULL) {                  if (strchr(argv[0], ':') != NULL) {
Line 261 
Line 237 
                         } while (!connected);                          } while (!connected);
                 }                  }
         }          }
   #ifndef SMALL
           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);

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28