--- cfg_node.c 2002/07/12 19:59:33 1.8
+++ cfg_node.c 2002/07/13 18:52:41 1.9
@@ -354,7 +354,21 @@
void *cb_ctx_cmp,
cfg_node_t **cont)
{
- /* FIXME */
+#if 0
+ cfg_rc_t rc;
+
+ if (cfg == NULL)
+ return CFG_ERR_ARG;
+ if (node != NULL) {
+ cb_fct(cb_ctx, node);
+ if (node->child1 != NULL)
+ if ((rc = cfg_node_apply(node->child1, cb_fct, cb_ctx)) != CFG_OK)
+ return rc;
+ if (node->rbroth != NULL)
+ if ((rc = cfg_node_apply(node->rbroth, cb_fct, cb_ctx)) != CFG_OK)
+ return rc;
+ }
+#endif
return CFG_OK;
}
@@ -367,22 +381,20 @@
cfg_rc_t (*cb_fct_cb)(cfg_t *, cfg_node_t *, void *),
void *cb_ctx_cb)
{
- /* FIXME */
-#if 0
cfg_rc_t rc;
- if (cb_fct == NULL)
+ if (cfg == NULL || node == NULL || cb_fct_cb == NULL)
return CFG_ERR_ARG;
- if (node != NULL) {
- cb_fct(cb_ctx, node);
- if (node->child1 != NULL)
- if ((rc = cfg_node_apply(node->child1, cb_fct, cb_ctx)) != CFG_OK)
- return rc;
- if (node->rbroth != NULL)
- if ((rc = cfg_node_apply(node->rbroth, cb_fct, cb_ctx)) != CFG_OK)
- return rc;
- }
-#endif
+ node = NULL;
+ if (node == NULL)
+ if ((node = cfg->root) == NULL)
+ return CFG_OK;
+ do {
+ if ((rc = cb_fct_cb(cfg, node, cb_ctx_cb)) != CFG_OK)
+ return rc;
+ } while ((rc = cfg_node_find(cfg, node, cb_fct_cmp, cb_ctx_cmp, &node)) == CFG_OK);
+ if (rc != CFG_OK && rc != CFG_ERR_NDE)
+ return rc;
return CFG_OK;
}
@@ -392,8 +404,15 @@
cfg_node_t *node,
void *token)
{
- /* FIXME */
- return CFG_OK;
+ if (cfg == NULL || node == NULL || token == NULL)
+ return CFG_ERR_NDE;
+ if (node->token == NULL && token == NULL)
+ return CFG_OK;
+ if (node->token == NULL || token == NULL)
+ return CFG_ERR_NDE;
+ if (strcmp(node->token, (char *)token) == 0)
+ return CFG_OK;
+ return CFG_ERR_NDE;
}
cfg_rc_t cfg_node_link(cfg_t *cfg, cfg_node_t *node, cfg_node_attr_t attr, cfg_node_t *node2)
|