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

Diff for /src/usr.bin/tmux/cmd-command-prompt.c between version 1.3 and 1.4

version 1.3, 2009/07/15 17:39:00 version 1.4, 2009/07/17 06:13:27
Line 31 
Line 31 
 int     cmd_command_prompt_exec(struct cmd *, struct cmd_ctx *);  int     cmd_command_prompt_exec(struct cmd *, struct cmd_ctx *);
   
 int     cmd_command_prompt_callback(void *, const char *);  int     cmd_command_prompt_callback(void *, const char *);
   void    cmd_command_prompt_free(void *);
   
 const struct cmd_entry cmd_command_prompt_entry = {  const struct cmd_entry cmd_command_prompt_entry = {
         "command-prompt", NULL,          "command-prompt", NULL,
Line 96 
Line 97 
                 cdata->template = NULL;                  cdata->template = NULL;
                 hdr = xstrdup(":");                  hdr = xstrdup(":");
         }          }
         status_prompt_set(c, hdr, cmd_command_prompt_callback, cdata, 0);          status_prompt_set(c, hdr,
               cmd_command_prompt_callback, cmd_command_prompt_free, cdata, 0);
         xfree(hdr);          xfree(hdr);
   
         return (0);          return (0);
Line 112 
Line 114 
         char                            *cause, *ptr, *buf, ch;          char                            *cause, *ptr, *buf, ch;
         size_t                           len, slen;          size_t                           len, slen;
   
         if (s == NULL) {          if (s == NULL)
                 xfree(cdata);  
                 return (0);                  return (0);
         }  
         slen = strlen(s);          slen = strlen(s);
   
         len = 0;          len = 0;
Line 139 
Line 139 
                                 break;                                  break;
                         }                          }
                 }                  }
                 xfree(cdata->template);  
   
                 buf[len] = '\0';                  buf[len] = '\0';
                 s = buf;                  s = buf;
         }          }
         xfree(cdata);  
   
         if (cmd_string_parse(s, &cmdlist, &cause) != 0) {          if (cmd_string_parse(s, &cmdlist, &cause) != 0) {
                 if (cause == NULL)                  if (cause == NULL)
Line 172 
Line 170 
         cmd_list_exec(cmdlist, &ctx);          cmd_list_exec(cmdlist, &ctx);
         cmd_list_free(cmdlist);          cmd_list_free(cmdlist);
   
         if (c->prompt_callback != (void *) &cmd_command_prompt_callback)          if (c->prompt_callbackfn != (void *) &cmd_command_prompt_callback)
                 return (1);                  return (1);
         return (0);          return (0);
   }
   
   void
   cmd_command_prompt_free(void *data)
   {
           struct cmd_command_prompt_data  *cdata = data;
   
           if (cdata->template != NULL)
                   xfree(cdata->template);
           xfree(cdata);
 }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4