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

Diff for /src/usr.bin/tmux/format.c between version 1.183 and 1.184

version 1.183, 2019/03/18 09:46:42 version 1.184, 2019/03/18 14:10:25
Line 701 
Line 701 
 struct format_tree *  struct format_tree *
 format_create(struct client *c, struct cmdq_item *item, int tag, int flags)  format_create(struct client *c, struct cmdq_item *item, int tag, int flags)
 {  {
         struct format_tree      *ft;          struct format_tree               *ft;
           const struct window_mode        **wm;
           char                              tmp[64];
   
         if (!event_initialized(&format_job_event)) {          if (!event_initialized(&format_job_event)) {
                 evtimer_set(&format_job_event, format_job_timer, NULL);                  evtimer_set(&format_job_event, format_job_timer, NULL);
Line 727 
Line 729 
         format_add(ft, "socket_path", "%s", socket_path);          format_add(ft, "socket_path", "%s", socket_path);
         format_add_tv(ft, "start_time", &start_time);          format_add_tv(ft, "start_time", &start_time);
   
           for (wm = all_window_modes; *wm != NULL; wm++) {
                   if ((*wm)->default_format != NULL) {
                           xsnprintf(tmp, sizeof tmp, "%s_format", (*wm)->name);
                           tmp[strcspn(tmp, "-")] = '_';
                           format_add(ft, tmp, "%s", (*wm)->default_format);
                   }
           }
   
         if (item != NULL) {          if (item != NULL) {
                 if (item->cmd != NULL)                  if (item->cmd != NULL)
                         format_add(ft, "command", "%s", item->cmd->entry->name);                          format_add(ft, "command", "%s", item->cmd->entry->name);
Line 754 
Line 764 
                 server_client_unref(ft->client);                  server_client_unref(ft->client);
         free(ft);          free(ft);
 }  }
   
   /* Walk each format. */
   void
   format_each(struct format_tree *ft, void (*cb)(const char *, const char *,
       void *), void *arg)
   {
           struct format_entry     *fe;
           static char              s[64];
   
           RB_FOREACH(fe, format_entry_tree, &ft->tree) {
                   if (fe->t != 0) {
                           xsnprintf(s, sizeof s, "%lld", (long long)fe->t);
                           cb(fe->key, fe->value, s);
                   } else {
                           if (fe->value == NULL && fe->cb != NULL) {
                                   fe->cb(ft, fe);
                                   if (fe->value == NULL)
                                           fe->value = xstrdup("");
                           }
                           cb(fe->key, fe->value, arg);
                   }
           }
   }
   
   
 /* Add a key-value pair. */  /* Add a key-value pair. */
 void  void

Legend:
Removed from v.1.183  
changed lines
  Added in v.1.184