/** Parse a configuration file. * @param file path to the config file * @return 0 on success, non-zero on error */ int parseconfig(const char *file) { int ret; struct section_t section; memset(§ion, 0, sizeof(struct section_t)); pm_printf(ALPM_LOG_DEBUG, "config: attempting to read file %s\n", file); if((ret = parse_ini(file, _parse_directive, §ion))) { return ret; } pm_printf(ALPM_LOG_DEBUG, "config: finished parsing %s\n", file); if((ret = setup_libalpm())) { return ret; } alpm_list_free_inner(config->repos, (alpm_list_fn_free) config_repo_free); alpm_list_free(config->repos); config->repos = NULL; return ret; }
/** Parse a configuration file. * @param file path to the config file * @return 0 on success, non-zero on error */ int parseconfig(const char *file) { int ret; struct section_t section; memset(§ion, 0, sizeof(struct section_t)); section.siglevel = ALPM_SIG_USE_DEFAULT; /* the config parse is a two-pass affair. We first parse the entire thing for * the [options] section so we can get all default and path options set. * Next, we go back and parse everything but [options]. */ /* call the real parseconfig function with a null section & db argument */ pm_printf(ALPM_LOG_DEBUG, "parseconfig: options pass\n"); if((ret = _parseconfig(file, §ion, 1, 0))) { return ret; } if((ret = setup_libalpm())) { return ret; } /* second pass, repo section parsing */ pm_printf(ALPM_LOG_DEBUG, "parseconfig: repo pass\n"); return _parseconfig(file, §ion, 0, 0); }