• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cmd_find_client函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cmd_find_client函数的典型用法代码示例。如果您正苦于以下问题:C++ cmd_find_client函数的具体用法?C++ cmd_find_client怎么用?C++ cmd_find_client使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cmd_find_client函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: cmd_run_shell_exec

static enum cmd_retval
cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item)
{
	struct args			*args = self->args;
	struct cmd_run_shell_data	*cdata;
	struct client			*c = cmd_find_client(item, NULL, 1);
	struct session			*s = item->target.s;
	struct winlink			*wl = item->target.wl;
	struct window_pane		*wp = item->target.wp;

	cdata = xcalloc(1, sizeof *cdata);
	cdata->cmd = format_single(item, args->argv[0], c, s, wl, wp);

	if (args_has(args, 't') && wp != NULL)
		cdata->wp_id = wp->id;
	else
		cdata->wp_id = -1;

	if (!args_has(args, 'b'))
		cdata->item = item;

	job_run(cdata->cmd, s, server_client_get_cwd(item->client, s), NULL,
	    cmd_run_shell_callback, cmd_run_shell_free, cdata, 0);

	if (args_has(args, 'b'))
		return (CMD_RETURN_NORMAL);
	return (CMD_RETURN_WAIT);
}
开发者ID:jaredmcneill,项目名称:netbsd-src,代码行数:28,代码来源:cmd-run-shell.c


示例2: cmd_display_message_exec

int
cmd_display_message_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct args		*args = self->args;
	struct client		*c;
	struct session		*s;
	struct winlink		*wl;
	struct window_pane	*wp;
	const char		*template;
	char			*msg;
	struct format_tree	*ft;
	char			 out[BUFSIZ];
	time_t			 t;
	size_t			 len;

	if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL)
		return (-1);

	if (args_has(args, 't')) {
		wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp);
		if (wl == NULL)
			return (-1);
	} else {
		wl = cmd_find_pane(ctx, NULL, &s, &wp);
		if (wl == NULL)
			return (-1);
	}

	if (args_has(args, 'F') && args->argc != 0) {
		ctx->error(ctx, "only one of -F or argument must be given");
		return (-1);
	}
开发者ID:muratayusuke,项目名称:tmux,代码行数:32,代码来源:cmd-display-message.c


示例3: cmd_detach_client_exec

int
cmd_detach_client_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct args	*args = self->args;
	struct client	*c;
	struct session 	*s;
	enum msgtype     msgtype;
	u_int 		 i;

	if (args_has(args, 'P'))
		msgtype = MSG_DETACHKILL;
	else
		msgtype = MSG_DETACH;

	if (args_has(args, 's')) {
		s = cmd_find_session(ctx, args_get(args, 's'), 0);
		if (s == NULL)
			return (-1);

		for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
			c = ARRAY_ITEM(&clients, i);
			if (c != NULL && c->session == s)
				server_write_client(c, msgtype, NULL, 0);
		}
	} else {
		c = cmd_find_client(ctx, args_get(args, 't'));
		if (c == NULL)
			return (-1);

		server_write_client(c, msgtype, NULL, 0);
	}

	return (0);
}
开发者ID:smorin,项目名称:tmux-2,代码行数:34,代码来源:cmd-detach-client.c


示例4: cmd_switch_client_exec

int
cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct cmd_switch_client_data	*data = self->data;
	struct client			*c;
	struct session			*s;

	if (data == NULL)
		return (0);

	if ((c = cmd_find_client(ctx, data->name)) == NULL)
		return (-1);

	if (data->flag_next) {
		if ((s = session_next_session(c->session)) == NULL) {
			ctx->error(ctx, "can't find next session");
			return (-1);
		}
	} else if (data->flag_previous) {
		if ((s = session_previous_session(c->session)) == NULL) {
			ctx->error(ctx, "can't find previous session");
			return (-1);
		}
	} else
		s = cmd_find_session(ctx, data->target);

	if (s == NULL)
		return (-1);
	c->session = s;

	recalculate_sizes();
	server_redraw_client(c);

	return (0);
}
开发者ID:ronin13,项目名称:Tmux,代码行数:35,代码来源:cmd-switch-client.c


示例5: cmd_display_message_exec

int
cmd_display_message_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct args		*args = self->args;
	struct client		*c;
	struct session		*s;
	struct winlink		*wl;
	struct window_pane	*wp;
	const char		*template;
	char			*msg;

	if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL)
		return (-1);

	if (args_has(args, 't') != 0) {
		wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp);
		if (wl == NULL)
			return (-1);
	} else {
		s = NULL;
		wl = NULL;
		wp = NULL;
	}

	if (args->argc == 0)
开发者ID:smorin,项目名称:tmux-2,代码行数:25,代码来源:cmd-display-message.c


示例6: cmd_break_pane_exec

int
cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
{
    struct args		*args = self->args;
    struct winlink		*wl;
    struct session		*s;
    struct window_pane	*wp;
    struct window		*w;
    char			*name;
    char			*cause;
    int			 base_idx;
    struct client		*c;

    if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL)
        return (-1);

    if (window_count_panes(wl->window) == 1) {
        ctx->error(ctx, "can't break with only one pane");
        return (-1);
    }

    w = wl->window;
    TAILQ_REMOVE(&w->panes, wp, entry);
    if (wp == w->active) {
        w->active = w->last;
        w->last = NULL;
        if (w->active == NULL) {
            w->active = TAILQ_PREV(wp, window_panes, entry);
            if (w->active == NULL)
                w->active = TAILQ_NEXT(wp, entry);
        }
    } else if (wp == w->last)
        w->last = NULL;
    layout_close_pane(wp);

    w = wp->window = window_create1(s->sx, s->sy);
    TAILQ_INSERT_HEAD(&w->panes, wp, entry);
    w->active = wp;
    name = default_window_name(w);
    window_set_name(w, name);
    xfree(name);
    layout_init(w);

    base_idx = options_get_number(&s->options, "base-index");
    wl = session_attach(s, w, -1 - base_idx, &cause); /* can't fail */
    if (!args_has(self->args, 'd'))
        session_select(s, wl->idx);

    server_redraw_session(s);
    server_status_session_group(s);

    /* Output the window ID for control clients. */
    c = cmd_find_client(ctx, NULL);
    if (c->flags & CLIENT_CONTROL) {
        ctx->print(ctx, "%d", w->id);
    }

    return (0);
}
开发者ID:bholt,项目名称:tmux,代码行数:59,代码来源:cmd-break-pane.c


示例7: cmd_new_window_exec

static enum cmd_retval
cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
{
	struct args		*args = self->args;
	struct cmd_find_state	*current = &item->shared->current;
	struct session		*s = item->target.s;
	struct winlink		*wl = item->target.wl;
	struct client		*c = cmd_find_client(item, NULL, 1);
	int			 idx = item->target.idx;
	const char		*cmd, *path, *template, *tmp;
开发者ID:jaredmcneill,项目名称:netbsd-src,代码行数:10,代码来源:cmd-new-window.c


示例8: cmd_switch_client_exec

int
cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct args	*args = self->args;
	struct client	*c;
	struct session	*s;

	if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL)
		return (-1);

	if (args_has(args, 'r')) {
		if (c->flags & CLIENT_READONLY) {
			c->flags &= ~CLIENT_READONLY;
			ctx->info(ctx, "made client writable");
		} else {
			c->flags |= CLIENT_READONLY;
			ctx->info(ctx, "made client read-only");
		}
	}

	s = NULL;
	if (args_has(args, 'n')) {
		if ((s = session_next_session(c->session)) == NULL) {
			ctx->error(ctx, "can't find next session");
			return (-1);
		}
	} else if (args_has(args, 'p')) {
		if ((s = session_previous_session(c->session)) == NULL) {
			ctx->error(ctx, "can't find previous session");
			return (-1);
		}
	} else if (args_has(args, 'l')) {
		if (c->last_session != NULL && session_alive(c->last_session))
			s = c->last_session;
		if (s == NULL) {
			ctx->error(ctx, "can't find last session");
			return (-1);
		}
	} else
		s = cmd_find_session(ctx, args_get(args, 't'), 0);
	if (s == NULL)
		return (-1);

	if (c->session != NULL)
		c->last_session = c->session;
	c->session = s;
	session_update_activity(s);

	recalculate_sizes();
	server_check_unattached();
	server_redraw_client(c);
	s->curw->flags &= ~WINLINK_ALERTFLAGS;

	return (0);
}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:55,代码来源:cmd-switch-client.c


示例9: cmd_display_message_exec

int
cmd_display_message_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct cmd_target_data	*data = self->data;
	struct client		*c;
	const char		*template;
	char			*msg;

	if ((c = cmd_find_client(ctx, data->target)) == NULL)
		return (-1);

	if (data->arg == NULL)
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:12,代码来源:cmd-display-message.c


示例10: cmd_detach_client_exec

int
cmd_detach_client_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct cmd_target_data	*data = self->data;
	struct client		*c;

	if ((c = cmd_find_client(ctx, data->target)) == NULL)
		return (-1);

	server_write_client(c, MSG_DETACH, NULL, 0);

	return (0);
}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:13,代码来源:cmd-detach-client.c


示例11: cmd_refresh_client_exec

int
cmd_refresh_client_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct args	*args = self->args;
	struct client	*c;

	if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
		return (-1);

	server_redraw_client(c);

	return (0);
}
开发者ID:taksatou,项目名称:tmux,代码行数:13,代码来源:cmd-refresh-client.c


示例12: cmd_detach_client_exec

int
cmd_detach_client_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct args	*args = self->args;
	struct client	*c;

	if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
		return (-1);

	server_write_client(c, MSG_DETACH, NULL, 0);

	return (0);
}
开发者ID:stephenprater,项目名称:tmux,代码行数:13,代码来源:cmd-detach-client.c


示例13: cmd_display_panes_exec

int
cmd_display_panes_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct cmd_target_data	*data = self->data;
	struct client		*c;

	if ((c = cmd_find_client(ctx, data->target)) == NULL)
		return (-1);

	server_set_identify(c);

	return (0);
}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:13,代码来源:cmd-display-panes.c


示例14: cmd_display_panes_exec

int
cmd_display_panes_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct args	*args = self->args;
	struct client	*c;

	if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
		return (-1);

	server_set_identify(c);

	return (0);
}
开发者ID:smorin,项目名称:tmux-2,代码行数:13,代码来源:cmd-display-panes.c


示例15: cmd_display_panes_exec

enum cmd_retval
cmd_display_panes_exec(struct cmd *self, struct cmd_q *cmdq)
{
	struct args	*args = self->args;
	struct client	*c;

	if ((c = cmd_find_client(cmdq, args_get(args, 't'), 0)) == NULL)
		return (CMD_RETURN_ERROR);

	server_set_identify(c);

	return (CMD_RETURN_NORMAL);
}
开发者ID:Darkoe,项目名称:tmux,代码行数:13,代码来源:cmd-display-panes.c


示例16: cmd_lock_client_exec

int
cmd_lock_client_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct cmd_target_data	*data = self->data;
	struct client		*c;

	if ((c = cmd_find_client(ctx, data->target)) == NULL)
		return (-1);

	server_lock_client(c);
	recalculate_sizes();

	return (0);
}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:14,代码来源:cmd-lock-client.c


示例17: cmd_suspend_client_exec

int
cmd_suspend_client_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct cmd_target_data	*data = self->data;
	struct client		*c;

	if ((c = cmd_find_client(ctx, data->target)) == NULL)
		return (-1);

	tty_stop_tty(&c->tty);
	c->flags |= CLIENT_SUSPENDED;
	server_write_client(c, MSG_SUSPEND, NULL, 0);

	return (0);
}
开发者ID:ddollar,项目名称:tmux,代码行数:15,代码来源:cmd-suspend-client.c


示例18: cmd_suspend_client_exec

enum cmd_retval
cmd_suspend_client_exec(struct cmd *self, struct cmd_q *cmdq)
{
	struct args	*args = self->args;
	struct client	*c;

	if ((c = cmd_find_client(cmdq, args_get(args, 't'), 0)) == NULL)
		return (CMD_RETURN_ERROR);

	tty_stop_tty(&c->tty);
	c->flags |= CLIENT_SUSPENDED;
	server_write_client(c, MSG_SUSPEND, NULL, 0);

	return (CMD_RETURN_NORMAL);
}
开发者ID:FauxFaux,项目名称:tmux,代码行数:15,代码来源:cmd-suspend-client.c


示例19: cmd_suspend_client_exec

int
cmd_suspend_client_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct args	*args = self->args;
	struct client	*c;

	if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
		return (-1);

	tty_stop_tty(&c->tty);
	c->flags |= CLIENT_SUSPENDED;
	server_write_client(c, MSG_SUSPEND, NULL, 0);

	return (0);
}
开发者ID:psych0tik,项目名称:tmux,代码行数:15,代码来源:cmd-suspend-client.c


示例20: cmd_select_prompt_exec

int
cmd_select_prompt_exec(struct cmd *self, struct cmd_ctx *ctx)
{
    struct cmd_target_data	*data = self->data;
    struct client		*c;

    if ((c = cmd_find_client(ctx, data->target)) == NULL)
        return (-1);

    if (c->prompt_string != NULL)
        return (0);

    status_prompt_set(c, "index ", cmd_select_prompt_callback, NULL, c, 0);

    return (0);
}
开发者ID:dsturnbull,项目名称:tmux,代码行数:16,代码来源:cmd-select-prompt.c



注:本文中的cmd_find_client函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cmd_find_session函数代码示例发布时间:2022-05-30
下一篇:
C++ cmd_account函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap