cormr_axis_cli(3)corm

NAME

cormr_axis_cli - Axis CLI contract (D14/D15B)

SYNOPSIS

Data Structures

struct cormr_axis_cli_option

Functions

int cormr_spec_scan (const char **cur, const char **key, size_t *klen, const char **val, size_t *vlen, int *quoted)
int cormr_cli_str_set (char **dst, const char *value)
int cormr_cli_int (const char *v, int *out)
int cormr_cli_int_b (const char *v, const char *v_end, int *out)
int cormr_cli_str_dup (const char *v, size_t n, int quoted, char **out)

Detailed Description

The kernel owns the axis-CLI ABI and the decode-spec grammar exactly once (implementation: libcorm src/rec_cli.c). An axis implements only its option table (cormr_axis_cli_options / rec_axis_cli_options) and its per-field mapping in cormr_axis_config_arg / decode. Layouts are visible to every TU via this header โ€” never re-declared locally.

Function Documentation

int cormr_cli_int (const char * v, int * out)

Strict decimal parsers for cormr_axis_config_arg numeric fields: errno-cleared strto*, reject empty/trailing-junk/overflow, and a leading '-' for the unsigned ones.

int cormr_cli_int_b (const char * v, const char * v_end, int * out)

Bounded variants for the read-only value ranges cormr_spec_scan hands out: parse [v, v_end), where the byte at v_end is the range's boundary (space / tab / '=' / quote / NUL) and so can never be part of a numeric token. Identical strictness to the NUL-terminated parsers, which are these on v..v+strlen(v).

int cormr_cli_str_dup (const char * v, size_t n, int quoted, char ** out)

Duplicate the value range [v, v+n) into a fresh NUL-terminated string; when quoted, unescape IN PLACE ('\'โ†’'\', '\''โ†’'\'' like the scan grammar; a trailing lone '\' stays literal). 0 ok / -1 on NULL or allocation failure. The one allocation a string-field decode needs (query/field/file).

int cormr_cli_str_set (char ** dst, const char * value)

Owned string setter for cormr_axis_config_arg string fields: strdup then free-replace into *dst. 0 ok / -1 on NULL dst/value or allocation.

int cormr_spec_scan (const char ** cur, const char ** key, size_t * klen, const char ** val, size_t * vlen, int * quoted)

Read-only pass over a decode spec (the kernel-owned decode grammar, ZERO allocation โ€” it never writes the buffer): Keys AND values are returned as length-delimited ranges into the CALLER'S string: a bare value runs from val to the next space / tab / '=' / NUL; a single-quoted value is returned as *val past the opening quote with the RAW interior bytes spanning *val .. *val + *vlen and *quoted set (backslash escapes stay encoded โ€” use cormr_cli_str_dup to unescape into an owned copy). Tokens without '=' are skipped; every 1-return yields one key=value pair (key may be empty, e.g. "=x"). Pair with the cormr_cli__b range parsers so a decode never needs to copy the spec: for (const char *cur = spec; cormr_spec_scan(&cur, &k, &klen, &v, &n, &q); ) if (cormr_key_eq(k, klen, "dim")) if (!cormr_cli_int_b(v, v + n, &i)) โ€ฆ Returns 1 while a pair was produced, 0 at the end.

Author

Generated automatically by Doxygen for corm from the source code.