Loading...
Searching...
No Matches
Option node
Grammar nodes

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

Collaboration diagram for Option node:

## Functions

struct ec_node * | ec_node_option (const char *id, struct ec_node *node)
| Create an option node that makes its child optional.
int | ec_node_option_set_child (struct ec_node *gen_node, struct ec_node *child)
| Set the child of an option node.

## 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

  id | The node identifier.
  node | The 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_node | The option node.
  child | The 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).