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

C++ conf_read函数代码示例

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

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



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

示例1: conf_read_string_safe

ssize_t conf_read_string_safe(const char *file,
			      const char *key, char *value, size_t size)
{
	/* goal: prevent overflow ! */

	size_t len;
	char buf[LINE_MAX];

	if (!size)
		return -1;

	if (size >= LINE_MAX)
		return conf_read(file, key, "%s", value);

	/* read to buf and then check size */
	if (conf_read(file, key, "%s", buf) != 1)
		return -1;

	len = strlen(buf);
	if (len > size) {
		DBGP("value too long (%zu, %zu)\n", len, size);
		errno = E2BIG;
		return -1;
	}

	strcpy(value, buf);
	return len;
}
开发者ID:yanyg,项目名称:misc,代码行数:28,代码来源:conf.c


示例2: configfile_read

void configfile_read(void)
{
	if (configfile)
		conf_read(configfile, 1);
	else {
		conf_read(SYSCONFDIR "/bmonrc", 0);
		
		if (getenv("HOME")) {
			char path[FILENAME_MAX+1];
			snprintf(path, sizeof(path), "%s/.bmonrc",
				 getenv("HOME"));
			conf_read(path, 0);
		}
	}
}
开发者ID:noushi,项目名称:bmon,代码行数:15,代码来源:conf.c


示例3: main

int main(int ac, char **av)
{
	char *mode;
	int res;

	setlocale(LC_ALL, "");
	bindtextdomain(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);

	conf_parse(av[1]);
	conf_read(NULL);

	mode = getenv("MENUCONFIG_MODE");
	if (mode) {
		if (!strcasecmp(mode, "single_menu"))
			single_menu_mode = 1;
	}

	tcgetattr(1, &ios_org);
	atexit(conf_cleanup);
	init_wsize();
	reset_dialog();
	init_dialog(NULL);
	set_config_filename(conf_get_configname());
	do {
		conf(&rootmenu);
		dialog_clear();
		if (conf_get_changed())
			res = dialog_yesno(NULL,
					   _("Do you wish to save your "
					     "new configuration?\n"
					     "<ESC><ESC> to continue."),
					   6, 60);
		else
			res = -1;
	} while (res == KEY_ESC);
	end_dialog();

	switch (res) {
	case 0:
		if (conf_write(filename)) {
			fprintf(stderr, _("\n\n"
				"Error during writing of the configuration.\n"
				"Your configuration changes were NOT saved."
				"\n\n"));
			return 1;
		}
	case -1:
		printf(_("\n\n"
			"*** End of configuration.\n"
			"\n\n"));
		break;
	default:
		fprintf(stderr, _("\n\n"
			"Your configuration changes were NOT saved."
			"\n\n"));
	}

	return 0;
}
开发者ID:BackupTheBerlios,项目名称:openslx-svn,代码行数:60,代码来源:mconf.c


示例4: conf_load

static void conf_load(void)
{

	while (1) {
		int res;
		dialog_clear();
		res = dialog_inputbox(NULL, load_config_text,
				      11, 55, filename);
		switch(res) {
		case 0:
			if (!dialog_input_result[0])
				return;
			if (!conf_read(dialog_input_result)) {
				set_config_filename(dialog_input_result);
				sym_set_change_count(1);
				return;
			}
			show_textbox(NULL, _("File does not exist!"), 5, 38);
			break;
		case 1:
			show_helptext(_("Load Alternate Configuration"), load_config_help);
			break;
		case KEY_ESC:
			return;
		}
	}
}
开发者ID:16rd,项目名称:rt-n56u,代码行数:27,代码来源:mconf.c


示例5: main

int main(int argc, char **argv) {
    Sim *sim;
    Config *cfg;
    int rank, size, dims[3];
    MPI_Comm cart;
    int restart;

    m::ini(&argc, &argv);

    m::get_dims(&argc, &argv, dims);
    m::get_cart(MPI_COMM_WORLD, dims, &cart);

    MC(m::Comm_rank(cart, &rank));
    MC(m::Comm_size(cart, &size));
    msg_ini(rank);
    msg_print("mpi rank/size: %d/%d", rank, size);
    UC(conf_ini(&cfg));
    UC(conf_read(argc, argv, cfg));

    UC(sim_ini(cfg, cart, &sim));
    UC(conf_lookup_bool(cfg, "glb.restart", &restart));
    msg_print("read restart: %s", restart ? "YES" : "NO" );
    if (restart) UC(sim_strt(sim));
    else         UC(sim_gen(sim));
    UC(sim_fin(sim));

    UC(conf_fin(cfg));

    MC(m::Barrier(cart));
    m::fin();
    msg_print("end");
}
开发者ID:uDeviceX,项目名称:uDeviceX,代码行数:32,代码来源:main.cpp


示例6: mcpcia_read_config

static int
mcpcia_read_config(struct pci_bus *bus, unsigned int devfn, int where,
		   int size, u32 *value)
{
	struct pci_controller *hose = bus->sysdata;
	unsigned long addr, w;
	unsigned char type1;

	if (mk_conf_addr(bus, devfn, where, hose, &addr, &type1))
		return PCIBIOS_DEVICE_NOT_FOUND;

	addr |= (size - 1) * 8;
	w = conf_read(addr, type1, hose);
	switch (size) {
	case 1:
		*value = __kernel_extbl(w, where & 3);
		break;
	case 2:
		*value = __kernel_extwl(w, where & 3);
		break;
	case 4:
		*value = w;
		break;
	}
	return PCIBIOS_SUCCESSFUL;
}
开发者ID:broodplank,项目名称:Samsung-Galaxy-S-Plus,代码行数:26,代码来源:core_mcpcia.c


示例7: conf_load

static void conf_load(void)
{
	int stat;

	while (1) {
		cprint_init();
		cprint("--inputbox");
		cprint(load_config_text);
		cprint("11");
		cprint("55");
		cprint("%s", filename);
		stat = exec_conf();
		switch(stat) {
		case 0:
			if (!input_buf[0])
				return;
			if (!conf_read(input_buf))
				return;
			show_textbox(NULL, "File does not exist!", 5, 38);
			break;
		case 1:
			show_helptext("Load Alternate Configuration", load_config_help);
			break;
		case 255:
			return;
		}
	}
}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:28,代码来源:mconf.c


示例8: main

int main(int argc, char **argv) {
    const char *arg;
    char **v;
    int rank, c, dims[3];
    const char delim[] = " \t";
    Config *cfg;
    MPI_Comm cart;
    
    m::ini(&argc, &argv);
    m::get_dims(&argc, &argv, dims);
    m::get_cart(MPI_COMM_WORLD, dims, &cart);

    MC(m::Comm_rank(cart, &rank));
    msg_ini(rank);
    UC(conf_ini(&cfg));
    UC(conf_read(argc, argv, /**/ cfg));
    UC(coords_ini_conf(cart, cfg, /**/ &coords));
    UC(conf_lookup_string(cfg, "a", &arg));
    tok_ini(arg, delim, /**/ &c, &v);

    main3(c, v);

    tok_fin(c, v);
    UC(coords_fin(coords));
    UC(conf_fin(cfg));

    MC(m::Barrier(cart));
    m::fin();
}
开发者ID:uDeviceX,项目名称:uDeviceX,代码行数:29,代码来源:main.cpp


示例9: main

int main(int ac, char **av)
{
	struct symbol *sym;
	char *mode;
	int res;

	setlocale(LC_ALL, "");
	bindtextdomain(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);

	conf_parse(av[1]);
	conf_read(NULL);

	sym = sym_lookup("KERNELVERSION", 0);
	sym_calc_value(sym);
	sprintf(menu_backtitle, _("Linux Kernel v%s Configuration"),
		sym_get_string_value(sym));

	mode = getenv("MENUCONFIG_MODE");
	if (mode) {
		if (!strcasecmp(mode, "single_menu"))
			single_menu_mode = 1;
	}

	tcgetattr(1, &ios_org);
	atexit(conf_cleanup);
	init_wsize();
	reset_dialog();
	init_dialog(menu_backtitle);
	do {
		conf(&rootmenu);
		dialog_clear();
		res = dialog_yesno(NULL,
				   _("Do you wish to save your "
				     "new kernel configuration?\n"
				     "<ESC><ESC> to continue."),
				   6, 60);
	} while (res == KEY_ESC);
	end_dialog();
	if (res == 0) {
		if (conf_write(NULL)) {
			fprintf(stderr, _("\n\n"
				"Error during writing of the kernel configuration.\n"
				"Your kernel configuration changes were NOT saved."
				"\n\n"));
			return 1;
		}
		printf(_("\n\n"
			"*** End of Linux kernel configuration.\n"
			"*** Execute 'make' to build the kernel or try 'make help'."
			"\n\n"));
	} else {
		fprintf(stderr, _("\n\n"
			"Your kernel configuration changes were NOT saved."
			"\n\n"));
	}

	return 0;
}
开发者ID:Voskrese,项目名称:mipsonqemu,代码行数:59,代码来源:mconf.c


示例10: fopen

/**
 * Konstruktor opens the configuration, which is given by the filename
 */
config::config(char* filename){
	myfilename = filename;
	fp = fopen(myfilename, "r");
	group = NULL;
	conf_init(&conf);
	conf_read(&conf, fp);
	fclose(fp);
}
开发者ID:fnal,项目名称:elComandante,代码行数:11,代码来源:config.cpp


示例11: main

int main(int ac, char **av)
{
	struct symbol *sym;
	char *mode;
	int stat;

	setlocale(LC_ALL, "");
	bindtextdomain(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);

	conf_parse(av[1]);
	conf_read(NULL);

	sym = sym_lookup("KERNELVERSION", 0);
	sym_calc_value(sym);
	sprintf(menu_backtitle, _("swupdate %s Configuration"),
		sym_get_string_value(sym));

	mode = getenv("MENUCONFIG_MODE");
	if (mode) {
		if (!strcasecmp(mode, "single_menu"))
			single_menu_mode = 1;
	}

	tcgetattr(1, &ios_org);
	atexit(conf_cleanup);
	init_wsize();
	conf(&rootmenu);

	do {
		cprint_init();
		cprint("--yesno");
		cprint(_("Do you wish to save your new configuration?"));
		cprint("5");
		cprint("60");
		stat = exec_conf();
	} while (stat < 0);

	if (stat == 0) {
		if (conf_write(NULL)) {
			fprintf(stderr, _("\n\n"
				"Error during writing of the configuration.\n"
				"Your configuration changes were NOT saved."
				"\n\n"));
			return 1;
		}
		printf(_("\n\n"
			"*** End of configuration.\n"
			"*** Execute 'make' to build the project or try 'make help'."
			"\n\n"));
	} else {
		fprintf(stderr, _("\n\n"
			"Your configuration changes were NOT saved."
			"\n\n"));
	}

	return 0;
}
开发者ID:EyeSee360,项目名称:swupdate,代码行数:58,代码来源:mconf.c


示例12: reload

void reload(void)
{
	notify_reload();

	restart();
	conf_read(conf_file, do_vifs);

	/* Acknowledge client SIGHUP/reload */
	notify_ready(NULL, uid, gid);
}
开发者ID:troglobit,项目名称:smcroute,代码行数:10,代码来源:smcrouted.c


示例13: Free

int DBUtil::Init(const char* conffile, const char* dbsection, const char* logsection)
{
    SQL_INST* sqlinst = NULL;

    // free previous instance first
    Free();

    // init sql module
    rlm_sql_init();

    // read conf file
    CONF_SECTION *conf;
    conf = conf_read(__FILE__, __LINE__, conffile, NULL);
    if(!conf) {
        radlog(L_CONS|L_ERROR, "[DBUtil::DBUtil] can not read '%s'", conffile);
        rlm_sql_destroy();
        return -1;
    }

    // get db section
    CONF_SECTION* sqlconf = cf_section_sub_find(conf, dbsection);
    if(!sqlconf) {
        radlog(L_CONS|L_ERROR, "[DBUtil::DBUtil] can not find sub section '%s'", dbsection);
        cf_section_free(&conf);
        rlm_sql_destroy();
        return -1;
    }

    // get log section if present
    CONF_SECTION* logconf = NULL;
    if(logsection) {
        logconf = cf_section_sub_find(conf, logsection);
        if(!logconf) {
            radlog(L_CONS|L_WARN, "[DBUtil::DBUtil] can not find sub section '%s', "
                   "no logging parameters would be applied to rlm_sql. This may be "
                   "a problem when using rlm_sql with dynamic loading sql_drivers",
                   logsection);
        }
    }

    // get sql instance
    if(rlm_sql_instantiate(sqlconf, &sqlinst, logconf) != 0) {
        radlog(L_CONS|L_ERROR, "[DBUtil::DBUtil] can not instantiate sql instance");
        cf_section_free(&conf);
        rlm_sql_destroy();
        return -1;
    }

    // free conf section
    cf_section_free(&conf);

    dbHandle_ = sqlinst;

    return 0;
}
开发者ID:aclisp,项目名称:large-scale,代码行数:55,代码来源:dbutil.cpp


示例14: main

int main(int ac, char **av)
{
	struct symbol *sym;
	char *mode;
	int stat;

	conf_parse(av[1]);
	conf_read(NULL);

	sym = sym_lookup("KERNELRELEASE", 0);
	sym_calc_value(sym);
	sprintf(menu_backtitle, "Linux Kernel v%s Configuration",
		sym_get_string_value(sym));

	mode = getenv("MENUCONFIG_MODE");
	if (mode) {
		if (!strcasecmp(mode, "single_menu"))
			single_menu_mode = 1;
	}

	tcgetattr(1, &ios_org);
	atexit(conf_cleanup);
	init_wsize();
	conf(&rootmenu);

	do {
		cprint_init();
		cprint("--yesno");
		cprint("Do you wish to save your new kernel configuration?");
		cprint("5");
		cprint("60");
		stat = exec_conf();
	} while (stat < 0);

	if (stat == 0) {
		if (conf_write(NULL)) {
			fprintf(stderr, "\n\n"
				"Error during writing of the kernel configuration.\n"
				"Your kernel configuration changes were NOT saved."
				"\n\n");
			return 1;
		}
		printf("\n\n"
			"*** End of Linux kernel configuration.\n"
			"*** Execute 'make' to build the kernel or try 'make help'."
			"\n\n");
	} else {
		fprintf(stderr, "\n\n"
			"Your kernel configuration changes were NOT saved."
			"\n\n");
	}

	return 0;
}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:54,代码来源:mconf.c


示例15: load_filename

static void
load_filename(GtkFileSelection * file_selector, gpointer user_data)
{
	const gchar *fn;

	fn = gtk_file_selection_get_filename(GTK_FILE_SELECTION
					     (user_data));

	if (conf_read(fn))
		text_insert_msg(_("Error"), _("Unable to load configuration !"));
	else
		display_tree(&rootmenu);
}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:13,代码来源:gconf.c


示例16: mcpcia_read_config_dword

static int
mcpcia_read_config_dword(struct pci_dev *dev, int where, u32 *value)
{
	struct pci_controler *hose = dev->sysdata;
	unsigned long addr;
	unsigned char type1;

	if (mk_conf_addr(dev, where, hose, &addr, &type1))
		return PCIBIOS_DEVICE_NOT_FOUND;

	addr |= 0x18;
	*value = conf_read(addr, type1, hose);
	return PCIBIOS_SUCCESSFUL;
}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:14,代码来源:core_mcpcia.c


示例17: mcpcia_read_config_word

static int
mcpcia_read_config_word(struct pci_dev *dev, int where, u16 *value)
{
	struct pci_controler *hose = dev->sysdata;
	unsigned long addr, w;
	unsigned char type1;

	if (mk_conf_addr(dev, where, hose, &addr, &type1))
		return PCIBIOS_DEVICE_NOT_FOUND;

	addr |= 0x08;
	w = conf_read(addr, type1, hose);
	*value = __kernel_extwl(w, where & 3);
	return PCIBIOS_SUCCESSFUL;
}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:15,代码来源:core_mcpcia.c


示例18: server_new

struct server *
server_new(const char *cfg_file) {
	
	int i;
	struct server *s = calloc(1, sizeof(struct server));

	s->cfg = conf_read(cfg_file);

	/* workers */
	s->w = calloc(s->cfg->http_threads, sizeof(struct worker*));
	for(i = 0; i < s->cfg->http_threads; ++i) {
		s->w[i] = worker_new(s);
	}
	return s;
}
开发者ID:aromeyer,项目名称:webdis,代码行数:15,代码来源:server.c


示例19: signal_handler

static void signal_handler(int sig)
{
	char *msg = "";
	
	switch(sig) {
		case SIGHUP:
			msg = "SIGHUP received... reload configuration";
			slog(s,WEBDIS_ERROR,msg,strlen(msg));
			s->cfg = conf_read(cfg_file);
			break;
		case SIGINT:
		case SIGTERM:
			break;
	}
}
开发者ID:aromeyer,项目名称:webdis,代码行数:15,代码来源:webdis.c


示例20: main

int main(int argc, char **argv) {
    const char *i; /* input */
    MeshRead *off;
    Config *cfg;
    m::ini(&argc, &argv);

    UC(conf_ini(&cfg));
    UC(conf_read(argc, argv, cfg));
    UC(conf_lookup_string(cfg, "i", &i));
    UC(mesh_read_ini_off(i, /**/ &off));

    run(off);

    UC(mesh_read_fin(off));
    UC(conf_fin(cfg));
    m::fin();
}
开发者ID:uDeviceX,项目名称:uDeviceX,代码行数:17,代码来源:main.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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