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

C++ conf_sym函数代码示例

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

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



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

示例1: conf

static void conf(struct menu *menu)
{
	struct symbol *sym;
	struct property *prop;
	struct menu *child;

	if (!menu_is_visible(menu))
		return;

	sym = menu->sym;
	prop = menu->prompt;
	if (prop) {
		const char *prompt;

		switch (prop->type) {
		case P_MENU:
			if ((input_mode == silentoldconfig ||
			     input_mode == listnewconfig ||
			     input_mode == oldnoconfig) &&
			    rootEntry != menu) {
				check_conf(menu);
				return;
			}
			/* fall through */
		case P_COMMENT:
			prompt = menu_get_prompt(menu);
			if (prompt)
				printf("%*c\n%*c %s\n%*c\n",
					indent, '*',
					indent, '*', _(prompt),
					indent, '*');
		default:
			;
		}
	}

	if (!sym)
		goto conf_childs;

	if (sym_is_choice(sym)) {
		conf_choice(menu);
		if (sym->curr.tri != mod)
			return;
		goto conf_childs;
	}

	switch (sym->type) {
	case S_INT:
	case S_HEX:
	case S_STRING:
		conf_string(menu);
		break;
	default:
		conf_sym(menu);
		break;
	}

conf_childs:
	if (sym)
		indent += 2;
	for (child = menu->list; child; child = child->next)
		conf(child);
	if (sym)
		indent -= 2;
}
开发者ID:LGaljo,项目名称:android_kernel_samsung_s3ve3g,代码行数:65,代码来源:conf.c


示例2: conf_choice

static int conf_choice(struct menu *menu)
{
	struct symbol *sym, *def_sym;
	struct menu *child;
	bool is_new;

	sym = menu->sym;
	is_new = !sym_has_value(sym);
	if (sym_is_changable(sym)) {
		conf_sym(menu);
		sym_calc_value(sym);
		switch (sym_get_tristate_value(sym)) {
		case no:
			return 1;
		case mod:
			return 0;
		case yes:
			break;
		}
	} else {
		switch (sym_get_tristate_value(sym)) {
		case no:
			return 1;
		case mod:
			printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
			return 0;
		case yes:
			break;
		}
	}

	while (1) {
		int cnt, def;

		printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
		def_sym = sym_get_choice_value(sym);
		cnt = def = 0;
		line[0] = 0;
		for (child = menu->list; child; child = child->next) {
			if (!menu_is_visible(child))
				continue;
			if (!child->sym) {
				printf("%*c %s\n", indent, '*', _(menu_get_prompt(child)));
				continue;
			}
			cnt++;
			if (child->sym == def_sym) {
				def = cnt;
				printf("%*c", indent, '>');
			} else
				printf("%*c", indent, ' ');
			printf(" %d. %s", cnt, _(menu_get_prompt(child)));
			if (child->sym->name)
				printf(" (%s)", child->sym->name);
			if (!sym_has_value(child->sym))
				printf(_(" (NEW)"));
			printf("\n");
		}
		printf(_("%*schoice"), indent - 1, "");
		if (cnt == 1) {
			printf("[1]: 1\n");
			goto conf_childs;
		}
		printf("[1-%d", cnt);
		if (menu_has_help(menu))
			printf("?");
		printf("]: ");
		switch (input_mode) {
		case oldconfig:
		case silentoldconfig:
			if (!is_new) {
				cnt = def;
				printf("%d\n", cnt);
				break;
			}
			check_stdin();
			/* fall through */
		case oldaskconfig:
			fflush(stdout);
			xfgets(line, 128, stdin);
			strip(line);
			if (line[0] == '?') {
				print_help(menu);
				continue;
			}
			if (!line[0])
				cnt = def;
			else if (isdigit(line[0]))
				cnt = atoi(line);
			else
				continue;
			break;
		default:
			break;
		}

	conf_childs:
		for (child = menu->list; child; child = child->next) {
			if (!child->sym || !menu_is_visible(child))
				continue;
//.........这里部分代码省略.........
开发者ID:LGaljo,项目名称:android_kernel_samsung_s3ve3g,代码行数:101,代码来源:conf.c


示例3: conf_choice

static int conf_choice(struct menu *menu)
{
	struct symbol *sym, *def_sym;
	struct menu *cmenu, *def_menu;
	const char *help;
	int type, len;
	bool is_new;

	sym = menu->sym;
	type = sym_get_type(sym);
	is_new = !sym_has_value(sym);
	if (sym_is_changable(sym)) {
		conf_sym(menu);
		sym_calc_value(sym);
		switch (sym_get_tristate_value(sym)) {
		case no:
			return 1;
		case mod:
			return 0;
		case yes:
			break;
		}
	} else {
		sym->def = sym->curr;
		if (S_TRI(sym->curr) == mod) {
			printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
			return 0;
		}
	}

	while (1) {
		printf("%*s%s ", indent - 1, "", menu_get_prompt(menu));
		def_sym = sym_get_choice_value(sym);
		def_menu = NULL;
		for (cmenu = menu->list; cmenu; cmenu = cmenu->next) {
			if (!menu_is_visible(cmenu))
				continue;
			printo(menu_get_prompt(cmenu));
			if (cmenu->sym == def_sym)
				def_menu = cmenu;
		}
		printo(NULL);
		if (def_menu)
			printf("[%s] ", menu_get_prompt(def_menu));
		else {
			printf("\n");
			return 1;
		}
		switch (input_mode) {
		case ask_new:
		case ask_silent:
		case ask_all:
			if (is_new)
				sym->flags |= SYMBOL_NEW;
			conf_askvalue(sym, menu_get_prompt(def_menu));
			strip(line);
			break;
		default:
			line[0] = 0;
			printf("\n");
		}
		if (line[0] == '?' && !line[1]) {
			help = nohelp_text;
			if (menu->sym->help)
				help = menu->sym->help;
			printf("\n%s\n", help);
			continue;
		}
		if (line[0]) {
			len = strlen(line);
			line[len] = 0;

			def_menu = NULL;
			for (cmenu = menu->list; cmenu; cmenu = cmenu->next) {
				if (!cmenu->sym || !menu_is_visible(cmenu))
					continue;
				if (!strncasecmp(line, menu_get_prompt(cmenu), len)) {
					def_menu = cmenu;
					break;
				}
			}
		}
		if (def_menu) {
			sym_set_choice_value(sym, def_menu->sym);
			if (def_menu->list) {
				indent += 2;
				conf(def_menu->list);
				indent -= 2;
			}
			return 1;
		}
	}
}
开发者ID:mmikulicic,项目名称:acaros,代码行数:93,代码来源:conf.c


示例4: conf_choice

static int conf_choice(struct menu *menu)
{
	struct symbol *sym, *def_sym;
	struct menu *child;
	int type;
	bool is_new;

	sym = menu->sym;
	type = sym_get_type(sym);
	is_new = !sym_has_value(sym);
	if (sym_is_changable(sym)) {
		conf_sym(menu);
		sym_calc_value(sym);
		switch (sym_get_tristate_value(sym)) {
		case no:
			return 1;
		case mod:
			return 0;
		case yes:
			break;
		}
	} else {
		switch (sym_get_tristate_value(sym)) {
		case no:
			return 1;
		case mod:
			printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
			return 0;
		case yes:
			break;
		}
	}

	while (1) {
		int cnt, def;

		printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
		def_sym = sym_get_choice_value(sym);
		cnt = def = 0;
		line[0] = 0;
		for (child = menu->list; child; child = child->next) {
			if (!menu_is_visible(child))
				continue;
			if (!child->sym) {
				printf("%*c %s\n", indent, '*', menu_get_prompt(child));
				continue;
			}
			cnt++;
			if (child->sym == def_sym) {
				def = cnt;
				printf("%*c", indent, '>');
			} else
				printf("%*c", indent, ' ');
			printf(" %d. %s", cnt, menu_get_prompt(child));
			if (child->sym->name)
				printf(" (%s)", child->sym->name);
			if (!sym_has_value(child->sym))
				printf(" (NEW)");
			printf("\n");
		}
		printf("%*schoice", indent - 1, "");
		if (cnt == 1) {
			printf("[1]: 1\n");
			goto conf_childs;
		}
		printf("[1-%d", cnt);
		if (sym->help)
			printf("?");
		printf("]: ");
		switch (input_mode) {
		case ask_new:
		case ask_silent:
			if (!is_new) {
				cnt = def;
				printf("%d\n", cnt);
				break;
			}
			check_stdin();
		case ask_all:
			fflush(stdout);
			fgets(line, 128, stdin);
			strip(line);
			if (line[0] == '?') {
				printf("\n%s\n", menu->sym->help ?
					menu->sym->help : nohelp_text);
				continue;
			}
			if (!line[0])
				cnt = def;
			else if (isdigit(line[0]))
				cnt = atoi(line);
			else
				continue;
			break;
		case set_random:
			def = (random() % cnt) + 1;
		case set_default:
		case set_yes:
		case set_mod:
		case set_no:
//.........这里部分代码省略.........
开发者ID:0x6e3078,项目名称:toybox,代码行数:101,代码来源:conf.c


示例5: conf_choice

static int conf_choice(struct menu *menu)
{
    struct symbol *sym, *def_sym;
    struct menu *child;
    // int type; backported future linux patch to 2.6.30 to fix gcc4.6 compiler warning
    bool is_new;

    sym = menu->sym;
    // type = sym_get_type(sym); see backported comment above
    is_new = !sym_has_value(sym);
    if (sym_is_changable(sym)) {
        conf_sym(menu);
        sym_calc_value(sym);
        switch (sym_get_tristate_value(sym)) {
        case no:
            return 1;
        case mod:
            return 0;
        case yes:
            break;
        }
    } else {
        switch (sym_get_tristate_value(sym)) {
        case no:
            return 1;
        case mod:
            printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
            return 0;
        case yes:
            break;
        }
    }

    while (1) {
        int cnt, def;

        printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
        def_sym = sym_get_choice_value(sym);
        cnt = def = 0;
        line[0] = 0;
        for (child = menu->list; child; child = child->next) {
            if (!menu_is_visible(child))
                continue;
            if (!child->sym) {
                printf("%*c %s\n", indent, '*', _(menu_get_prompt(child)));
                continue;
            }
            cnt++;
            if (child->sym == def_sym) {
                def = cnt;
                printf("%*c", indent, '>');
            } else
                printf("%*c", indent, ' ');
            printf(" %d. %s", cnt, _(menu_get_prompt(child)));
            if (child->sym->name)
                printf(" (%s)", child->sym->name);
            if (!sym_has_value(child->sym))
                printf(_(" (NEW)"));
            printf("\n");
        }
        printf(_("%*schoice"), indent - 1, "");
        if (cnt == 1) {
            printf("[1]: 1\n");
            goto conf_childs;
        }
        printf("[1-%d", cnt);
        if (menu_has_help(menu))
            printf("?");
        printf("]: ");
        switch (input_mode) {
        case ask_new:
        case ask_silent:
            if (!is_new) {
                cnt = def;
                printf("%d\n", cnt);
                break;
            }
            check_stdin();
        case ask_all:
            fflush(stdout);
            if (NULL == fgets(line, 128, stdin)) { //BRCM: check ret val to fix compiler warning
                printf("fgets failed, exiting\n");
                exit(2);
            }
            strip(line);
            if (line[0] == '?') {
                printf("\n%s\n", get_help(menu));
                continue;
            }
            if (!line[0])
                cnt = def;
            else if (isdigit(line[0]))
                cnt = atoi(line);
            else
                continue;
            break;
        default:
            break;
        }

//.........这里部分代码省略.........
开发者ID:antonywcl,项目名称:AR-5315u_PLD,代码行数:101,代码来源:conf.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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