version 1.19, 2021/11/26 01:15:03
|
version 1.21, 2025/10/09 16:43:05
|
Line 12 terms:
|
Line 12 terms:
|
All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
|
|
Copyright 2004 - 2021 | Copyright 2004 - 2024 |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
|
|
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
Line 119 void
|
Line 119 void
|
cfg_dumpCfg(cfg_root_t * __restrict cfg) |
cfg_dumpCfg(cfg_root_t * __restrict cfg) |
{ |
{ |
struct tagCfg *r, *c, *ctmp, *q, *qtmp; |
struct tagCfg *r, *c, *ctmp, *q, *qtmp; |
int syn; | int syn = 0; |
|
|
r = RB_ROOT(cfg); |
r = RB_ROOT(cfg); |
printf("ROOT:: KEY=%.8x [%s] %s=%s\n", ((AIT_KEY(&r->cfg_sec) << 15) | AIT_KEY(&r->cfg_attr)), |
printf("ROOT:: KEY=%.8x [%s] %s=%s\n", ((AIT_KEY(&r->cfg_sec) << 15) | AIT_KEY(&r->cfg_attr)), |
Line 187 cfg_getSection(cfg_root_t * __restrict cfg, const char
|
Line 187 cfg_getSection(cfg_root_t * __restrict cfg, const char
|
array_Destroy(&arr); |
array_Destroy(&arr); |
|
|
return arr; |
return arr; |
|
} |
|
|
|
/* |
|
* cfg_delSection() - Delete entire section |
|
* |
|
* @cfg = Config root |
|
* @csSec = Config section //[{csSec}] |
|
* return: -1 error, 0 nothing deleted or >0 deleted attributes |
|
*/ |
|
int |
|
cfg_delSection(cfg_root_t * __restrict cfg, const char *csSec) |
|
{ |
|
int ret = 0; |
|
array_t *arr = NULL; |
|
struct tagCfg *av; |
|
register int i; |
|
|
|
if (!cfg) { |
|
cfg_SetErr(EINVAL, "Invalid argument(s)"); |
|
return -1; |
|
} |
|
if (csSec && !*csSec) |
|
csSec = NULL; |
|
|
|
arr = cfg_getSection(cfg, csSec); |
|
if (!arr) |
|
return ret; |
|
for (i = 0; i < array_Size(arr); i++) |
|
if ((av = array(arr, i, struct tagCfg*)) && AIT_ADDR(&av->cfg_attr)) |
|
if (cfg_unsetAttribute(cfg, csSec, AIT_GET_STR(&av->cfg_attr)) > 0) |
|
ret++; |
|
array_Destroy(&arr); |
|
return ret; |
} |
} |
|
|
/* |
/* |