Skip to content
Snippets Groups Projects
Commit 473dbde8 authored by rswindell's avatar rswindell
Browse files

Created new ini string list functions: iniKeyExists(), iniValueExists(), and

iniRemoveKey().
parent 733387be
No related branches found
No related tags found
No related merge requests found
......@@ -220,6 +220,41 @@ static size_t find_value_index(str_list_t list, const char* section, const char*
return(i);
}
BOOL iniKeyExists(str_list_t* list, const char* section, const char* key)
{
char val[INI_MAX_VALUE_LEN];
size_t i;
i=find_value_index(*list, section, key, val);
if((*list)[i]==NULL || *(*list)[i]==INI_OPEN_SECTION_CHAR)
return(FALSE);
return(TRUE);
}
BOOL iniValueExists(str_list_t* list, const char* section, const char* key)
{
char val[INI_MAX_VALUE_LEN];
find_value_index(*list, section, key, val);
return(val[0]!=0);
}
BOOL iniRemoveKey(str_list_t* list, const char* section, const char* key)
{
char val[INI_MAX_VALUE_LEN];
size_t i;
i=find_value_index(*list, section, key, val);
if((*list)[i]==NULL || *(*list)[i]==INI_OPEN_SECTION_CHAR)
return(FALSE);
return(strListDelete(list,i));
}
size_t iniAddSection(str_list_t* list, const char* section
,ini_style_t* style)
{
......
......@@ -121,6 +121,10 @@ char* iniSetBitField(str_list_t*, const char* section, const char* key, ini_bit
char* iniSetStringList(str_list_t*, const char* section, const char* key
,const char* sep, str_list_t value, ini_style_t*);
BOOL iniKeyExists(str_list_t*, const char* section, const char* key);
BOOL iniValueExists(str_list_t*, const char* section, const char* key);
BOOL iniRemoveKey(str_list_t*, const char* section, const char* key);
#if defined(__cplusplus)
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment