Anonymous user
Read a configuration file: Difference between revisions
→C
(→C: Added example) |
(→C) |
||
Line 614:
#include <confini.h>
#define
#define FALSE 0
#define TRUE 1
#define
#define INI_ARRAY_DELIMITER ','
Line 626:
char *fullname;
char *favouritefruit;
char **otherfamily;
size_t otherfamily_len;
Line 671:
}
if (
▲ if (ini_string_match_ss("FULLNAME", this->data, this->format)) {
this->v_len = ini_string_parse(this->value, this->format); /* Remove all quotes, if any */
Line 680 ⟶ 677:
confs->_configs_left_--;
} else if (
this->v_len = ini_string_parse(this->value, this->format); /* Remove all quotes, if any */
Line 686 ⟶ 683:
confs->_configs_left_--;
} else if (
confs->needspeeling = ini_get_bool(this->value, TRUE);
confs->_configs_left_--;
} else if (
confs->seedsremoved = ini_get_bool(this->value, TRUE);
confs->_configs_left_--;
} else if (
this->v_len = ini_array_collapse(this->value, INI_ARRAY_DELIMITER, this->format); /* Save memory (not strictly needed) */
Line 717 ⟶ 714:
.hash_marker = INI_IGNORE,
.multiline_nodes = INI_NO_MULTILINE,
.case_sensitive =
.no_spaces_in_names = TRUE,
.no_single_quotes = FALSE,
Line 728 ⟶ 725:
};
*confs = (struct configs) { NULL, NULL,
if (load_ini_path("rosetta.conf", config_format, NULL, configs_member_handler, confs) & CONFINI_ERROR) {
Line 747 ⟶ 744:
ini_global_set_implicit_value("YES", 0);
populate_configs(&confs);
confs.needspeeling &= 0x7F;
confs.seedsremoved &= 0x7F;
/* Print the configurations parsed */
|