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

C++ options_set_number函数代码示例

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

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



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

示例1: cmd_rename_window_exec

enum cmd_retval
cmd_rename_window_exec(struct cmd *self, struct cmd_q *cmdq)
{
	struct args	*args = self->args;
	struct winlink	*wl = cmdq->state.tflag.wl;

	window_set_name(wl->window, args->argv[0]);
	options_set_number(wl->window->options, "automatic-rename", 0);

	server_status_window(wl->window);

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


示例2: cmd_set_option_attributes

/* Set an attributes option. */
struct options_entry *
cmd_set_option_attributes(unused struct cmd *self, struct cmd_ctx *ctx,
    const struct options_table_entry *oe, struct options *oo, const char *value)
{
	int	attr;

	if ((attr = attributes_fromstring(value)) == -1) {
		ctx->error(ctx, "bad attributes: %s", value);
		return (NULL);
	}

	return (options_set_number(oo, oe->name, attr));
}
开发者ID:sofuture,项目名称:bitrig,代码行数:14,代码来源:cmd-set-option.c


示例3: options_table_populate_tree

/* Populate an options tree from a table. */
void
options_table_populate_tree(
    const struct options_table_entry *table, struct options *oo)
{
	const struct options_table_entry	*oe;

	for (oe = table; oe->name != NULL; oe++) {
		if (oe->default_str != NULL)
			options_set_string(oo, oe->name, "%s", oe->default_str);
		else
			options_set_number(oo, oe->name, oe->default_num);
	}
}
开发者ID:Hooman3,项目名称:minix,代码行数:14,代码来源:options-table.c


示例4: cmd_set_option_key

/* Set a key option. */
struct options_entry *
cmd_set_option_key(unused struct cmd *self, struct cmd_ctx *ctx,
    const struct options_table_entry *oe, struct options *oo, const char *value)
{
	int	key;

	if ((key = key_string_lookup_string(value)) == KEYC_NONE) {
		ctx->error(ctx, "bad key: %s", value);
		return (NULL);
	}

	return (options_set_number(oo, oe->name, key));
}
开发者ID:sofuture,项目名称:bitrig,代码行数:14,代码来源:cmd-set-option.c


示例5: cmd_set_option_colour

/* Set a colour option. */
struct options_entry *
cmd_set_option_colour(unused struct cmd *self, struct cmd_ctx *ctx,
    const struct options_table_entry *oe, struct options *oo, const char *value)
{
	int	colour;

	if ((colour = colour_fromstring(value)) == -1) {
		ctx->error(ctx, "bad colour: %s", value);
		return (NULL);
	}

	return (options_set_number(oo, oe->name, colour));
}
开发者ID:sofuture,项目名称:bitrig,代码行数:14,代码来源:cmd-set-option.c


示例6: input_exit_rename

/* Rename terminator (ST) received. */
void
input_exit_rename(struct input_ctx *ictx)
{
	if (ictx->flags & INPUT_DISCARD)
		return;
	log_debug("%s: \"%s\"", __func__, ictx->input_buf);

	xfree(ictx->wp->window->name);
	ictx->wp->window->name = xstrdup(ictx->input_buf);
	options_set_number(&ictx->wp->window->options, "automatic-rename", 0);

	server_status_window(ictx->wp->window);
}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:14,代码来源:input.c


示例7: input_exit_rename

/* Rename terminator (ST) received. */
void
input_exit_rename(struct input_ctx *ictx)
{
	if (ictx->flags & INPUT_DISCARD)
		return;
	if (!options_get_number(ictx->wp->window->options, "allow-rename"))
		return;
	log_debug("%s: \"%s\"", __func__, ictx->input_buf);

	window_set_name(ictx->wp->window, ictx->input_buf);
	options_set_number(ictx->wp->window->options, "automatic-rename", 0);

	server_status_window(ictx->wp->window);
}
开发者ID:kylape,项目名称:tmux,代码行数:15,代码来源:input.c


示例8: cmd_set_option_attributes

/* Set an attributes option. */
struct options_entry *
cmd_set_option_attributes(struct cmd *self, struct cmd_ctx *ctx,
    const struct options_table_entry *oe, struct options *oo)
{
	struct cmd_target_data	*data = self->data;
	int			 attr;

	if ((attr = attributes_fromstring(data->arg2)) == -1) {
		ctx->error(ctx, "bad attributes: %s", data->arg2);
		return (NULL);
	}

	return (options_set_number(oo, oe->name, attr));
}
开发者ID:ddollar,项目名称:tmux,代码行数:15,代码来源:cmd-set-option.c


示例9: cmd_set_option_colour

/* Set a colour option. */
struct options_entry *
cmd_set_option_colour(struct cmd *self, struct cmd_ctx *ctx,
    const struct options_table_entry *oe, struct options *oo)
{
	struct cmd_target_data	*data = self->data;
	int			 colour;

	if ((colour = colour_fromstring(data->arg2)) == -1) {
		ctx->error(ctx, "bad colour: %s", data->arg2);
		return (NULL);
	}

	return (options_set_number(oo, oe->name, colour));
}
开发者ID:ddollar,项目名称:tmux,代码行数:15,代码来源:cmd-set-option.c


示例10: cmd_set_option_number

/* Set a number option. */
struct options_entry *
cmd_set_option_number(unused struct cmd *self, struct cmd_q *cmdq,
    const struct options_table_entry *oe, struct options *oo, const char *value)
{
	long long	 ll;
	const char     	*errstr;

	ll = strtonum(value, oe->minimum, oe->maximum, &errstr);
	if (errstr != NULL) {
		cmdq_error(cmdq, "value is %s: %s", errstr, value);
		return (NULL);
	}

	return (options_set_number(oo, oe->name, ll));
}
开发者ID:FauxFaux,项目名称:tmux,代码行数:16,代码来源:cmd-set-option.c


示例11: cmd_set_option_number

/* Set a number option. */
struct options_entry *
cmd_set_option_number(struct cmd *self, struct cmd_ctx *ctx,
    const struct options_table_entry *oe, struct options *oo)
{
	struct cmd_target_data	*data = self->data;
	long long		 ll;
	const char     		*errstr;

	ll = strtonum(data->arg2, oe->minimum, oe->maximum, &errstr);
	if (errstr != NULL) {
		ctx->error(ctx, "value is %s: %s", errstr, data->arg2);
		return (NULL);
	}

	return (options_set_number(oo, oe->name, ll));
}
开发者ID:ddollar,项目名称:tmux,代码行数:17,代码来源:cmd-set-option.c


示例12: cmd_rename_window_exec

enum cmd_retval
cmd_rename_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct args	*args = self->args;
	struct session	*s;
	struct winlink	*wl;

	if ((wl = cmd_find_window(ctx, args_get(args, 't'), &s)) == NULL)
		return (CMD_RETURN_ERROR);

	window_set_name(wl->window, args->argv[0]);
	options_set_number(&wl->window->options, "automatic-rename", 0);

	server_status_window(wl->window);

	return (CMD_RETURN_NORMAL);
}
开发者ID:HonestQiao,项目名称:tmux,代码行数:17,代码来源:cmd-rename-window.c


示例13: cmd_rename_window_exec

int
cmd_rename_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct cmd_target_data	*data = self->data;
	struct session		*s;
	struct winlink		*wl;

	if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
		return (-1);

	xfree(wl->window->name);
	wl->window->name = xstrdup(data->arg);
	options_set_number(&wl->window->options, "automatic-rename", 0);

	server_status_window(wl->window);

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


示例14: options_table_populate_tree

/* Populate an options tree from a table. */
void
options_table_populate_tree(
    const struct options_table_entry *table, struct options *oo)
{
	const struct options_table_entry	*oe;

	for (oe = table; oe->name != NULL; oe++) {
		switch (oe->type) {
		case OPTIONS_TABLE_STRING:
			options_set_string(oo, oe->name, "%s", oe->default_str);
			break;
		case OPTIONS_TABLE_STYLE:
			options_set_style(oo, oe->name, oe->default_str, 0);
			break;
		default:
			options_set_number(oo, oe->name, oe->default_num);
			break;
		}
	}
}
开发者ID:theg5prank,项目名称:tmux,代码行数:21,代码来源:options-table.c


示例15: cmd_set_option_attributes

void
cmd_set_option_attributes(struct cmd_ctx *ctx, struct options *oo,
    const struct set_option_entry *entry, char *value)
{
	struct options_entry	*o;
	int			 attr;

	if (value == NULL) {
		ctx->error(ctx, "empty value");
		return;
	}

	if ((attr = attributes_fromstring(value)) == -1) {
		ctx->error(ctx, "bad attributes: %s", value);
		return;
	}

	o = options_set_number(oo, entry->name, attr);
	ctx->info(ctx,
	    "set option: %s -> %s", o->name, cmd_set_option_print(entry, o));
}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:21,代码来源:cmd-set-option.c


示例16: set_option_colour

void
set_option_colour(struct cmd_ctx *ctx, struct options *oo,
    const struct set_option_entry *entry, char *value)
{
	struct options_entry	*o;
	int			 colour;

	if (value == NULL) {
		ctx->error(ctx, "empty value");
		return;
	}

	if ((colour = colour_fromstring(value)) == -1) {
		ctx->error(ctx, "bad colour: %s", value);
		return;
	}

	o = options_set_number(oo, entry->name, colour);
	ctx->info(
	    ctx, "set option: %s -> %s", o->name, set_option_print(entry, o));
}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:21,代码来源:options-cmd.c


示例17: options_table_populate_tree

/* Populate an options tree from a table. */
void
options_table_populate_tree(enum options_table_scope scope, struct options *oo)
{
	const struct options_table_entry	*oe;

	for (oe = options_table; oe->name != NULL; oe++) {
		if (oe->scope == OPTIONS_TABLE_NONE)
			fatalx("no scope for %s", oe->name);
		if (oe->scope != scope)
			continue;
		switch (oe->type) {
		case OPTIONS_TABLE_STRING:
			options_set_string(oo, oe->name, "%s", oe->default_str);
			break;
		case OPTIONS_TABLE_STYLE:
			options_set_style(oo, oe->name, oe->default_str, 0);
			break;
		default:
			options_set_number(oo, oe->name, oe->default_num);
			break;
		}
	}
}
开发者ID:bingxuechangya,项目名称:tmux,代码行数:24,代码来源:options-table.c


示例18: cmd_set_option_number

void
cmd_set_option_number(struct cmd_ctx *ctx, struct options *oo,
    const struct set_option_entry *entry, char *value)
{
	struct options_entry	*o;
	long long		 number;
	const char     		*errstr;

	if (value == NULL) {
		ctx->error(ctx, "empty value");
		return;
	}

	number = strtonum(value, entry->minimum, entry->maximum, &errstr);
	if (errstr != NULL) {
		ctx->error(ctx, "value is %s: %s", errstr, value);
		return;
	}

	o = options_set_number(oo, entry->name, number);
	ctx->info(ctx,
	    "set option: %s -> %s", o->name, cmd_set_option_print(entry, o));
}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:23,代码来源:cmd-set-option.c


示例19: cmd_break_pane_exec

static enum cmd_retval
cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
{
	struct args		*args = self->args;
	struct cmd_find_state	*current = &item->shared->current;
	struct client		*c = cmd_find_client(item, NULL, 1);
	struct winlink		*wl = item->source.wl;
	struct session		*src_s = item->source.s;
	struct session		*dst_s = item->target.s;
	struct window_pane	*wp = item->source.wp;
	struct window		*w = wl->window;
	char			*name, *cause;
	int			 idx = item->target.idx;
	const char		*template;
	char			*cp;

	if (idx != -1 && winlink_find_by_index(&dst_s->windows, idx) != NULL) {
		cmdq_error(item, "index %d already in use", idx);
		return (CMD_RETURN_ERROR);
	}

	if (window_count_panes(w) == 1) {
		cmdq_error(item, "can't break with only one pane");
		return (CMD_RETURN_ERROR);
	}
	server_unzoom_window(w);

	TAILQ_REMOVE(&w->panes, wp, entry);
	window_lost_pane(w, wp);
	layout_close_pane(wp);

	w = wp->window = window_create(w->sx, w->sy);
	TAILQ_INSERT_HEAD(&w->panes, wp, entry);
	w->active = wp;

	if (!args_has(args, 'n')) {
		name = default_window_name(w);
		window_set_name(w, name);
		free(name);
	} else {
		window_set_name(w, args_get(args, 'n'));
		options_set_number(w->options, "automatic-rename", 0);
	}

	layout_init(w, wp);
	wp->flags |= PANE_CHANGED;

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

	server_redraw_session(src_s);
	if (src_s != dst_s)
		server_redraw_session(dst_s);
	server_status_session_group(src_s);
	if (src_s != dst_s)
		server_status_session_group(dst_s);

	if (args_has(args, 'P')) {
		if ((template = args_get(args, 'F')) == NULL)
开发者ID:SeamusConnor,项目名称:tmux,代码行数:64,代码来源:cmd-break-pane.c


示例20: main


//.........这里部分代码省略.........
		case 'S':
			free(path);
			path = xstrdup(optarg);
			break;
		case 'u':
			flags |= CLIENT_UTF8;
			break;
		case 'v':
			log_add_level();
			break;
		default:
			usage();
		}
	}
	argc -= optind;
	argv += optind;

	if (shellcmd != NULL && argc != 0)
		usage();

#ifdef __OpenBSD__
	if (pledge("stdio rpath wpath cpath flock fattr unix getpw sendfd "
	    "recvfd proc exec tty ps", NULL) != 0)
		err(1, "pledge");
#endif

	/*
	 * tmux is a UTF-8 terminal, so if TMUX is set, assume UTF-8.
	 * Otherwise, if the user has set LC_ALL, LC_CTYPE or LANG to contain
	 * UTF-8, it is a safe assumption that either they are using a UTF-8
	 * terminal, or if not they know that output from UTF-8-capable
	 * programs may be wrong.
	 */
	if (getenv("TMUX") != NULL)
		flags |= CLIENT_UTF8;
	else {
		s = getenv("LC_ALL");
		if (s == NULL || *s == '\0')
			s = getenv("LC_CTYPE");
		if (s == NULL || *s == '\0')
			s = getenv("LANG");
		if (s == NULL || *s == '\0')
			s = "";
		if (strcasestr(s, "UTF-8") != NULL ||
		    strcasestr(s, "UTF8") != NULL)
			flags |= CLIENT_UTF8;
	}

	global_hooks = hooks_create(NULL);

	global_environ = environ_create();
	for (var = environ; *var != NULL; var++)
		environ_put(global_environ, *var);
	if (getcwd(tmp, sizeof tmp) != NULL)
		environ_set(global_environ, "PWD", "%s", tmp);

	global_options = options_create(NULL);
	options_table_populate_tree(OPTIONS_TABLE_SERVER, global_options);

	global_s_options = options_create(NULL);
	options_table_populate_tree(OPTIONS_TABLE_SESSION, global_s_options);
	options_set_string(global_s_options, "default-shell", "%s", getshell());

	global_w_options = options_create(NULL);
	options_table_populate_tree(OPTIONS_TABLE_WINDOW, global_w_options);

	/* Override keys to vi if VISUAL or EDITOR are set. */
	if ((s = getenv("VISUAL")) != NULL || (s = getenv("EDITOR")) != NULL) {
		if (strrchr(s, '/') != NULL)
			s = strrchr(s, '/') + 1;
		if (strstr(s, "vi") != NULL)
			keys = MODEKEY_VI;
		else
			keys = MODEKEY_EMACS;
		options_set_number(global_s_options, "status-keys", keys);
		options_set_number(global_w_options, "mode-keys", keys);
	}

	/*
	 * If socket is specified on the command-line with -S or -L, it is
	 * used. Otherwise, $TMUX is checked and if that fails "default" is
	 * used.
	 */
	if (path == NULL && label == NULL) {
		s = getenv("TMUX");
		if (s != NULL && *s != '\0' && *s != ',') {
			path = xstrdup(s);
			path[strcspn (path, ",")] = '\0';
		}
	}
	if (path == NULL && (path = make_label(label)) == NULL) {
		fprintf(stderr, "can't create socket: %s\n", strerror(errno));
		exit(1);
	}
	socket_path = path;
	free(label);

	/* Pass control to the client. */
	exit(client_main(event_init(), argc, argv, flags, shellcmd));
}
开发者ID:alexfalcucci-archive,项目名称:tmate,代码行数:101,代码来源:tmux.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ opus_encoder_ctl函数代码示例发布时间:2022-05-30
下一篇:
C++ options_get_string函数代码示例发布时间: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