diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-15 00:48:41 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-15 01:03:36 -0400 |
commit | 93cec92226a3dc9e2cb7785caa4a304615ec3f93 (patch) | |
tree | c98d6ba27812be4a86d7bfb4e30a160cc71561f5 | |
parent | c0953ac69fb01f49bc55771bbd0a5054e6267261 (diff) | |
download | ohmycal-93cec92226a3dc9e2cb7785caa4a304615ec3f93.tar.gz |
Add ini_has_key_required() helper function
-rw-r--r-- | src/deliverable.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/deliverable.c b/src/deliverable.c index 1a64b42..f97c3d5 100644 --- a/src/deliverable.c +++ b/src/deliverable.c @@ -5,6 +5,14 @@ extern struct OMC_GLOBAL globals; +static void ini_has_key_required(struct INIFILE *ini, const char *section_name, char *key) { + int status = ini_has_key(ini, section_name, key); + if (!status) { + SYSERROR("%s:%s key is required but not defined", section_name, key); + exit(1); + } +} + static void ini_getval_required(struct INIFILE *ini, char *section_name, char *key, unsigned type, union INIVal *val) { int status = ini_getval(ini, section_name, key, type, val); if (status || isempty(val->as_char_p)) { |