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

Diff for /src/usr.bin/tmux/window.c between version 1.36 and 1.37

version 1.36, 2009/11/04 22:02:38 version 1.37, 2009/11/04 22:43:11
Line 56 
Line 56 
 /* Global window list. */  /* Global window list. */
 struct windows windows;  struct windows windows;
   
   void    window_pane_read_callback(struct bufferevent *, void *);
   void    window_pane_error_callback(struct bufferevent *, short, void *);
   
 RB_GENERATE(winlinks, winlink, entry, winlink_cmp);  RB_GENERATE(winlinks, winlink, entry, winlink_cmp);
   
 int  int
Line 412 
Line 415 
         wp->cwd = NULL;          wp->cwd = NULL;
   
         wp->fd = -1;          wp->fd = -1;
         wp->in = buffer_create(BUFSIZ);          wp->event = NULL;
         wp->out = buffer_create(BUFSIZ);  
   
         wp->mode = NULL;          wp->mode = NULL;
   
Line 442 
Line 444 
 void  void
 window_pane_destroy(struct window_pane *wp)  window_pane_destroy(struct window_pane *wp)
 {  {
         if (wp->fd != -1)          if (wp->fd != -1) {
                 close(wp->fd);                  close(wp->fd);
                   bufferevent_free(wp->event);
           }
   
         input_free(wp);          input_free(wp);
   
Line 457 
Line 461 
                 bufferevent_free(wp->pipe_event);                  bufferevent_free(wp->pipe_event);
         }          }
   
         buffer_destroy(wp->in);  
         buffer_destroy(wp->out);  
         event_del(&wp->event);  
   
         if (wp->cwd != NULL)          if (wp->cwd != NULL)
                 xfree(wp->cwd);                  xfree(wp->cwd);
         if (wp->shell != NULL)          if (wp->shell != NULL)
Line 484 
Line 484 
         struct termios           tio2;          struct termios           tio2;
         u_int                    i;          u_int                    i;
   
         if (wp->fd != -1)          if (wp->fd != -1) {
                 close(wp->fd);                  close(wp->fd);
                   bufferevent_free(wp->event);
           }
         if (cmd != NULL) {          if (cmd != NULL) {
                 if (wp->cmd != NULL)                  if (wp->cmd != NULL)
                         xfree(wp->cmd);                          xfree(wp->cmd);
Line 574 
Line 576 
                 fatal("fcntl failed");                  fatal("fcntl failed");
         if (fcntl(wp->fd, F_SETFD, FD_CLOEXEC) == -1)          if (fcntl(wp->fd, F_SETFD, FD_CLOEXEC) == -1)
                 fatal("fcntl failed");                  fatal("fcntl failed");
           wp->event = bufferevent_new(wp->fd,
               window_pane_read_callback, NULL, window_pane_error_callback, wp);
           bufferevent_enable(wp->event, EV_READ|EV_WRITE);
   
         return (0);          return (0);
 }  }
   
 void  void
   window_pane_read_callback(unused struct bufferevent *bufev, void *data)
   {
           struct window_pane *wp = data;
   
           window_pane_parse(wp);
   }
   
   void
   window_pane_error_callback(
       unused struct bufferevent *bufev, unused short what, void *data)
   {
           struct window_pane *wp = data;
   
           close(wp->fd);
           bufferevent_free(wp->event);
           wp->fd = -1;
   }
   
   void
 window_pane_resize(struct window_pane *wp, u_int sx, u_int sy)  window_pane_resize(struct window_pane *wp, u_int sx, u_int sy)
 {  {
         struct winsize  ws;          struct winsize  ws;
Line 631 
Line 655 
 void  void
 window_pane_parse(struct window_pane *wp)  window_pane_parse(struct window_pane *wp)
 {  {
           char   *data;
         size_t  new_size;          size_t  new_size;
   
         if (wp->mode != NULL)          if (wp->mode != NULL)
                 return;                  return;
   
         new_size = BUFFER_USED(wp->in) - wp->pipe_off;          new_size = EVBUFFER_LENGTH(wp->event->input) - wp->pipe_off;
         if (wp->pipe_fd != -1 && new_size > 0)          if (wp->pipe_fd != -1 && new_size > 0) {
                 bufferevent_write(wp->pipe_event, BUFFER_OUT(wp->in), new_size);                  data = EVBUFFER_DATA(wp->event->input);
                   bufferevent_write(wp->pipe_event, data, new_size);
           }
   
         input_parse(wp);          input_parse(wp);
   
         wp->pipe_off = BUFFER_USED(wp->in);          wp->pipe_off = EVBUFFER_LENGTH(wp->event->input);
 }  }
   
 void  void

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37