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

Diff for /src/usr.bin/tmux/status.c between version 1.103 and 1.104

version 1.103, 2013/03/25 11:43:01 version 1.104, 2013/05/31 19:56:05
Line 38 
Line 38 
 void    status_job_callback(struct job *);  void    status_job_callback(struct job *);
 char   *status_print(  char   *status_print(
             struct client *, struct winlink *, time_t, struct grid_cell *);              struct client *, struct winlink *, time_t, struct grid_cell *);
 void    status_replace1(struct client *, struct session *, struct winlink *,  void    status_replace1(struct client *, char **, char **, char *, size_t, int);
             struct window_pane *, char **, char **, char *, size_t, int);  
 void    status_message_callback(int, short, void *);  void    status_message_callback(int, short, void *);
   
 const char *status_prompt_up_history(u_int *);  const char *status_prompt_up_history(u_int *);
Line 384 
Line 383 
   
 /* Replace a single special sequence (prefixed by #). */  /* Replace a single special sequence (prefixed by #). */
 void  void
 status_replace1(struct client *c, struct session *s, struct winlink *wl,  status_replace1(struct client *c, char **iptr, char **optr, char *out,
     struct window_pane *wp, char **iptr, char **optr, char *out,  
     size_t outsize, int jobsflag)      size_t outsize, int jobsflag)
 {  {
         char    ch, tmp[256], *ptr, *endptr, *freeptr;          char    ch, tmp[256], *ptr, *endptr;
         size_t  ptrlen;          size_t  ptrlen;
         long    limit;          long    limit;
         u_int   idx;  
   
         errno = 0;          errno = 0;
         limit = strtol(*iptr, &endptr, 10);          limit = strtol(*iptr, &endptr, 10);
Line 403 
Line 400 
         if (limit <= 0)          if (limit <= 0)
                 limit = LONG_MAX;                  limit = LONG_MAX;
   
         freeptr = NULL;  
   
         switch (*(*iptr)++) {          switch (*(*iptr)++) {
         case '(':          case '(':
                 if (!jobsflag) {                  if (!jobsflag) {
Line 414 
Line 409 
                 if ((ptr = status_find_job(c, iptr)) == NULL)                  if ((ptr = status_find_job(c, iptr)) == NULL)
                         return;                          return;
                 goto do_replace;                  goto do_replace;
         case 'D':  
                 xsnprintf(tmp, sizeof tmp, "%%%u", wp->id);  
                 ptr = tmp;  
                 goto do_replace;  
         case 'H':  
                 if (gethostname(tmp, sizeof tmp) != 0)  
                         fatal("gethostname failed");  
                 ptr = tmp;  
                 goto do_replace;  
         case 'h':  
                 if (gethostname(tmp, sizeof tmp) != 0)  
                         fatal("gethostname failed");  
                 if ((ptr = strchr(tmp, '.')) != NULL)  
                         *ptr = '\0';  
                 ptr = tmp;  
                 goto do_replace;  
         case 'I':  
                 xsnprintf(tmp, sizeof tmp, "%d", wl->idx);  
                 ptr = tmp;  
                 goto do_replace;  
         case 'P':  
                 if (window_pane_index(wp, &idx) != 0)  
                         fatalx("index not found");  
                 xsnprintf(tmp, sizeof tmp, "%u", idx);  
                 ptr = tmp;  
                 goto do_replace;  
         case 'S':  
                 ptr = s->name;  
                 goto do_replace;  
         case 'T':  
                 ptr = wp->base.title;  
                 goto do_replace;  
         case 'W':  
                 ptr = wl->window->name;  
                 goto do_replace;  
         case 'F':  
                 ptr = window_printable_flags(s, wl);  
                 freeptr = ptr;  
                 goto do_replace;  
         case '[':          case '[':
                 /*                  /*
                  * Embedded style, handled at display time. Leave present and                   * Embedded style, handled at display time. Leave present and
Line 466 
Line 422 
         case '#':          case '#':
                 *(*optr)++ = '#';                  *(*optr)++ = '#';
                 break;                  break;
           default:
                   xsnprintf(tmp, sizeof tmp, "#%c", *(*iptr - 1));
                   ptr = tmp;
                   goto do_replace;
         }          }
   
         return;          return;
Line 476 
Line 436 
                 ptrlen = limit;                  ptrlen = limit;
   
         if (*optr + ptrlen >= out + outsize - 1)          if (*optr + ptrlen >= out + outsize - 1)
                 goto out;                  return;
         while (ptrlen > 0 && *ptr != '\0') {          while (ptrlen > 0 && *ptr != '\0') {
                 *(*optr)++ = *ptr++;                  *(*optr)++ = *ptr++;
                 ptrlen--;                  ptrlen--;
         }          }
   
 out:  
         free(freeptr);  
         return;          return;
   
 skip_to:  skip_to:
Line 532 
Line 490 
                         *optr++ = ch;                          *optr++ = ch;
                         continue;                          continue;
                 }                  }
                 status_replace1(                  status_replace1(c, &iptr, &optr, out, sizeof out, jobsflag);
                     c, s, wl, wp, &iptr, &optr, out, sizeof out, jobsflag);  
         }          }
         *optr = '\0';          *optr = '\0';
   

Legend:
Removed from v.1.103  
changed lines
  Added in v.1.104