From 0db784a48f28a240e2a768d2773ba7cd4833a92d Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Mon, 15 Apr 2024 00:32:05 -0400 Subject: Add ini_setval() function --- include/ini.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/ini.h') diff --git a/include/ini.h b/include/ini.h index af81895..a444665 100644 --- a/include/ini.h +++ b/include/ini.h @@ -7,6 +7,8 @@ #define INI_WRITE_RAW 0 ///< Dump INI data. Contents are not modified. #define INI_WRITE_PRESERVE 1 ///< Dump INI data. Template strings are +#define INI_SETVAL_APPEND 0 +#define INI_SETVAL_REPLACE 1 ///< expanded to preserve runtime state. #define INIVAL_TYPE_INT 1 ///< Integer @@ -87,6 +89,17 @@ struct INIFILE { */ struct INIFILE *ini_open(const char *filename); +/** + * Assign value to a section key + * @param ini + * @param type INI_SETVAL_APPEND or INI_SETVAL_REPLACE + * @param section_name + * @param key + * @param value + * @return + */ +int ini_setval(struct INIFILE **ini, unsigned type, char *section_name, char *key, char *value); + /** * Retrieve all data records in an INI section * -- cgit