示例#1
0
文件: format.c 项目: FauxFaux/tmux
/* Set default format keys for paste buffer. */
void
format_paste_buffer(struct format_tree *ft, struct paste_buffer *pb)
{
	char	*pb_print = paste_print(pb, 50);

	format_add(ft, "buffer_size", "%zu", pb->size);
	format_add(ft, "buffer_sample", "%s", pb_print);

	free(pb_print);
}
示例#2
0
/* ARGSUSED */
int
cmd_list_buffers_exec(unused struct cmd *self, struct cmd_ctx *ctx)
{
	struct paste_buffer	*pb;
	u_int			 idx;
	char			*tmp;

	idx = 0;
	while ((pb = paste_walk_stack(&global_buffers, &idx)) != NULL) {
		tmp = paste_print(pb, 50);
		ctx->print(ctx,
		    "%u: %zu bytes: \"%s\"", idx - 1, pb->size, tmp);
		xfree(tmp);
	}

	return (0);
}
示例#3
0
int
cmd_list_buffers_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct cmd_target_data	*data = self->data;
	struct session		*s;
	struct paste_buffer	*pb;
	u_int			 idx;
	char			*tmp;

	if ((s = cmd_find_session(ctx, data->target)) == NULL)
		return (-1);

	idx = 0;
	while ((pb = paste_walk_stack(&s->buffers, &idx)) != NULL) {
		tmp = paste_print(pb, 50);
		ctx->print(ctx,
		    "%u: %zu bytes: \"%s\"", idx - 1, pb->size, tmp);
		xfree(tmp);
	}

	return (0);
}