[BACK]Return to cfg.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/cfg.c between version 1.69 and 1.70

version 1.69, 2019/05/03 21:21:00 version 1.70, 2019/05/20 13:23:32
Line 82 
Line 82 
 start_cfg(void)  start_cfg(void)
 {  {
         const char      *home;          const char      *home;
         int              quiet = 0;          int              flags = 0;
         struct client   *c;          struct client   *c;
   
         /*          /*
Line 103 
Line 103 
         }          }
   
         if (cfg_file == NULL)          if (cfg_file == NULL)
                 load_cfg(TMUX_CONF, NULL, NULL, 1);                  load_cfg(TMUX_CONF, NULL, NULL, CFG_QUIET, NULL);
   
         if (cfg_file == NULL && (home = find_home()) != NULL) {          if (cfg_file == NULL && (home = find_home()) != NULL) {
                 xasprintf(&cfg_file, "%s/.tmux.conf", home);                  xasprintf(&cfg_file, "%s/.tmux.conf", home);
                 quiet = 1;                  flags = CFG_QUIET;
         }          }
         if (cfg_file != NULL)          if (cfg_file != NULL)
                 load_cfg(cfg_file, NULL, NULL, quiet);                  load_cfg(cfg_file, NULL, NULL, flags, NULL);
   
         cmdq_append(NULL, cmdq_get_callback(cfg_done, NULL));          cmdq_append(NULL, cmdq_get_callback(cfg_done, NULL));
 }  }
Line 239 
Line 239 
 }  }
   
 int  int
 load_cfg(const char *path, struct client *c, struct cmdq_item *item, int quiet)  load_cfg(const char *path, struct client *c, struct cmdq_item *item, int flags,
       struct cmdq_item **new_item)
 {  {
         FILE                    *f;          FILE                    *f;
         const char               delim[3] = { '\\', '\\', '\0' };          const char               delim[3] = { '\\', '\\', '\0' };
Line 247 
Line 248 
         size_t                   line = 0;          size_t                   line = 0;
         char                    *buf, *cause1, *p, *q;          char                    *buf, *cause1, *p, *q;
         struct cmd_list         *cmdlist;          struct cmd_list         *cmdlist;
         struct cmdq_item        *new_item;          struct cmdq_item        *new_item0;
         struct cfg_cond         *cond, *cond1;          struct cfg_cond         *cond, *cond1;
         struct cfg_conds         conds;          struct cfg_conds         conds;
         struct cmd_find_state   *fs = NULL;          struct cmd_find_state   *fs = NULL;
Line 262 
Line 263 
   
         log_debug("loading %s", path);          log_debug("loading %s", path);
         if ((f = fopen(path, "rb")) == NULL) {          if ((f = fopen(path, "rb")) == NULL) {
                 if (errno == ENOENT && quiet)                  if (errno == ENOENT && (flags & CFG_QUIET))
                         return (0);                          return (0);
                 cfg_add_cause("%s: %s", path, strerror(errno));                  cfg_add_cause("%s: %s", path, strerror(errno));
                 return (-1);                  return (-1);
Line 301 
Line 302 
                 }                  }
                 free(buf);                  free(buf);
   
                 new_item = cmdq_get_command(cmdlist, NULL, NULL, 0);                  new_item0 = cmdq_get_command(cmdlist, NULL, NULL, 0);
                 if (item != NULL) {                  if (item != NULL) {
                         cmdq_insert_after(item, new_item);                          cmdq_insert_after(item, new_item0);
                         item = new_item;                          item = new_item0;
                 } else                  } else
                         cmdq_append(c, new_item);                          cmdq_append(c, new_item0);
                 cmd_list_free(cmdlist);                  cmd_list_free(cmdlist);
   
                 found++;                  found++;
Line 319 
Line 320 
                 free(cond);                  free(cond);
         }          }
   
           if (new_item != NULL)
                   *new_item = item;
         return (found);          return (found);
 }  }
   

Legend:
Removed from v.1.69  
changed lines
  Added in v.1.70