Libecoli 0.11.1
Extensible COmmand LIne library
Loading...
Searching...
No Matches
Option node

A node that makes its child optional. More...

Functions

struct ec_nodeec_node_option (const char *id, struct ec_node *node)
int ec_node_option_set_child (struct ec_node *gen_node, struct ec_node *child)

Detailed Description

A node that makes its child optional.

Configuration Schema

schema option {
node child {
description "The child node.";
}
}

Function Documentation

◆ ec_node_option()

struct ec_node * ec_node_option ( const char * id,
struct ec_node * node )

Create an option node that makes its child optional.

Parameters
idThe node identifier.
nodeThe child node. It is consumed and will be freed when the parent is freed, or immediately on error.
Returns
The node, or NULL on error (errno is set).
Examples
readline/main.c, and simple-editline/main.c.

◆ ec_node_option_set_child()

int ec_node_option_set_child ( struct ec_node * gen_node,
struct ec_node * child )

Set the child of an option node.

Parameters
gen_nodeThe option node.
childThe child node. It is consumed and will be freed when the parent is freed, or immediately on error.
Returns
0 on success, -1 on error (errno is set).