--- libaitcfg/inc/aitcfg.h 2012/04/02 14:39:02 1.6.4.1 +++ libaitcfg/inc/aitcfg.h 2012/04/02 15:12:15 1.6.4.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitcfg.h,v 1.6.4.1 2012/04/02 14:39:02 misho Exp $ +* $Id: aitcfg.h,v 1.6.4.2 2012/04/02 15:12:15 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -168,7 +168,7 @@ int MergeConfig(sl_config * __restrict cfg, sl_config * @cfg = Config root * @csSec = Config section //[{csSec}] * @csAttr = Config attribute //{csAttr} = ... - * return: 0 not found item; -1 error: null parameters; >0 position in list + * return: 0 not found item, -1 error or >0 position in list */ inline int cfg_findAttribute(cfg_root_t * __restrict cfg, const char *csSec, const char *csAttr); @@ -178,21 +178,23 @@ inline int cfg_findAttribute(cfg_root_t * __restrict c * @cfg = Config root * @csSec = Config section //[{csSec}], if NULL unset in *default* section * @csAttr = Config attribute //{csAttr} = ..., if NULL unset as *any* attribute - * return: NULL item not found or null parameters; !=NULL value const string + * return: NULL item not found or null parameters, !=NULL value const string */ inline const char *cfg_getAttribute(cfg_root_t * __restrict cfg, const char *csSec, const char *csAttr); - -#if 0 /* - * cfg_SetAttribute() Set item in config list or add new item if not exists - * @cfg = Head list element + * cfg_setAttribute() - Set item in config or adding new item if not exists + * + * @cfg = Config root * @csSec = Config section //[{csSec}], if NULL set in *default* section - * @csAttr = Config attribute //{csAttr} = ..., if NULL set as *any* attribute + * @csAttr = Config attribute //{csAttr} = ... * @csVal = Config value //... = {csVal} to setup - * return: 0 nothing changed, -1 error: not enough memory; 1 find and update item; 2 added new item -*/ -int cfg_SetAttribute(sl_config * __restrict cfg, const u_char *csSec, const u_char *csAttr, const u_char *csVal); + * return: 0 nothing changed, -1 error, 1 found and updated item or 2 added new item + */ +int cfg_setAttribute(cfg_root_t * __restrict cfg, const char *csSec, + const char *csAttr, const char *csVal); + +#if 0 /* * cfg_UnsetAttribute() Unset item from config list and free resources * @cfg = Head list element @@ -201,14 +203,6 @@ int cfg_SetAttribute(sl_config * __restrict cfg, const * return: 0 item not found, -1 error: null parameters; >0 position in list */ int cfg_UnsetAttribute(sl_config * __restrict cfg, const u_char *csSec, const u_char *csAttr); -/* - * cfg_GetAttribute() Get item from config list and return his value - * @cfg = Head list element - * @csSec = Config section //[{csSec}], if NULL unset in *default* section - * @csAttr = Config attribute //{csAttr} = ..., if NULL unset as *any* attribute - * return: NULL item not found or null parameters; !=NULL value const string -*/ -inline const u_char *cfg_GetAttribute(sl_config * __restrict cfg, const u_char *csSec, const u_char *csAttr); /* * cfg_LoadAttribute() Extended get attribute, if not found item return *default value*