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

Diff for /src/usr.bin/tmux/cmd-load-buffer.c between version 1.21 and 1.22

version 1.21, 2012/07/10 11:53:01 version 1.22, 2012/07/11 07:10:15
Line 30 
Line 30 
  * Loads a paste buffer from a file.   * Loads a paste buffer from a file.
  */   */
   
 int     cmd_load_buffer_exec(struct cmd *, struct cmd_ctx *);  enum cmd_retval  cmd_load_buffer_exec(struct cmd *, struct cmd_ctx *);
 void    cmd_load_buffer_callback(struct client *, int, void *);  void             cmd_load_buffer_callback(struct client *, int, void *);
   
 const struct cmd_entry cmd_load_buffer_entry = {  const struct cmd_entry cmd_load_buffer_entry = {
         "load-buffer", "loadb",          "load-buffer", "loadb",
Line 43 
Line 43 
         cmd_load_buffer_exec          cmd_load_buffer_exec
 };  };
   
 int  enum cmd_retval
 cmd_load_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)  cmd_load_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
 {  {
         struct args     *args = self->args;          struct args     *args = self->args;
Line 63 
Line 63 
                 if (cause != NULL) {                  if (cause != NULL) {
                         ctx->error(ctx, "buffer %s", cause);                          ctx->error(ctx, "buffer %s", cause);
                         free(cause);                          free(cause);
                         return (-1);                          return (CMD_RETURN_ERROR);
                 }                  }
         }          }
   
Line 77 
Line 77 
                 if (error != 0) {                  if (error != 0) {
                         ctx->error(ctx, "%s: %s", path, cause);                          ctx->error(ctx, "%s: %s", path, cause);
                         free(cause);                          free(cause);
                         return (-1);                          return (CMD_RETURN_ERROR);
                 }                  }
                 return (1);                  return (CMD_RETURN_YIELD);
         }          }
   
         if (c != NULL)          if (c != NULL)
Line 97 
Line 97 
         }          }
         if ((f = fopen(path, "rb")) == NULL) {          if ((f = fopen(path, "rb")) == NULL) {
                 ctx->error(ctx, "%s: %s", path, strerror(errno));                  ctx->error(ctx, "%s: %s", path, strerror(errno));
                 return (-1);                  return (CMD_RETURN_ERROR);
         }          }
   
         pdata = NULL;          pdata = NULL;
Line 123 
Line 123 
         limit = options_get_number(&global_options, "buffer-limit");          limit = options_get_number(&global_options, "buffer-limit");
         if (buffer == -1) {          if (buffer == -1) {
                 paste_add(&global_buffers, pdata, psize, limit);                  paste_add(&global_buffers, pdata, psize, limit);
                 return (0);                  return (CMD_RETURN_NORMAL);
         }          }
         if (paste_replace(&global_buffers, buffer, pdata, psize) != 0) {          if (paste_replace(&global_buffers, buffer, pdata, psize) != 0) {
                 ctx->error(ctx, "no buffer %d", buffer);                  ctx->error(ctx, "no buffer %d", buffer);
                 free(pdata);                  free(pdata);
                 return (-1);                  return (CMD_RETURN_ERROR);
         }          }
   
         return (0);          return (CMD_RETURN_NORMAL);
   
 error:  error:
         free(pdata);          free(pdata);
         if (f != NULL)          if (f != NULL)
                 fclose(f);                  fclose(f);
         return (-1);          return (CMD_RETURN_ERROR);
 }  }
   
 void  void

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22