本文整理汇总了C++中conf_parse函数的典型用法代码示例。如果您正苦于以下问题:C++ conf_parse函数的具体用法?C++ conf_parse怎么用?C++ conf_parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了conf_parse函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: module_init
static int module_init(void)
{
struct contacts *contacts = baresip_contacts();
char path[256] = "", file[256] = "";
int err;
err = conf_path_get(path, sizeof(path));
if (err)
return err;
if (re_snprintf(file, sizeof(file), "%s/contacts", path) < 0)
return ENOMEM;
if (!conf_fileexist(file)) {
(void)fs_mkdir(path, 0700);
err = write_template(file);
if (err)
return err;
}
err = conf_parse(file, confline_handler, contacts);
if (err)
return err;
err = cmd_register(baresip_commands(), cmdv, ARRAY_SIZE(cmdv));
if (err)
return err;
info("Populated %u contacts\n",
list_count(contact_list(contacts)));
return err;
}
开发者ID:Studio-Link-v2,项目名称:baresip,代码行数:35,代码来源:contact.c
示例2: conf_load
int conf_load(const char * path, struct conf_entry * root)
{
uint8_t * buf;
FILE * f;
int size;
/* open the file for reading */
if (!(f = fopen(path, "r"))) {
DBG(DBG_ERROR, "fopen(\"%s\", \"r\") fail!", path);
return -1;
}
/* get the file's size */
fseek(f, 0, SEEK_END);
size = ftell(f);
rewind(f);
/* alloc memory for reading */
buf = (uint8_t *)calloc(1, size + 1);
/* read the file */
if ((fread(buf, size, 1, f)) < 1) {
DBG(DBG_ERROR, "fread() fail!");
return -1;
}
/* close the file */
fclose(f);
/* null terminate the string */
buf[size] = '\0';
return conf_parse(buf, root);
}
开发者ID:bobmittmann,项目名称:trdp_proxy,代码行数:32,代码来源: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: 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
示例5: main
int main(int ac, char **av)
{
conf_parse(av[1]);
menu_build_message_list(menu_get_root_menu(NULL));
menu__xgettext();
return 0;
}
开发者ID:B-Rich,项目名称:coreboot,代码行数:8,代码来源:kxgettext.c
示例6: 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
示例7: lkconfig__conf_parse
/**
* Helper function.
*
* Reads symbols from a kconfig file and returns zero on success.
* Otherwise, a python exception is created and a non-zero value is returned.
*
* @param kconfig_file path to the top-level Kconfig file
*
* @return 0 => success, non-zero => failure
*
* */
static int lkconfig__conf_parse ( const char* const kconfig_file ) {
/*
* FIXME:
* conf_parse() from zconf.tab.c calls exit(1) on errors;
* could modify it to return non-zero int on error
* */
conf_parse ( kconfig_file );
return 0;
}
开发者ID:dywisor,项目名称:kernelconfig,代码行数:20,代码来源:lkconfig.c
示例8: load_conf
void
load_conf(struct opts *opts)
{
FILE *f;
struct conf_entry *conf, *e;
char *conf_file = opts->conf_file;
if (!opts->conf_file)
conf_file = DEFAULT_CONF_FILE;
f = fopen (conf_file, "r");
if (!f) {
if (opts->conf_file) {
pfatal ("can't open conf file '%s'", opts->conf_file);
} else {
pinfo ("can't open conf file '%s'", conf_file);
return;
}
}
conf = conf_parse (f);
if (!conf)
pfatal ("can't parse config file");
for (e = conf; e; e = e->next) {
if (!strcmp (e->key, "max-tries") && e->value) {
opts->max_tries = atoi (e->value);
} else if (!strcmp (e->key, "min-steady-state-interval") && e->value) {
opts->min_steady_state_interval = atoi (e->value);
} else if (!strcmp (e->key, "wait-between-tries") && e->value) {
opts->wait_between_tries = atoi (e->value);
} else if (!strcmp (e->key, "subprocess-tries") && e->value) {
opts->subprocess_tries = atoi (e->value);
} else if (!strcmp (e->key, "subprocess-wait-between-tries") && e->value) {
opts->subprocess_wait_between_tries = atoi (e->value);
} else if (!strcmp (e->key, "steady-state-interval") && e->value) {
opts->steady_state_interval = atoi (e->value);
} else if (!strcmp (e->key, "base-path") && e->value) {
opts->base_path = strdup (e->value);
if (!opts->base_path)
fatal ("out of memory for base path");
} else if (!strcmp (e->key, "should-sync-hwclock")) {
opts->should_sync_hwclock = e->value ? !strcmp(e->value, "yes") : 1;
} else if (!strcmp (e->key, "should-load-disk")) {
opts->should_load_disk = e->value ? !strcmp(e->value, "yes") : 1;
} else if (!strcmp (e->key, "should-save-disk")) {
opts->should_save_disk = e->value ? !strcmp(e->value, "yes") : 1;
} else if (!strcmp (e->key, "should-netlink")) {
opts->should_netlink = e->value ? !strcmp(e->value, "yes") : 1;
} else if (!strcmp (e->key, "dry-run")) {
opts->dry_run = e->value ? !strcmp(e->value, "yes") : 1;
} else if (!strcmp (e->key, "jitter") && e->value) {
opts->jitter = atoi (e->value);
} else if (!strcmp (e->key, "verbose")) {
verbose = e->value ? !strcmp(e->value, "yes") : 1;
} else if (!strcmp (e->key, "source")) {
e = parse_source(opts, e);
}
}
}
开发者ID:pjbakker,项目名称:tlsdate,代码行数:57,代码来源:tlsdated.c
示例9: main
int main(int ac, char **av)
{
FILE *base;
if (ac < 1) {
if ((base = fopen ("arch/x86/Kconfig", "r")) == NULL) {
//Kernel < 2.6.24 with old arch
conf_parse("arch/i386/Kconfig");
}
else {
conf_parse("arch/i386/Kconfig");
fclose(base);
}
}
else
conf_parse(av[1]);
print_menu(&rootmenu);
return 0;
}
开发者ID:Ginfung,项目名称:linux-variability-analysis-tools.exconfig,代码行数:19,代码来源:exdesc.c
示例10: 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
示例11: main
int main(int ac, char **av)
{
int stat;
char *mode;
struct symbol *sym;
conf_parse(av[1]);
conf_read(NULL);
sym = sym_lookup("VERSION", 0);
sym_calc_value(sym);
snprintf(menu_backtitle, 128, "Core 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();
init_dialog();
signal(SIGWINCH, winch_handler);
conf(&rootmenu);
end_dialog();
/* Restart dialog to act more like when lxdialog was still separate */
init_dialog();
do {
stat = dialog_yesno(NULL,
"Do you wish to save your new Core configuration?", 5, 60);
} while (stat < 0);
end_dialog();
if (stat == 0) {
conf_write(NULL);
printf("\n\n"
"*** End of Core configuration.\n"
"*** Check the top-level Makefile for additional configuration options.\n\n");
} else
printf("\n\nYour Core configuration changes were NOT saved.\n\n");
return 0;
}
开发者ID:ChenBoTang,项目名称:ARM,代码行数:46,代码来源:mconf.c
示例12: main
int main(int ac, char **av)
{
struct symbol *sym;
char *mode;
int stat;
conf_parse(av[1]);
conf_read(NULL);
sym = sym_lookup("VERSION", 0);
sym_calc_value(sym);
snprintf(menu_backtitle, 128, "BusyBox 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();
init_dialog();
signal(SIGWINCH, winch_handler);
conf(&rootmenu);
end_dialog();
/* Restart dialog to act more like when lxdialog was still separate */
init_dialog();
do {
stat = dialog_yesno(NULL,
"Do you wish to save your new diagnostic program configuration?", 6, 60);
} while (stat < 0);
end_dialog();
if (stat == 0) {
conf_write(NULL);
printf("\n\n"
"*** End of SQ diagnostic program configuration.\n");
printf("*** Execute 'make' to build the diagnostic program or try 'make help'.\n\n");
} else
printf("\n\nYour diagnostic program configuration changes were NOT saved.\n\n");
return 0;
}
开发者ID:WTHsieh,项目名称:diag,代码行数:46,代码来源:mconf.c
示例13: conf_create
//解析配置信息,并进行有效性判断
struct conf *
conf_create(char *filename)
{
rstatus_t status;
struct conf *cf;
//打开配置文件,创建conf结构,并初始化
cf = conf_open(filename);
if (cf == NULL) {
return NULL;
}
/* validate configuration file before parsing */
status = conf_pre_validate(cf); //检查配置格式是否符合yml标准
if (status != NC_OK) {
goto error;
}
/* parse the configuration file */
status = conf_parse(cf); //配置解析
if (status != NC_OK) {
goto error;
}
/* validate parsed configuration */
status = conf_post_validate(cf); //重复性判断
if (status != NC_OK) {
goto error;
}
conf_dump(cf);
fclose(cf->fh);
cf->fh = NULL;
return cf;
error:
log_stderr("nutcracker: configuration file '%s' syntax is invalid",
filename);
fclose(cf->fh);
cf->fh = NULL;
conf_destroy(cf);
return NULL;
}
开发者ID:y123456yz,项目名称:Reading-and-comprehense-twemproxy0.4.1,代码行数:46,代码来源:nc_conf.c
示例14: conf_create
rmt_conf *
conf_create(char *filename)
{
int ret;
rmt_conf *cf;
cf = conf_open(filename);
if (cf == NULL) {
return NULL;
}
/* validate configuration file before parsing */
ret = conf_pre_validate(cf);
if (ret != RMT_OK) {
goto error;
}
conf_organizations_dump(cf);
/* parse the configuration file */
ret = conf_parse(cf);
if (ret != RMT_OK) {
goto error;
}
/* validate parsed configuration */
ret = conf_post_validate(cf);
if (ret != RMT_OK) {
goto error;
}
conf_dump(cf);
fclose(cf->fh);
cf->fh = NULL;
return cf;
error:
fclose(cf->fh);
cf->fh = NULL;
conf_destroy(cf);
return NULL;
}
开发者ID:654894017,项目名称:redis-migrate-tool,代码行数:44,代码来源:rmt_conf.c
示例15: main
/* global functions */
int main(int argc, char **argv){
size_t i;
/* check args */
if(argc < 4){
printf("usage: %s <Kconfig> <conf-header path> <config.h name>\n", argv[0]);
return 1;
}
i = strlen(argv[2]);
if(argv[2][i - 1] == '/')
argv[2][i - 1] = 0;
/* read Kconfig file */
conf_parse(argv[1]);
/* read config file */
if(conf_read(NULL)){
fprintf(stderr, "error parsing config\n");
return 1;
}
/* create config headers */
if(conf_write_confheader(argv[2])){
fprintf(stderr, "error creating config headers\n");
return 1;
}
/* create configuration header dependency file */
if(conf_write_autoconfig_dep(argv[2], argv[3])){
fprintf(stderr, "error creating config header dependency file\n");
return 1;
}
/* create configuration header */
if(conf_write_autoconf(argv[3])){
fprintf(stderr, "error writing config header\n");
return 1;
}
return 0;
}
开发者ID:jnow-87,项目名称:backup,代码行数:45,代码来源:confheader.c
示例16: conf_new
config_t * conf_new (char *fname)
{
config_t * conf = (config_t*)xmalloc(sizeof(struct config_s));
if (!conf) {
config_debug(("config_new: No memory\n"));
return NULL;
}
memset(conf, 0, sizeof(struct config_s));
conf->items = xrtp_list_new();
conf->file = fopen(fname, "rw");
conf_parse(conf, conf->file);
return conf;
}
开发者ID:BackupTheBerlios,项目名称:ogmp-svn,代码行数:19,代码来源:config.c
示例17: conf_create
struct conf *
conf_create(char *filename)
{
rstatus_t status;
struct conf *cf;
cf = conf_open(filename);
if (cf == NULL) {
return NULL;
}
/* validate configuration file before parsing */
status = conf_pre_validate(cf);
if (status != NC_OK) {
goto error;
}
/* parse the configuration file */
status = conf_parse(cf);
if (status != NC_OK) {
goto error;
}
/* validate parsed configuration */
status = conf_post_validate(cf);
if (status != NC_OK) {
goto error;
}
conf_dump(cf);
fclose(cf->fh);
cf->fh = NULL;
return cf;
error:
fclose(cf->fh);
cf->fh = NULL;
conf_destroy(cf);
return NULL;
}
开发者ID:adityashanbhag,项目名称:twemproxy,代码行数:42,代码来源:nc_conf.c
示例18: conf_init
/* Before calling this function first time, please
* initialize the `conf_t' structure with zero.
* such as 'conf_t conf = {};' */
int conf_init(conf_t *conf, const char *filename) {
FILE *fp;
char resolved_path[PATH_MAX];
if (!realpath(filename, resolved_path)) {
fprintf(stderr, "%s\n", strerror(errno));
return -1;
}
if (!(fp = fopen(filename, "r"))) {
perror("fopen failed");
return -1;
}
if (conf_parse(conf, resolved_path, fp, 0) != 0) {
fclose(fp);
return -1;
}
fclose(fp);
return 0;
}
开发者ID:flygoast,项目名称:filmond,代码行数:24,代码来源:conf.c
示例19: malloc
static struct dechunkiser_ctx *rtp_open_out(const char *fname, const char *config) {
struct dechunkiser_ctx *res;
res = malloc(sizeof(struct dechunkiser_ctx));
if (res == NULL) {
return NULL;
}
if (conf_parse(res, config) != 0) {
free(res);
return NULL;
}
res->outfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (res->outfd < 0) {
printf_log(res, 0, "Could not open output socket");
free(res);
return NULL;
}
return res;
}
开发者ID:lucabe72,项目名称:GRAPES,代码行数:22,代码来源:output-stream-rtp.c
示例20: ng_init
void
ng_init(void) {
char path[PATH_MAX];
/* Initialize the config subsystem and register our context parsers */
conf_init_subsystem();
conf_register_context("player_group", parse_player_group);
conf_register_context("dest_group", parse_dest_group);
/* Load the config file containing the player groups and the choice groups */
strcpy(path, NONULL(getenv("HOME")));
strcat(path, ":" PKGDATADIR);
conf_parse("notgame.cfg", path);
/* Create the pre-game window */
pregame_init();
for (; gtk_events_pending(); ) {
gtk_main_iteration();
}
}
开发者ID:playya,项目名称:Enlightenment,代码行数:22,代码来源:notgame.c
注:本文中的conf_parse函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论