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

C++ conf_init函数代码示例

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

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



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

示例1: vss_opts_changed

static int vss_opts_changed(struct sdirs *sdirs, struct conf *cconf,
	const char *incexc)
{
	int ret=0;
	struct conf oldconf;
	struct conf newconf;
	conf_init(&oldconf);
	conf_init(&newconf);

	// Figure out the old config, which is in the incexc file left
	// in the current backup directory on the server.
	if(parse_incexcs_path(&oldconf, sdirs->cincexc))
	{
		// Assume that the file did not exist, and therefore
		// the old split_vss setting is 0.
		oldconf.split_vss=0;
		oldconf.strip_vss=0;
	}

	// Figure out the new config, which is either in the incexc file from
	// the client, or in the cconf on the server.
	if(incexc)
	{
		if(parse_incexcs_buf(&newconf, incexc))
		{
			// Should probably not got here.
			newconf.split_vss=0;
			newconf.strip_vss=0;
		}
	}
	else
	{
		newconf.split_vss=cconf->split_vss;
		newconf.strip_vss=cconf->strip_vss;
	}

	if(newconf.split_vss!=oldconf.split_vss)
	{
		logp("split_vss=%d (changed since last backup)\n",
			newconf.split_vss);
		ret=1;
	}
	if(newconf.strip_vss!=oldconf.strip_vss)
	{
		logp("strip_vss=%d (changed since last backup)\n",
			newconf.strip_vss);
		ret=1;
	}
	if(ret) logp("All files will be treated as new\n");
	return ret;
}
开发者ID:jkniiv,项目名称:burp,代码行数:51,代码来源:run_action.c


示例2: conf_load

int conf_load(struct conf *conf, const char *conf_name,
              char *config_search_dirs[], char *plugin_search_dirs[])
{
	conf_init(conf);
	cur_conf = conf;

	cur_conf->config_search_dirs = config_search_dirs;
	cur_conf->plugin_search_dirs = plugin_search_dirs;
	if (!(yyin = conf_push_config(cur_conf, conf_name, NULL))) {
		return -1;
	}

	if (yyparse()) {
		if (fclose(yyin)) {
			wminput_err("Error closing configuration file");
		}
		conf_unload(cur_conf);
		return -1;
	}

	if (uinput_open(cur_conf)) {
		conf_unload(cur_conf);
		return -1;
	}

	return 0;
}
开发者ID:donington,项目名称:cwiid,代码行数:27,代码来源:conf.c


示例3: reload

int reload(struct conf *conf, const char *conffile, bool firsttime,
           int oldmax_children, int oldmax_status_children, int json)
{
    if(!firsttime) logp("Reloading config\n");

    conf_init(conf);

    if(conf_load(conffile, conf, 1)) return 1;

    /* change umask */
    umask(conf->umask);

    // Try to make JSON output clean.
    if(json) conf->log_to_stdout=0;

    // This will turn on syslogging which could not be turned on before
    // conf_load.
    set_logfp(NULL, conf);

#ifndef HAVE_WIN32
    if(conf->mode==MODE_SERVER)
        setup_signals(oldmax_children, conf->max_children,
                      oldmax_status_children, conf->max_status_children);
#endif

    // Do not try to change user or group after the first time.
    if(firsttime && chuser_and_or_chgrp(conf))
        return 1;

    return 0;
}
开发者ID:jkniiv,项目名称:burp,代码行数:31,代码来源:prog.c


示例4: test2

void test2() {
	struct aug_conf c;
	int argc = 1;
	char *argv[] = {g_argv[0], NULL};
	const char *path = "/tmp/augrc";
	dictionary *ini;
	FILE *f = fopen(path, "w");
	if(f == NULL)
		err(1, "file: %s", path);
	fclose(f);

	diag("blank ini file and no args");
	ini = ciniparser_load(path);
	ok1(ini != NULL);

	conf_init(&c);
	ok1(opt_parse(argc, argv, &c) == 0);
	ok1(opt_set_amt(&c) == 0);
	conf_merge_ini(&c, ini);	
	ok1( compare_conf_vals(&c, &g_default_conf) == 0);

	conf_free(&c);
#define TEST2AMT 4
	
	ciniparser_freedict(ini);
	unlink(path);
}
开发者ID:cantora,项目名称:aug,代码行数:27,代码来源:conf_test.c


示例5: main

int main(int argc, char *argv[])
{
	int i, len, total_tests;
#define TESTN(_num) {test##_num, TEST##_num##AMT}
	struct conf_test tests[] = {
		TESTN(1),
		TESTN(2),
		TESTN(3),
		TESTN(4),
		TESTN(5)
	};

	g_argc = argc;
	g_argv = argv;
	conf_init(&g_default_conf);

	total_tests = 0;	
	len = AUG_ARRAY_SIZE(tests);
	for(i = 0; i < len; i++) {
		total_tests += tests[i].amt;
	}

	plan_tests(total_tests);

	for(i = 0; i < len; i++) {
		(*tests[i].fn)();
	}

	return exit_status();
}
开发者ID:cantora,项目名称:aug,代码行数:30,代码来源:conf_test.c


示例6: my_conf_init

int my_conf_init(const char *log)
{
    int res;

    if( (res = conf_init(log)) < 0 ){
        return res;
    }

    CONF_FILL_INT(daemon);
    CONF_FILL_INT(worker);
    CONF_FILL_INT(max_connections);
    CONF_FILL_STR(ip);
    CONF_FILL_STR(port);
    CONF_FILL_INT(read_client_timeout);
    CONF_FILL_INT(write_mysql_timeout);
    CONF_FILL_INT(read_mysql_write_client_timeout);
    CONF_FILL_INT(prepare_mysql_timeout);
    CONF_FILL_INT(idle_timeout);
    CONF_FILL_INT(mysql_ping_timeout);
    CONF_FILL_STR(user);
    CONF_FILL_STR(passwd);
    CONF_FILL_STR(mysql_conf);
    CONF_FILL_STR(log);
    CONF_FILL_STR(loglevel);
    CONF_FILL_STR(sqllog);

    return 0;
}
开发者ID:chenbk85,项目名称:myrelay,代码行数:28,代码来源:my_conf.c


示例7: config_read_file

int
config_read_file(char *path)
{
	HASH_CTX *hctx;
	int xerror;
	char ebuf[BUFSIZ];

	if (path == NULL)
	{
		if (Cfilename == NULL)
			return errno = EINVAL;
		else
			path = Cfilename;
	}
	else
		Cfilename = str_dup(path, __FILE__, __LINE__);

	hctx = conf_init(NULL, path, ebuf, sizeof ebuf);
	if (hctx == NULL)
	{
		xerror = (errno == 0) ? errno = ENOMEM : errno;
		(void) fprintf(stderr, "Read: %s\n", ebuf);
		return errno = xerror;
	}

	(void) pthread_mutex_lock(&Hconfmutex);
	 if (Hconfbak != NULL)
		Hconfbak = conf_shutdown(Hconfbak);
	 Hconfbak = Hconf;
	 Hconf = hctx;
	(void) pthread_mutex_unlock(&Hconfmutex);
	return errno=0;
}
开发者ID:bcxorg,项目名称:onepixd,代码行数:33,代码来源:readconf.c


示例8: main

int main( int argc, char *argv[] )
{
	conf_t conf[1];
	search_t *res;
	int i, j;
	
	if( argc != 2 )
	{
		fprintf( stderr, "Incorrect amount of arguments\n" );
		return( 1 );
	}
	
	conf_init( conf );
	
	res = malloc( sizeof( search_t ) * ( conf->search_amount + 1 ) );
	memset( res, 0, sizeof( search_t ) * ( conf->search_amount + 1 ) );
	res->conf = conf;
	
	i = search_makelist( res, argv[1] );
	if( i == -1 )
	{
		fprintf( stderr, "File not found\n" );
		return( 1 );
	}
	printf( "%i usable mirrors:\n", search_getspeeds( res, i ) );
	search_sortlist( res, i );
	for( j = 0; j < i; j ++ )
		printf( "%-70.70s %5i\n", res[j].url, res[j].speed );
	
	return( 0 );
}
开发者ID:Krusca,项目名称:axeldroid,代码行数:31,代码来源:search.c


示例9: main

int main(int argc, LPSTR argv[]) {
	int ret;
	Config conf;
	TCHAR conf_file[MAX_PATH];
	
	conf_init(&conf);
	
	ret = GetModuleFileName(NULL, conf_file, MAX_PATH);
	if (ret <= 0) {
		my_message_box("Unable to GetModuleFileName ... (code: %d)\n", ret);
		return 1;
	}
	
	PathRemoveExtension(conf_file);
	PathAddExtension(conf_file, ".ini");
	      
	if (! PathFileExists(conf_file)) {
		my_message_box("No such file %s\n", conf_file);
		return 1;
	}
	
	read_conf(conf_file, &conf);
	
	if (conf.delay != 0)
		Sleep(conf.delay * 1000);
	
	ret = launch(conf);
	return ret;
}
开发者ID:gvsurenderreddy,项目名称:openulteo,代码行数:29,代码来源:main.c


示例10: init

void
init(void)
{
	app_init();
	doi_init();
	exchange_init();
	group_init();
	ipsec_init();
	isakmp_doi_init();
	libcrypto_init();

	timer_init();

	/* The following group are depending on timer_init having run.  */
	conf_init();
	connection_init();

	/* This depends on conf_init, thus check as soon as possible. */
	log_reinit();

	/* policy_init depends on conf_init having run.  */
	policy_init();

	/* Depends on conf_init and policy_init having run */
	cert_init();
	crl_init();

	sa_init();
	transport_init();
	virtual_init();
	udp_init();
	nat_t_init();
	udp_encap_init();
	vendor_init();
}
开发者ID:sofuture,项目名称:bitrig,代码行数:35,代码来源:init.c


示例11: 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


示例12: pd_init

void pd_init(void)
{
    mess_init();
    obj_init();
    conf_init();
    glob_init();
    garray_init();
}
开发者ID:Tzero2,项目名称:pd,代码行数:8,代码来源:m_pd.c


示例13: os_main

int os_main(int argc, char* argv[])
{
	adv_conf* context;
	char* section_map[1];

	context = conf_init();

	if (os_init(context) != 0)
		goto err_conf;

	inputb_reg(context, 1);
	inputb_reg_driver_all(context);

	if (conf_input_args_load(context, 0, "", &argc, argv, error_callback, 0) != 0)
		goto err_os;

	if (argc > 1) {
		fprintf(stderr, "Unknown argument '%s'\n", argv[1]);
		goto err_os;
	}

	section_map[0] = "";
	conf_section_set(context, section_map, 1);

	if (inputb_load(context) != 0)
		goto err_os;

	if (os_inner_init("AdvanceINPUT") != 0)
		goto err_os;

	if (inputb_init() != 0)
		goto err_os_inner;

	if (inputb_enable(0) != 0)
		goto err_input;

	run();

	inputb_disable();
	inputb_done();
	os_inner_done();
	os_done();
	conf_done(context);

	return EXIT_SUCCESS;

err_input:
	inputb_done();
err_os_inner:
	os_inner_done();
err_os:
	os_done();
err_conf:
	conf_done(context);
	return EXIT_FAILURE;

}
开发者ID:BirchJD,项目名称:advancemame-0.106.1-RPi,代码行数:57,代码来源:i.c


示例14: settings_init

int settings_init(const char *path) {
    settings_path = path;
    memset(&_settings, 0, sizeof(settings));
    for(int i = 0;i < sizeof(struct_to_fields)/sizeof(struct_to_field);i++) {
        const struct_to_field *s2f = &struct_to_fields[i];
        settings_add_fields(s2f->fields, s2f->num_fields);
    }
    return conf_init(settings_path);
}
开发者ID:acasaccia,项目名称:openomf,代码行数:9,代码来源:settings.c


示例15: kadnode_init

int kadnode_init(void) {
	if (gconf == NULL) {
		// Setup gconf
		conf_init();
		return 0;
	} else {
		return 1;
	}
}
开发者ID:mwarning,项目名称:KadNode,代码行数:9,代码来源:libkadnode.c


示例16: conf_open

static rmt_conf *
conf_open(char *filename)
{
    int ret;
    rmt_conf *cf = NULL;
    FILE *fh = NULL;
    sds path = NULL;

    if (filename == NULL) {
        log_error("ERROR: configuration file name is NULL.");
        return NULL;
    }

    path = getAbsolutePath(filename);
    if (path == NULL) {
        log_error("ERROR: configuration file name '%s' is error.", filename);
        goto error;
    }

    fh = fopen(path, "r");
    if (fh == NULL) {
        log_error("ERROR: failed to open configuration '%s': %s", path,
                  strerror(errno));
        goto error;
    }

    cf = rmt_alloc(sizeof(*cf));
    if (cf == NULL) {
        goto error;
    }

    ret = conf_init(cf);
    if(ret != RMT_OK){
        goto error;
    }

    cf->fname = path;
    cf->fh = fh;

    return cf;

error:

    if(fh != NULL) {
        fclose(fh);
    }

    if (cf != NULL) {
        conf_destroy(cf);
    }

    if (path != NULL) {
        sdsfree(path);
    }
    
    return NULL;
}
开发者ID:654894017,项目名称:redis-migrate-tool,代码行数:57,代码来源:rmt_conf.c


示例17: main

int main(int argc, char **argv)
{
	struct sigaction sig_stop;
	struct sigaction sig_time;

	_main = main_init(argc, argv);
	_log = log_init();
	_main->conf = conf_init(argc, argv);
	_main->work = work_init();

	_main->tcp = tcp_init();
	_main->node = node_init();
	_main->mime = mime_init();

	/* Check configuration */
	conf_print();

	/* Catch SIG INT */
	unix_signal(&sig_stop, &sig_time);

	/* Fork daemon */
	unix_fork(log_console(_log));

	/* Increase limits */
	unix_limits(_main->conf->cores, CONF_EPOLL_MAX_EVENTS);

	/* Load mime types */
	mime_load();
	mime_hash();

	/* Prepare TCP daemon */
	tcp_start();

	/* Drop privileges */
	unix_dropuid0();

	/* Start worker threads */
	work_start();

	/* Stop worker threads */
	work_stop();

	/* Stop TCP daemon */
	tcp_stop();

	mime_free();
	node_free();
	tcp_free();

	work_free();
	conf_free();
	log_free(_log);
	main_free();

	return 0;
}
开发者ID:tempbottle,项目名称:torrentkino,代码行数:56,代码来源:tumbleweed.c


示例18: main

int main()
{
	conf_init();
	log_reset();
	log_daemon();
	while(1)
	{
		sleep(10);
	}
}
开发者ID:exeasy,项目名称:pma2,代码行数:10,代码来源:logsrv.c


示例19: pd_init

void pd_init(void)
{
    if (!pd_this)
        pd_this = pdinstance_donew(0);
    mess_init();
    obj_init();
    conf_init();
    glob_init();
    garray_init();
}
开发者ID:amurtet,项目名称:pure-data,代码行数:10,代码来源:m_pd.c


示例20: pool_init

/**	函数名:	pool_init 
  * 功能描述:	初始化线程池
  *	参数列表:	max_thread_num :输入要建的线程池的线程最大数目
  *	返回值:	无
  */
void pool_init(int max_thread_num)
{
	int i;
	conf_init();
	if(max_thread_num < g_min_thread_num)
	{
		max_thread_num = g_min_thread_num;
	}
	else if(max_thread_num > g_max_thread_num)
	{
		max_thread_num = g_max_thread_num;
	}
	pthread_attr_t attr;
	int err;
	err= pthread_attr_init(&attr);
	if(err != 0)
	{
		perror("pthread_attr_init");
		exit(1);
	}
	err = pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);

	if(err != 0)
	{
		perror("pthread_attr_setdetachstate");
		exit(1);
	}

	g_pool = (thread_pool *)malloc(sizeof(thread_pool));
	
	pthread_mutex_init(&(g_pool->queue_lock),NULL);
	pthread_mutex_init(&(g_pool->remove_queue_lock),NULL);
	pthread_cond_init(&(g_pool->queue_ready),NULL);

	g_pool->queue_head = NULL;
	g_pool->max_thread_num = max_thread_num;
	g_pool->thread_queue =NULL;
	g_pool->thread_idle_queue = NULL;
	g_pool->idle_queue_num = 0;
	g_pool->cur_queue_size = 0;
	g_pool->shutdown = 0;

	int temp;
	for(i = 0; i < max_thread_num; i++)
	{
		pthread_t thread_id;
		pthread_create(&thread_id,&attr,thread_routine,NULL);
		thread_queue_add_node(&(g_pool->thread_queue),thread_id,&temp);
		printf("temp&&&&&&&&&&&&&%d\n",temp);

	}
	
	pthread_attr_destroy(&attr);

}
开发者ID:Boshin,项目名称:thread_pool,代码行数:60,代码来源:threadpool.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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