[BACK]Return to cmd-parse.y CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/cmd-parse.y between version 1.34 and 1.35

version 1.34, 2021/08/18 15:16:33 version 1.35, 2021/08/20 06:30:57
Line 778 
Line 778 
         }          }
 }  }
   
   static struct cmd *
   cmd_parse_build_command(struct cmd_parse_command *cmd,
       struct cmd_parse_input *pi, u_int line, struct cmd_parse_result *pr)
   {
           struct cmd      *add;
           char            *cause;
   
           add = cmd_parse(cmd->argc, cmd->argv, pi->file, line, &cause);
           if (add == NULL) {
                   pr->status = CMD_PARSE_ERROR;
                   pr->error = cmd_parse_get_error(pi->file, line, cause);
                   free(cause);
                   return (NULL);
           }
           return (add);
   }
   
 static struct cmd_parse_result *  static struct cmd_parse_result *
 cmd_parse_build_commands(struct cmd_parse_commands *cmds,  cmd_parse_build_commands(struct cmd_parse_commands *cmds,
     struct cmd_parse_input *pi)      struct cmd_parse_input *pi)
Line 787 
Line 804 
         struct cmd_parse_command        *cmd, *cmd2, *next, *next2, *after;          struct cmd_parse_command        *cmd, *cmd2, *next, *next2, *after;
         u_int                            line = UINT_MAX;          u_int                            line = UINT_MAX;
         int                              i;          int                              i;
         struct cmd_list                 *cmdlist = NULL, *result;          struct cmd_list                 *current = NULL, *result;
         struct cmd                      *add;          struct cmd                      *add;
         char                            *name, *alias, *cause, *s;          char                            *name, *alias, *cause, *s;
   
Line 859 
Line 876 
          */           */
         result = cmd_list_new();          result = cmd_list_new();
         TAILQ_FOREACH(cmd, cmds, entry) {          TAILQ_FOREACH(cmd, cmds, entry) {
                 name = cmd->argv[0];                  if (((~pi->flags & CMD_PARSE_ONEGROUP) && cmd->line != line)) {
                 log_debug("%s: %u %s", __func__, cmd->line, name);                          if (current != NULL) {
                 cmd_log_argv(cmd->argc, cmd->argv, __func__);                                  cmd_parse_print_commands(pi, line, current);
                                   cmd_list_move(result, current);
                 if (cmdlist == NULL ||                                  cmd_list_free(current);
                     ((~pi->flags & CMD_PARSE_ONEGROUP) && cmd->line != line)) {  
                         if (cmdlist != NULL) {  
                                 cmd_parse_print_commands(pi, line, cmdlist);  
                                 cmd_list_move(result, cmdlist);  
                                 cmd_list_free(cmdlist);  
                         }                          }
                         cmdlist = cmd_list_new();                          current = cmd_list_new();
                 }                  }
                   if (current == NULL)
                           current = cmd_list_new();
                 line = cmd->line;                  line = cmd->line;
   
                 add = cmd_parse(cmd->argc, cmd->argv, pi->file, line, &cause);                  add = cmd_parse_build_command(cmd, pi, line, &pr);
                 if (add == NULL) {                  if (add == NULL) {
                         cmd_list_free(result);                          cmd_list_free(result);
                         pr.status = CMD_PARSE_ERROR;                          cmd_list_free(current);
                         pr.error = cmd_parse_get_error(pi->file, line, cause);  
                         free(cause);  
                         cmd_list_free(cmdlist);  
                         goto out;                          goto out;
                 }                  }
                 cmd_list_append(cmdlist, add);                  cmd_list_append(current, add);
         }          }
         if (cmdlist != NULL) {          if (current != NULL) {
                 cmd_parse_print_commands(pi, line, cmdlist);                  cmd_parse_print_commands(pi, line, current);
                 cmd_list_move(result, cmdlist);                  cmd_list_move(result, current);
                 cmd_list_free(cmdlist);                  cmd_list_free(current);
         }          }
   
         s = cmd_list_print(result, 0);          s = cmd_list_print(result, 0);

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35