[BACK]Return to main.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / usr.bin / ftp

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/usr.bin/ftp/main.c between version 1.113.6.1 and 1.114

version 1.113.6.1, 2009/05/13 19:19:50 version 1.114, 2009/04/12 07:07:41
Line 1 
Line 1 
 /*      $NetBSD$        */  /*      $NetBSD$        */
   
 /*-  /*-
  * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.   * Copyright (c) 1996-2008 The NetBSD Foundation, Inc.
  * All rights reserved.   * All rights reserved.
  *   *
  * This code is derived from software contributed to The NetBSD Foundation   * This code is derived from software contributed to The NetBSD Foundation
Line 129  __RCSID("$NetBSD$");
Line 129  __RCSID("$NetBSD$");
 #define NO_PROXY        "no_proxy"      /* env var with list of non-proxied  #define NO_PROXY        "no_proxy"      /* env var with list of non-proxied
                                          * hosts, comma or space separated */                                           * hosts, comma or space separated */
   
 static void     setupoption(const char *, const char *, const char *);  static void     setupoption(char *, char *, char *);
 int             main(int, char *[]);  int             main(int, char *[]);
   
 int  int
Line 137  main(int volatile argc, char **volatile 
Line 137  main(int volatile argc, char **volatile 
 {  {
         int ch, rval;          int ch, rval;
         struct passwd *pw;          struct passwd *pw;
         char *cp, *ep, *anonpass, *upload_path, *src_addr;          char *cp, *ep, *anonuser, *anonpass, *upload_path, *src_addr;
         const char *anonuser;  
         int dumbterm, s, isupload;          int dumbterm, s, isupload;
         size_t len;          size_t len;
         socklen_t slen;          socklen_t slen;
Line 392  main(int volatile argc, char **volatile 
Line 391  main(int volatile argc, char **volatile 
                 {                  {
                         int targc;                          int targc;
                         char *targv[6], *oac;                          char *targv[6], *oac;
                         char cmdbuf[MAX_C_NAME];  
   
                                 /* look for `dir,max[,incr]' */                                  /* look for `dir,max[,incr]' */
                         targc = 0;                          targc = 0;
                         (void)strlcpy(cmdbuf, "-T", sizeof(cmdbuf));                          targv[targc++] = "-T";
                         targv[targc++] = cmdbuf;  
                         oac = ftp_strdup(optarg);                          oac = ftp_strdup(optarg);
   
                         while ((cp = strsep(&oac, ",")) != NULL) {                          while ((cp = strsep(&oac, ",")) != NULL) {
Line 547  main(int volatile argc, char **volatile 
Line 544  main(int volatile argc, char **volatile 
                                 goto sigint_or_rval_exit;                                  goto sigint_or_rval_exit;
                 } else {                  } else {
                         char *xargv[4], *uuser, *host;                          char *xargv[4], *uuser, *host;
                         char cmdbuf[MAXPATHLEN];  
   
                         if ((rval = sigsetjmp(toplevel, 1)))                          if ((rval = sigsetjmp(toplevel, 1)))
                                 goto sigint_or_rval_exit;                                  goto sigint_or_rval_exit;
Line 561  main(int volatile argc, char **volatile 
Line 557  main(int volatile argc, char **volatile 
                                 uuser = host;                                  uuser = host;
                                 host = cp + 1;                                  host = cp + 1;
                         }                          }
                         (void)strlcpy(cmdbuf, getprogname(), sizeof(cmdbuf));                          /* XXX discards const */
                         xargv[0] = cmdbuf;                          xargv[0] = (char *)getprogname();
                         xargv[1] = host;                          xargv[1] = host;
                         xargv[2] = argv[1];                          xargv[2] = argv[1];
                         xargv[3] = NULL;                          xargv[3] = NULL;
Line 660  cmdscanner(void)
Line 656  cmdscanner(void)
         size_t           num;          size_t           num;
 #endif  #endif
         int              len;          int              len;
         char             cmdbuf[MAX_C_NAME];  
   
         for (;;) {          for (;;) {
 #ifndef NO_EDITCOMPLETE  #ifndef NO_EDITCOMPLETE
Line 747  cmdscanner(void)
Line 742  cmdscanner(void)
                         continue;                          continue;
                 }                  }
                 confirmrest = 0;                  confirmrest = 0;
                 (void)strlcpy(cmdbuf, c->c_name, sizeof(cmdbuf));                  margv[0] = c->c_name;
                 margv[0] = cmdbuf;  
                 (*c->c_handler)(margc, margv);                  (*c->c_handler)(margc, margv);
                 if (bell && c->c_bell)                  if (bell && c->c_bell)
                         (void)putc('\007', ttyout);                          (void)putc('\007', ttyout);
Line 842  makeargv(void)
Line 836  makeargv(void)
 char *  char *
 slurpstring(void)  slurpstring(void)
 {  {
         static char bangstr[2] = { '!', '\0' };  
         static char dollarstr[2] = { '$', '\0' };  
         int got_one = 0;          int got_one = 0;
         char *sb = stringbase;          char *sb = stringbase;
         char *ap = argbase;          char *ap = argbase;
Line 854  slurpstring(void)
Line 846  slurpstring(void)
                         case 0:                          case 0:
                                 slrflag++;                                  slrflag++;
                                 INC_CHKCURSOR(stringbase);                                  INC_CHKCURSOR(stringbase);
                                 return ((*sb == '!') ? bangstr : dollarstr);                                  return ((*sb == '!') ? "!" : "$");
                                 /* NOTREACHED */                                  /* NOTREACHED */
                         case 1:                          case 1:
                                 slrflag++;                                  slrflag++;
Line 977  void
Line 969  void
 help(int argc, char *argv[])  help(int argc, char *argv[])
 {  {
         struct cmd *c;          struct cmd *c;
         char *nargv[1], *cmd;          char *nargv[1], *p, *cmd;
         const char *p;  
         int isusage;          int isusage;
   
         cmd = argv[0];          cmd = argv[0];
Line 996  help(int argc, char *argv[])
Line 987  help(int argc, char *argv[])
                     proxy ? "Proxy c" : "C");                      proxy ? "Proxy c" : "C");
                 for (c = cmdtab; (p = c->c_name) != NULL; c++)                  for (c = cmdtab; (p = c->c_name) != NULL; c++)
                         if (!proxy || c->c_proxy)                          if (!proxy || c->c_proxy)
                                 ftp_sl_add(buf, ftp_strdup(p));                                  ftp_sl_add(buf, p);
                 list_vertical(buf);                  list_vertical(buf);
                 sl_free(buf, 1);                  sl_free(buf, 0);
                 return;                  return;
         }          }
   
Line 1006  help(int argc, char *argv[])
Line 997  help(int argc, char *argv[])
   
         while (--argc > 0) {          while (--argc > 0) {
                 char *arg;                  char *arg;
                 char cmdbuf[MAX_C_NAME];  
   
                 arg = *++argv;                  arg = *++argv;
                 c = getcmd(arg);                  c = getcmd(arg);
Line 1018  help(int argc, char *argv[])
Line 1008  help(int argc, char *argv[])
                             cmd, arg);                              cmd, arg);
                 else {                  else {
                         if (isusage) {                          if (isusage) {
                                 (void)strlcpy(cmdbuf, c->c_name, sizeof(cmdbuf));                                  nargv[0] = c->c_name;
                                 nargv[0] = cmdbuf;  
                                 (*c->c_handler)(0, nargv);                                  (*c->c_handler)(0, nargv);
                         } else                          } else
                                 fprintf(ttyout, "%-*s\t%s\n", HELPINDENT,                                  fprintf(ttyout, "%-*s\t%s\n", HELPINDENT,
Line 1058  getoptionvalue(const char *name)
Line 1047  getoptionvalue(const char *name)
 }  }
   
 static void  static void
 setupoption(const char *name, const char *value, const char *defaultvalue)  setupoption(char *name, char *value, char *defaultvalue)
 {  {
         set_option(name, value ? value : defaultvalue, 0);          char *nargv[3];
           int overbose;
   
           nargv[0] = "setupoption()";
           nargv[1] = name;
           nargv[2] = (value ? value : defaultvalue);
           overbose = verbose;
           verbose = 0;
           setoption(3, nargv);
           verbose = overbose;
 }  }
   
 void  void

Legend:
Removed from v.1.113.6.1  
changed lines
  Added in v.1.114

CVSweb <webmaster@jp.NetBSD.org>