bool config_get_uint(config_file_t *conf, const char *key, unsigned *in) { const struct config_entry_list *entry = config_get_entry(conf, key, NULL); errno = 0; if (entry) { unsigned val = strtoul(entry->value, NULL, 0); if (errno == 0) *in = val; } return entry != NULL && errno == 0; }
bool config_get_char(config_file_t *conf, const char *key, char *in) { const struct config_entry_list *entry = config_get_entry(conf, key, NULL); if (entry) { if (entry->value[0] && entry->value[1]) return false; *in = *entry->value; return true; } return false; }
bool config_get_path(config_file_t *conf, const char *key, char *buf, size_t size) { #if 0 #if defined(RARCH_CONSOLE) return config_get_array(conf, key, buf, size); #else const struct config_entry_list *entry = config_get_entry(conf, key, NULL); if (entry) fill_pathname_expand_special(buf, entry->value, size); return entry != NULL; #endif #endif }
bool config_get_path(config_file_t *conf, const char *key, char *buf, size_t size) { #if defined(RARCH_CONSOLE) || !defined(RARCH_INTERNAL) if (config_get_array(conf, key, buf, size)) return true; #else const struct config_entry_list *entry = config_get_entry(conf, key, NULL); if (entry) { fill_pathname_expand_special(buf, entry->value, size); return true; } #endif return false; }
bool config_get_uint64(config_file_t *conf, const char *key, uint64_t *in) { const struct config_entry_list *entry = config_get_entry(conf, key, NULL); errno = 0; if (entry) { uint64_t val = strtoull(entry->value, NULL, 0); if (errno == 0) { *in = val; return true; } } return false; }
bool config_get_size_t(config_file_t *conf, const char *key, size_t *in) { const struct config_entry_list *entry = config_get_entry(conf, key, NULL); errno = 0; if (entry) { size_t val = 0; if (sscanf(entry->value, "%" PRI_SIZET, &val) == 1) { *in = val; return true; } } return false; }
bool config_get_hex(config_file_t *conf, const char *key, unsigned *in) { const struct config_entry_list *entry = config_get_entry(conf, key, NULL); errno = 0; if (entry) { unsigned val = (unsigned)strtoul(entry->value, NULL, 16); if (errno == 0) { *in = val; return true; } } return false; }
bool config_get_int(config_file_t *conf, const char *key, int *in) { const struct config_entry_list *entry = config_get_entry(conf, key, NULL); errno = 0; if (entry) { int val = (int)strtol(entry->value, NULL, 0); if (errno == 0) { *in = val; return true; } } return false; }
bool config_get_bool(config_file_t *conf, const char *key, bool *in) { const struct config_entry_list *entry = config_get_entry(conf, key, NULL); if (entry) { if (string_is_equal(entry->value, "true")) *in = true; else if (string_is_equal(entry->value, "1")) *in = true; else if (string_is_equal(entry->value, "false")) *in = false; else if (string_is_equal(entry->value, "0")) *in = false; else return false; } return entry != NULL; }