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

Diff for /src/usr.bin/tmux/cmd-capture-pane.c between version 1.13 and 1.14

version 1.13, 2012/12/09 23:17:35 version 1.14, 2013/03/21 18:43:34
Line 24 
Line 24 
 #include "tmux.h"  #include "tmux.h"
   
 /*  /*
  * Write the entire contents of a pane to a buffer.   * Write the entire contents of a pane to a buffer or stdout.
  */   */
   
 enum cmd_retval  cmd_capture_pane_exec(struct cmd *, struct cmd_ctx *);  enum cmd_retval  cmd_capture_pane_exec(struct cmd *, struct cmd_ctx *);
   
 const struct cmd_entry cmd_capture_pane_entry = {  const struct cmd_entry cmd_capture_pane_entry = {
         "capture-pane", "capturep",          "capture-pane", "capturep",
         "b:E:S:t:", 0, 0,          "b:c:E:pS:t:", 0, 0,
         "[-b buffer-index] [-E end-line] [-S start-line] "          "[-p] [-c target-client] [-b buffer-index] [-E end-line] "
           "[-S start-line] "
         CMD_TARGET_PANE_USAGE,          CMD_TARGET_PANE_USAGE,
         0,          0,
         NULL,          NULL,
Line 44 
Line 45 
 cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx)  cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 {  {
         struct args             *args = self->args;          struct args             *args = self->args;
           struct client           *c;
         struct window_pane      *wp;          struct window_pane      *wp;
         char                    *buf, *line, *cause;          char                    *buf, *line, *cause;
         struct screen           *s;          struct screen           *s;
Line 52 
Line 54 
         u_int                    i, limit, top, bottom, tmp;          u_int                    i, limit, top, bottom, tmp;
         size_t                   len, linelen;          size_t                   len, linelen;
   
           if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL)
                   return (CMD_RETURN_ERROR);
   
         if (cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp) == NULL)          if (cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp) == NULL)
                 return (CMD_RETURN_ERROR);                  return (CMD_RETURN_ERROR);
         s = &wp->base;          s = &wp->base;
Line 100 
Line 105 
                free(line);                 free(line);
         }          }
   
         limit = options_get_number(&global_options, "buffer-limit");          if (args_has(args, 'p')) {
                   if (c == NULL) {
                           ctx->error(ctx, "can't write to stdout");
                           return (CMD_RETURN_ERROR);
                   }
                   evbuffer_add(c->stdout_data, buf, len);
                   server_push_stdout(c);
           } else {
                   limit = options_get_number(&global_options, "buffer-limit");
                   if (!args_has(args, 'b')) {
                           paste_add(&global_buffers, buf, len, limit);
                           return (CMD_RETURN_NORMAL);
                   }
   
         if (!args_has(args, 'b')) {                  buffer = args_strtonum(args, 'b', 0, INT_MAX, &cause);
                 paste_add(&global_buffers, buf, len, limit);                  if (cause != NULL) {
                 return (CMD_RETURN_NORMAL);                          ctx->error(ctx, "buffer %s", cause);
         }                          free(buf);
                           free(cause);
                           return (CMD_RETURN_ERROR);
                   }
   
         buffer = args_strtonum(args, 'b', 0, INT_MAX, &cause);                  if (paste_replace(&global_buffers, buffer, buf, len) != 0) {
         if (cause != NULL) {                          ctx->error(ctx, "no buffer %d", buffer);
                 ctx->error(ctx, "buffer %s", cause);                          free(buf);
                 free(buf);                          return (CMD_RETURN_ERROR);
                 free(cause);                  }
                 return (CMD_RETURN_ERROR);  
         }  
   
         if (paste_replace(&global_buffers, buffer, buf, len) != 0) {  
                 ctx->error(ctx, "no buffer %d", buffer);  
                 free(buf);  
                 return (CMD_RETURN_ERROR);  
         }          }
   
         return (CMD_RETURN_NORMAL);          return (CMD_RETURN_NORMAL);

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14