cfg_add_item()

Add a new node to a configuration tree.

Synopsis:

#include <asr/cfg.h>
 
cfg_item_t* cfg_add_item(cfg_item_t *current, const char *cname, const char *cvalue)

Arguments:

current

A pointer to the node to add the new configuration item to. If NULL, the new configuration item becomes the root of a new configuration tree.

cname

The name for the new node. If NULL, the name "anon" is assigned.

cvalue

The value for the new node. If NULL, an empty string is assigned.

Library:

libasr

Description:

The cfg_add_item() function creates a new configuration item with the specified name (cname) and optional value (cvalue) and adds it as a child of the specified node (current), behind its sibling nodes. Spaces and quotes are removed from the name and value; any variable references are resolved before the new item is created.

Returns:

A pointer to the new node.