43 dictionary *d = ini_get(h);
45 if (d && sec && key) {
48 ini_make_full_key(full,
sizeof(full), sec, key);
49 memcpy(alt, full,
sizeof(alt));
50 for (
size_t i = 0; i <
sizeof(alt) && alt[i]; ++i) {
56 const char *
s = iniparser_getstring(d, full, NULL);
57 if (!
s)
s = iniparser_getstring(d, alt, NULL);
62 if (
n >= 2 && ((
s[0] ==
'"' &&
s[
n - 1] ==
'"') || (
s[0] ==
'\'' &&
s[
n - 1] ==
'\''))) {
63 size_t copy = (
n - 2) <
sizeof(
buf) - 1 ? (
n - 2) : sizeof(
buf) - 1;
64 memcpy(
buf,
s + 1, copy);
69 while (*
s && (
unsigned char)*
s <=
' ')
74 for (;
s[li] && li <
sizeof(lb) - 1; ++li)
75 lb[li] = (
char)tolower((
unsigned char)
s[li]);
77 if (strcmp(lb,
"true") == 0 || strcmp(lb,
"yes") == 0 || strcmp(lb,
"on") == 0) {
79 }
else if (strcmp(lb,
"false") == 0 || strcmp(lb,
"no") == 0 || strcmp(lb,
"off") == 0) {
84 long v = strtol(lb, &endp, 10);
85 outb = (endp && endp != lb) ? (
v != 0) : def;
95 push_value(vm,
make_int(outb ? 1 : 0));
Tagged union representing a Fun value.
void free_value(Value v)
Free dynamic storage owned by a Value.
Value make_int(int64_t v)
Construct a Value representing a 64-bit integer.