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

C++ parse_config_file函数代码示例

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

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



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

示例1: do_config_file

static void do_config_file(const char *filename)
{
	struct stat st;
	int fd;
	void *map;

	fd = open(filename, O_RDONLY);
	if (fd < 0) {
		fprintf(stderr, "fixdep: error opening config file: ");
		perror(filename);
		exit(2);
	}
	if (fstat(fd, &st) < 0) {
		fprintf(stderr, "fixdep: error fstat'ing config file: ");
		perror(filename);
		exit(2);
	}
	if (st.st_size == 0) {
		close(fd);
		return;
	}
	map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
	if ((long) map == -1) {
		perror("fixdep: mmap");
		close(fd);
		return;
	}

	parse_config_file(map, st.st_size);

	munmap(map, st.st_size);

	close(fd);
}
开发者ID:513855417,项目名称:linux,代码行数:34,代码来源:fixdep.c


示例2: openocd_thread

/** OpenOCD runtime meat that can become single-thread in future. It parse
 * commandline, reads configuration, sets up the target and starts server loop.
 * Commandline arguments are passed into this function from openocd_main().
 */
static int openocd_thread(int argc, char *argv[], struct command_context *cmd_ctx)
{
	int ret;

	if (parse_cmdline_args(cmd_ctx, argc, argv) != ERROR_OK)
		return EXIT_FAILURE;

	if (server_preinit() != ERROR_OK)
		return EXIT_FAILURE;

	ret = parse_config_file(cmd_ctx);
	if (ret != ERROR_OK)
		return EXIT_FAILURE;

	ret = server_init(cmd_ctx);
	if (ERROR_OK != ret)
		return EXIT_FAILURE;

	ret = command_run_line(cmd_ctx, "init_targets");
	if (ERROR_OK != ret)
		ret = EXIT_FAILURE;

	if (init_at_startup)
	{
		ret = command_run_line(cmd_ctx, "init");
		if (ERROR_OK != ret)
			return EXIT_FAILURE;
	}

	server_loop(cmd_ctx);

	server_quit();

	return ret;
}
开发者ID:Erguotou,项目名称:openocd-libswd,代码行数:39,代码来源:openocd.c


示例3: config_load

void config_load(void)
{
   if (!g_extern.block_config_read)
   {
      config_set_defaults();
      parse_config_file();
   }
}
开发者ID:jorge925,项目名称:RetroArch,代码行数:8,代码来源:settings.c


示例4: main

int main(void) {
	parse_config_file(".config");
	setup_pci(card_id);

	pci.sendVetoClear();

	close_pci();
	return 0;
}
开发者ID:mzandrew,项目名称:idlab-daq,代码行数:9,代码来源:reset_trigger_flip_flop.cpp


示例5: pam_sm_open_session

/* now the session stuff */
PAM_EXTERN int
pam_sm_open_session (pam_handle_t *pamh, int flags UNUSED,
		     int argc, const char **argv)
{
    int retval;
    char *user_name;
    struct passwd *pwd;
    int ctrl;
    struct pam_limit_s pl;

    D(("called."));

    memset(&pl, 0, sizeof(pl));

    ctrl = _pam_parse(pamh, argc, argv, &pl);
    retval = pam_get_item( pamh, PAM_USER, (void*) &user_name );
    if ( user_name == NULL || retval != PAM_SUCCESS ) {
        pam_syslog(pamh, LOG_CRIT, "open_session - error recovering username");
        return PAM_SESSION_ERR;
     }

    pwd = getpwnam(user_name);
    if (!pwd) {
        if (ctrl & PAM_DEBUG_ARG)
            pam_syslog(pamh, LOG_WARNING,
		       "open_session username '%s' does not exist", user_name);
        return PAM_SESSION_ERR;
    }

    retval = init_limits(&pl);
    if (retval != PAM_SUCCESS) {
        pam_syslog(pamh, LOG_WARNING, "cannot initialize");
        return PAM_ABORT;
    }

    retval = parse_config_file(pamh, pwd->pw_name, ctrl, &pl);
    if (retval == PAM_IGNORE) {
	D(("the configuration file has an applicable '<domain> -' entry"));
	return PAM_SUCCESS;
    }
    if (retval != PAM_SUCCESS) {
        pam_syslog(pamh, LOG_WARNING, "error parsing the configuration file");
        return retval;
    }

    if (ctrl & PAM_DO_SETREUID) {
	setreuid(pwd->pw_uid, -1);
    }
    retval = setup_limits(pamh, pwd->pw_name, pwd->pw_uid, ctrl, &pl);
    if (retval & LOGIN_ERR)
	pam_error(pamh, _("Too many logins for '%s'."), pwd->pw_name);
    if (retval != LIMITED_OK) {
        return PAM_PERM_DENIED;
    }

    return PAM_SUCCESS;
}
开发者ID:OPSF,项目名称:uClinux,代码行数:58,代码来源:pam_limits.c


示例6: read_again

int read_again()
{
	/* tracking files list creation*/
	char *old_list[ntf];
	for(unsigned int i=0; i<ntf; i++){
		old_list[i]=tracked_files[i].logfile;
	}
	

	for(unsigned int i=0; i<ntf; i++){
		if(inotify_rm_watch(inotify_fds[i], inotify_wds[i]) == -1){
			LOG_ERR();
			return -1;
		}
	}
	for(unsigned int i=0; i<ntf; i++){
		if(fclose(tracked_files[i].log_stream)){
			fprintf(core_log, "Cannot close log file \"%s\"\n", tracked_files[i].logfile);
			fflush(core_log);
			return -1;
		}
	}
	free(inotify_fds);
	free(inotify_wds);
	free(fds);
	free(tracked_files);


	int ret;

	ret = parse_config_file((const char *)config_file);
	CHECK_RETVAL(ret);


	ret = init_inotify_actions();
	CHECK_RETVAL(ret);

	init_pollfd_structures();


	/*not good code*/
	ret = create_log_streams(NOTRUNCATE);

	for(unsigned int i=0; i<ntf; i++){
		if(!is_in_list(old_list, tracked_files[i].logfile)){
			if(truncate((const char *)tracked_files[i].logfile, (off_t)0)){
				LOG_ERR();
			}
		}
	}

	CHECK_RETVAL(ret);
	print_starttime_in_new_logfiles();

	return 0;	
}
开发者ID:chestnykh,项目名称:Inotifiled,代码行数:56,代码来源:runtime_read_config.c


示例7: main

int main(void) {
	unsigned long int total_number_of_quarter_events_to_read_per_fiber_channel = 0;

	parse_config_file(".config");
	setup_pci(card_id);
	readout_all_pending_data();
	close_pci();

	return 0;
}
开发者ID:mzandrew,项目名称:idlab-daq,代码行数:10,代码来源:readout_all_pending_data.cpp


示例8: rpmemd_config_read

/*
 * rpmemd_config_read -- read and merge cl params and config from file
 */
int
rpmemd_config_read(struct rpmemd_config *config, int argc, char *argv[])
{
	const char *config_file = RPMEMD_DEFAULT_CONFIG_FILE;
	rpmemd_config_set_default(config);
	uint64_t cl_options = 0;

	parse_cl_args(argc, argv, config, &config_file, &cl_options);
	return parse_config_file(config_file, config, cl_options);
}
开发者ID:AmesianX,项目名称:nvml,代码行数:13,代码来源:rpmemd_config.c


示例9: load_fileinfo

void
load_fileinfo(ChmFile *book)
{
  GList *pairs, *list;
  gchar *path;

  path = g_strdup_printf("%s/%s", book->dir, CHMSEE_BOOKINFO_FILE);

  g_debug("bookinfo path = %s", path);

  pairs = parse_config_file("bookinfo", path);

  for (list = pairs; list; list = list->next) {
    Item *item;

    item = list->data;

    if (strstr(item->id, "hhc")) {
      book->hhc = g_strdup(item->value);
      continue;
    }

    if (strstr(item->id, "hhk")) {
      book->hhk = g_strdup(item->value);
      continue;
    }

    if (strstr(item->id, "home")) {
      book->home = g_strdup(item->value);
      continue;
    }

    if (strstr(item->id, "title")) {
      book->title = g_strdup(item->value);
      continue;
    }

    if (strstr(item->id, "encoding")) {
      book->encoding = g_strdup(item->value);
      continue;
    }

    if (strstr(item->id, "variable_font")) {
      book->variable_font = g_strdup(item->value);
      continue;
    }

    if (strstr(item->id, "fixed_font")) {
      book->fixed_font = g_strdup(item->value);
      continue;
    }
  }

  free_config_list(pairs);
}
开发者ID:WangGL1985,项目名称:chmsee,代码行数:55,代码来源:chmfile.c


示例10: mod_init

/*
 * module initialization function 
 */
static int mod_init(void)
{
	LM_DBG("initializing...\n");

	init_db_url( db_url , 1 /*can be null*/);
	address_table.len = strlen(address_table.s);
	ip_col.len = strlen(ip_col.s);
	proto_col.len = strlen(proto_col.s);
	pattern_col.len = strlen(pattern_col.s);
	info_col.len = strlen(info_col.s);
	grp_col.len = strlen(grp_col.s);
	mask_col.len = strlen(mask_col.s);
	port_col.len = strlen(port_col.s);

	allow[0].filename = get_pathname(default_allow_file);
	allow[0].rules = parse_config_file(allow[0].filename);

	if (allow[0].rules) {
		LM_DBG("default allow file (%s) parsed\n", allow[0].filename);
	} else {
		LM_INFO("default allow file (%s) not found => empty rule set\n",
			allow[0].filename);
	}

	deny[0].filename = get_pathname(default_deny_file);
	deny[0].rules = parse_config_file(deny[0].filename);

	if (deny[0].rules) {
		LM_DBG("default deny file (%s) parsed\n", deny[0].filename);
	} else {
		LM_INFO("default deny file (%s) not found => empty rule set\n",
			deny[0].filename);
	}

	if (init_address() != 0) {
		LM_ERR("failed to initialize the allow_address function\n");
		return -1;
	}

	rules_num = 1;
	return 0;
}
开发者ID:mtulio,项目名称:mtulio,代码行数:45,代码来源:permissions.c


示例11: parse_config_file

void SlideshowController::show_next_slide()
{

  Slide current_slide;

  parse_config_file(slideshow_data_model_->
                    config_file_path());
  build_slide_queue();

  // Check if image folder is empty
  if (slideshow_data_model_->slideshow_queue()->size() == 0)
    {
      slideshow_window_view_->display_no_images_error();
      return;
    }

  current_slide = slideshow_data_model_->
      slideshow_queue()->service();
  if (current_slide.slide_type() == IMAGE)
    {
      disconnect(&main_slide_timer_, SIGNAL(timeout()), this, SLOT(show_next_slide()));
      slideshow_window_view_->display_image(current_slide.full_path());
      connect(&main_slide_timer_, SIGNAL(timeout()),
          this, SLOT(show_next_slide()));

      if (!slideshow_data_model_->slideshow_queue()->marketing_queued())
        {
          main_slide_timer_.start(
            slideshow_data_model_->main_timer_interval());
        }
      else
        {
          main_slide_timer_.start(
            slideshow_data_model_->indiv_info_slide_interval());
        }
    }
  else if (current_slide.slide_type() == VIDEO)
    {
      if (slideshow_data_model_->video_disabled())
        {
          main_slide_timer_.start(200);
          return;
        }
      // For some reason, this does not stop the timer
      // Disconnecting and reconnecting is a workaround
      main_slide_timer_.stop();
      marketing_slide_timer_.stop();
      slideshow_window_view_->display_video(current_slide.full_path());
      disconnect(&main_slide_timer_, SIGNAL(timeout()), this, SLOT(show_next_slide()));

    }
  qWarning() <<"[show]: " + current_slide.full_path();
}
开发者ID:benoid,项目名称:SimpleSlideshow,代码行数:53,代码来源:slideshow_controller.cpp


示例12: main

int main(void) {
	unsigned long int total_number_of_quarter_events_to_read_per_fiber_channel = 0;

	parse_config_file(".config");
	setup_pci(card_id);
	usleep(10000);
	send_soft_trigger_request_command_packet();
	usleep(10000);
	close_pci();

	return 0;
}
开发者ID:diqiuren,项目名称:idlab-daq,代码行数:12,代码来源:trigger_a_quarter_event_from_all_connected_modules.cpp


示例13: config_file_read

/*
 * Read and populate the given config parsed data structure.
 *
 * Return 0 on success or else a negative value.
 */
ATTR_HIDDEN
int config_file_read(const char *filename, struct configuration *config)
{
	int ret;
	FILE *fp;

	assert(config);

	/* Clear out the structure */
	memset(config, 0x0, sizeof(*config));

	/* If a filename wasn't provided, use the default. */
	if (!filename) {
		filename = DEFAULT_CONF_FILE;
		DBG("Config file not provided by TORSOCKS_CONF_FILE. Using default %s",
				filename);
	}

	fp = fopen(filename, "r");
	if (!fp) {
		WARN("Config file not found: %s. Using default for Tor", filename);
		(void) set_tor_address(DEFAULT_TOR_ADDRESS, config);
		/*
		 * We stringify the default value here so we can print the debug
		 * statement in the function call to set port.
		 */
		(void) set_tor_port(XSTR(DEFAULT_TOR_PORT), config);

		ret = set_onion_info(
				DEFAULT_ONION_ADDR_RANGE "/" DEFAULT_ONION_ADDR_MASK, config);
		if (!ret) {
			/* ENOMEM is probably the only case here. */
			goto error;
		}

		config->allow_inbound = 0;
		goto end;
	}

	ret = parse_config_file(fp, config);
	if (ret < 0) {
		goto error;
	}

	DBG("Config file %s opened and parsed.", filename);

end:
error:
	if (fp) {
		fclose(fp);
	}
	return ret;
}
开发者ID:MerlijnWajer,项目名称:torsocks,代码行数:58,代码来源:config-file.c


示例14: config_file

/*! \fn FaceDetectorPlugin::loadConfig(string sConfigFileName)
 *  \param sConfigFileName is path to configuration to load parameters from
 */
void FaceDetectorPlugin::loadConfig(string sConfigFileName)
{
    options_description config_file("Configuration file options.");
    variables_map vm;
    config_file.add_options()
    // Haar face detector options
        ((m_sConfigSectionName + string(".cascade")).c_str(),
            value<string>()->default_value(DEFAULT_HAAR_FACE_CASCADE_PATH))
        ((m_sConfigSectionName + string(".scale")).c_str(),
            value<double>()->default_value(DEFAULT_HAAR_SCALE_FACTOR))
        ((m_sConfigSectionName + string(".flag")).c_str(),
            value<int>()->default_value(DEFAULT_HAAR_FLAG))
        ((m_sConfigSectionName + string(".min-nbrs")).c_str(),
            value<int>()->default_value(DEFAULT_HAAR_MIN_NEIGHBORS))
        ((m_sConfigSectionName + string(".min-obj-width")).c_str(),
            value<double>()->default_value(DEFAULT_DETECTOR_MIN_OBJECT_SIZE_WIDTH))
        ((m_sConfigSectionName + string(".min-obj-height")).c_str(),
            value<double>()->default_value(DEFAULT_DETECTOR_MIN_OBJECT_SIZE_HEIGHT))
        ((m_sConfigSectionName + string(".min-alarm-score")).c_str(),
            value<double>()->default_value(DEFAULT_MIN_ALARM_SCORE))
        ((m_sConfigSectionName + string(".max-alarm-score")).c_str(),
            value<double>()->default_value(DEFAULT_MAX_ALARM_SCORE))
        ((m_sConfigSectionName + string(".image-scale-factor")).c_str(),
            value<double>()->default_value(DEFAULT_IMAGE_SCALE_FACTOR))
        ((m_sConfigSectionName + string(".det-cause")).c_str(),
            value<string>()->default_value(DETECTED_CAUSE))
        ((m_sConfigSectionName + string(".log-prefix")).c_str(),
            value<string>()->default_value(LOG_PREFIX))
    ;
    ifstream ifs(sConfigFileName.c_str());
    store(parse_config_file(ifs, config_file, true), vm);
    notify(vm);

    m_fScaleFactor = vm[(m_sConfigSectionName + string(".scale")).c_str()].as<double>();
    m_nMinNeighbors = vm[(m_sConfigSectionName + string(".min-nbrs")).c_str()].as<int>();
    m_nFlag = vm[(m_sConfigSectionName + string(".flag")).c_str()].as<int>();
    m_fMinObjWidth = vm[(m_sConfigSectionName + string(".min-obj-width")).c_str()].as<double>();
    m_fMinObjHeight = vm[(m_sConfigSectionName + string(".min-obj-height")).c_str()].as<double>();
    m_fMinAlarmScore = vm[(m_sConfigSectionName + string(".min-alarm-score")).c_str()].as<double>();
    m_fMaxAlarmScore = vm[(m_sConfigSectionName + string(".max-alarm-score")).c_str()].as<double>();
    m_fImageScaleFactor = vm[(m_sConfigSectionName + string(".image-scale-factor")).c_str()].as<double>();

    m_sDetectionCause = vm[(m_sConfigSectionName + string(".det-cause")).c_str()].as<string>();
    m_sLogPrefix = vm[(m_sConfigSectionName + string(".log-prefix")).c_str()].as<string>();

//    if (m_sHaarCascadePath != vm[(m_sConfigSectionName + string(".cascade")).c_str()].as<string>())
//    {
        m_sHaarCascadePath = vm[(m_sConfigSectionName + string(".cascade")).c_str()].as<string>();
        _loadHaarCascade(m_sHaarCascadePath);
//    }
    zmLoadConfig();
    log(LOG_NOTICE, "Face Detector Plugin\'s  Object is configured.");
}
开发者ID:SteveGilvarry,项目名称:zum,代码行数:56,代码来源:face_detector_plugin.cpp


示例15: main

int main(void) {
	parse_config_file(".config");
	setup_pci(card_id);
	should_soft_trigger = true;
	readout_all_pending_data();

	set_some_DACs_to(0, 0xe);
	//set_all_DACs_to(0);
	//set_all_DACs_to_built_in_nominal_values();

	close_pci();
	return 0;
}
开发者ID:diqiuren,项目名称:idlab-daq,代码行数:13,代码来源:turn_off_all_DACs.cpp


示例16: parse_config_file

 basic_parsed_options<charT>
 parse_config_file(const char* filename, 
                   const options_description& desc,
                   bool allow_unregistered)
 { 
     // Parser return char strings
     std::basic_ifstream< charT > strm(filename);
     if (!strm) 
     {
         pdalboost::throw_exception(reading_file(filename));
     }
     return parse_config_file(strm, desc, allow_unregistered);
 }
开发者ID:xhy20070406,项目名称:PDAL,代码行数:13,代码来源:parsers.cpp


示例17: main

int main(void) {
	// setup:
	parse_config_file(".config");
	open_status_file_for_reading_and_writing();
	read_status_file();
	create_directory_if_necessary(location_of_raw_datafiles);
	generate_new_base_filename();
	setup_pci(card_id);
	readout_all_pending_data();
	setup_filenames_for_fiber();
	if (init_camac("CAMAC_config.txt")) {
		cerr << "ERROR:  could not connect to CAMAC crate" << endl;
//		exit(7);
	}
//	if (CAMAC_initialized) {
//		CAMAC_initialize_3377s();
		open_CAMAC_file();
//	}
	setup_to_catch_ctrl_c(close_all_files);
	open_logfile();
	open_files_for_all_enabled_fiber_channels();
	unsigned short int beginning_window = 0;
	unsigned short int ending_window = 63;
	set_start_and_end_windows(beginning_window, ending_window);
	usleep(50000);

	// testing:
	should_soft_trigger = true;

	// actual running:
	while (1) {
		wait_for_start_of_spill();
		while (spill_is_active()) {
			readout_an_event(true);
			read_data_from_CAMAC_and_write_to_CAMAC_file();
//			CAMAC_read_3377s();
			printf("\n");
		}
//		increment_spill_number();
//		write_status_file();
//		generate_new_base_filename();
//		split_fiber_file_to_prepare_for_next_spill();
//		split_CAMAC_file_to_prepare_for_next_spill();
//		usleep(250000);
//		sync();
	}

	// cleanup:
	close_all_files();
	return 0;
}
开发者ID:mzandrew,项目名称:idlab-daq,代码行数:51,代码来源:shennanigans.cpp


示例18: LoadAConfigFile

   void LoadAConfigFile(std::string filename)
   {
      bool ALLOW_UNREGISTERED = true;

      po::options_description config_opts;
      config_opts.add(config_only_options).add(common_options);

      std::ifstream cfg_file(filename.c_str());
      if (cfg_file)
      {
         store(parse_config_file(cfg_file, config_opts, ALLOW_UNREGISTERED), results);
         notify(results);
      }
   }
开发者ID:DanielaE,项目名称:boost.program_options,代码行数:14,代码来源:options_heirarchy.cpp


示例19: main

int main(int argc, char *argv[])
{
    FILE *file=fopen("test.config", "w");
    
    fwrite(some_data, 1, strlen(some_data),
                     file);
    fclose(file);

    parse_config_file("test.config", 0);

    printf("abc=%s\n", get_config_var("abc"));

    return 0;
}
开发者ID:mikephp,项目名称:linux-dev-framework,代码行数:14,代码来源:config_file_test.c


示例20: main

int main(void) {
	unsigned long int total_number_of_quarter_events_to_read_per_fiber_channel = 0;

	parse_config_file(".config");
	setup_pci(card_id);
	should_soft_trigger = true;
	readout_all_pending_data();

	setup_feedback_enables_and_goals(1);
	
	close_pci();

	return 0;
}
开发者ID:diqiuren,项目名称:idlab-daq,代码行数:14,代码来源:turn_feedback_on.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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