diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-08-07 11:03:10 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-08-07 11:03:10 -0400 |
commit | 09906cbbad8a1fe1ad442110dbeabff63540d656 (patch) | |
tree | 4886a76684148027e2233464c2039451d432c10f | |
parent | 190b1fcddf3db8257722dbb7fd0f7e5c74fc7597 (diff) | |
download | stasis-09906cbbad8a1fe1ad442110dbeabff63540d656.tar.gz |
ini_getval: expand template variables immediately before processing the output
* Strip leading space to avoid issues with string comparisons against the result
-rw-r--r-- | src/ini.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -122,6 +122,14 @@ int ini_getval(struct INIFILE *ini, char *section_name, char *key, int type, uni result->as_char_p = NULL; return -1; } + + char *render = tpl_render(data->value); + if (render) { + guard_free(data->value); + data->value = render; + } + lstrip(data->value); + switch (type) { case INIVAL_TYPE_CHAR: result->as_char = (char) strtol(data->value, NULL, 10); |