[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.176 and 1.177

version 1.176, 2019/03/14 21:41:30 version 1.177, 2019/03/14 23:14:27
Line 121 
Line 121 
         struct client           *client;          struct client           *client;
         u_int                    tag;          u_int                    tag;
         int                      flags;          int                      flags;
           time_t                   time;
   
         RB_HEAD(format_entry_tree, format_entry) tree;          RB_HEAD(format_entry_tree, format_entry) tree;
 };  };
Line 682 
Line 683 
   
         ft->tag = tag;          ft->tag = tag;
         ft->flags = flags;          ft->flags = flags;
           ft->time = time(NULL);
   
         format_add_cb(ft, "host", format_cb_host);          format_add_cb(ft, "host", format_cb_host);
         format_add_cb(ft, "host_short", format_cb_host_short);          format_add_cb(ft, "host_short", format_cb_host_short);
Line 1437 
Line 1439 
                 value = new;                  value = new;
         }          }
         else if (modifiers & FORMAT_EXPANDTIME) {          else if (modifiers & FORMAT_EXPANDTIME) {
                 new = format_expand_time(ft, value, 0);                  new = format_expand_time(ft, value);
                 free(value);                  free(value);
                 value = new;                  value = new;
         }          }
Line 1483 
Line 1485 
   
 /* Expand keys in a template, passing through strftime first. */  /* Expand keys in a template, passing through strftime first. */
 char *  char *
 format_expand_time(struct format_tree *ft, const char *fmt, time_t t)  format_expand_time(struct format_tree *ft, const char *fmt)
 {  {
         struct tm       *tm;          struct tm       *tm;
         char             s[2048];          char             s[2048];
Line 1491 
Line 1493 
         if (fmt == NULL || *fmt == '\0')          if (fmt == NULL || *fmt == '\0')
                 return (xstrdup(""));                  return (xstrdup(""));
   
         if (t == 0)          tm = localtime(&ft->time);
                 t = time(NULL);  
         tm = localtime(&t);  
   
         if (strftime(s, sizeof s, fmt, tm) == 0)          if (strftime(s, sizeof s, fmt, tm) == 0)
                 return (xstrdup(""));                  return (xstrdup(""));
   

Legend:
Removed from v.1.176  
changed lines
  Added in v.1.177