[BACK]Return to cmd-unbind-key.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/cmd-unbind-key.c between version 1.14 and 1.15

version 1.14, 2012/07/10 11:53:01 version 1.15, 2012/07/11 07:10:15
Line 26 
Line 26 
  * Unbind key from command.   * Unbind key from command.
  */   */
   
 int     cmd_unbind_key_check(struct args *);  enum cmd_retval  cmd_unbind_key_check(struct args *);
 int     cmd_unbind_key_exec(struct cmd *, struct cmd_ctx *);  enum cmd_retval  cmd_unbind_key_exec(struct cmd *, struct cmd_ctx *);
   enum cmd_retval  cmd_unbind_key_table(struct cmd *, struct cmd_ctx *, int);
   
 int     cmd_unbind_key_table(struct cmd *, struct cmd_ctx *, int);  
   
 const struct cmd_entry cmd_unbind_key_entry = {  const struct cmd_entry cmd_unbind_key_entry = {
         "unbind-key", "unbind",          "unbind-key", "unbind",
         "acnt:", 0, 1,          "acnt:", 0, 1,
Line 41 
Line 40 
         cmd_unbind_key_exec          cmd_unbind_key_exec
 };  };
   
 int  enum cmd_retval
 cmd_unbind_key_check(struct args *args)  cmd_unbind_key_check(struct args *args)
 {  {
         if (args_has(args, 'a') && args->argc != 0)          if (args_has(args, 'a') && args->argc != 0)
                 return (-1);                  return (CMD_RETURN_ERROR);
         if (!args_has(args, 'a') && args->argc != 1)          if (!args_has(args, 'a') && args->argc != 1)
                 return (-1);                  return (CMD_RETURN_ERROR);
         return (0);          return (CMD_RETURN_NORMAL);
 }  }
   
 int  enum cmd_retval
 cmd_unbind_key_exec(struct cmd *self, unused struct cmd_ctx *ctx)  cmd_unbind_key_exec(struct cmd *self, unused struct cmd_ctx *ctx)
 {  {
         struct args             *args = self->args;          struct args             *args = self->args;
Line 62 
Line 61 
                 key = key_string_lookup_string(args->argv[0]);                  key = key_string_lookup_string(args->argv[0]);
                 if (key == KEYC_NONE) {                  if (key == KEYC_NONE) {
                         ctx->error(ctx, "unknown key: %s", args->argv[0]);                          ctx->error(ctx, "unknown key: %s", args->argv[0]);
                         return (-1);                          return (CMD_RETURN_ERROR);
                 }                  }
         } else          } else
                 key = KEYC_NONE;                  key = KEYC_NONE;
Line 75 
Line 74 
                         bd = RB_ROOT(&key_bindings);                          bd = RB_ROOT(&key_bindings);
                         key_bindings_remove(bd->key);                          key_bindings_remove(bd->key);
                 }                  }
                 return (0);                  return (CMD_RETURN_NORMAL);
         }          }
   
         if (!args_has(args, 'n'))          if (!args_has(args, 'n'))
                 key |= KEYC_PREFIX;                  key |= KEYC_PREFIX;
         key_bindings_remove(key);          key_bindings_remove(key);
         return (0);          return (CMD_RETURN_NORMAL);
 }  }
   
 int  enum cmd_retval
 cmd_unbind_key_table(struct cmd *self, struct cmd_ctx *ctx, int key)  cmd_unbind_key_table(struct cmd *self, struct cmd_ctx *ctx, int key)
 {  {
         struct args                     *args = self->args;          struct args                     *args = self->args;
Line 95 
Line 94 
         tablename = args_get(args, 't');          tablename = args_get(args, 't');
         if ((mtab = mode_key_findtable(tablename)) == NULL) {          if ((mtab = mode_key_findtable(tablename)) == NULL) {
                 ctx->error(ctx, "unknown key table: %s", tablename);                  ctx->error(ctx, "unknown key table: %s", tablename);
                 return (-1);                  return (CMD_RETURN_ERROR);
         }          }
   
         if (key == KEYC_NONE) {          if (key == KEYC_NONE) {
Line 104 
Line 103 
                         RB_REMOVE(mode_key_tree, mtab->tree, mbind);                          RB_REMOVE(mode_key_tree, mtab->tree, mbind);
                         free(mbind);                          free(mbind);
                 }                  }
                 return (0);                  return (CMD_RETURN_NORMAL);
         }          }
   
         mtmp.key = key;          mtmp.key = key;
Line 113 
Line 112 
                 RB_REMOVE(mode_key_tree, mtab->tree, mbind);                  RB_REMOVE(mode_key_tree, mtab->tree, mbind);
                 free(mbind);                  free(mbind);
         }          }
         return (0);          return (CMD_RETURN_NORMAL);
 }  }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15