MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_cli.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mrtk_optmap_t
 Long-option to short-option alias entry. More...

Functions

void mrtk_normalize_args (int argc, char **argv, const mrtk_optmap_t *map)
 Translate --long flags to their -short aliases in argv (in place).
int mrtk_is_help_flag (const char *arg)
 Returns 1 if arg is a generic help flag (-h or --help), else 0.

Function Documentation

◆ mrtk_is_help_flag()

int mrtk_is_help_flag ( const char * arg)

Returns 1 if arg is a generic help flag (-h or --help), else 0.

Subcommands that have repurposed -h (e.g. post uses it for fix-and-hold AR) must NOT use this helper and should match --help (and any historical short flag like -?) manually.

Parameters
[in]argargument string (must not be NULL)

Definition at line 30 of file mrtk_cli.c.

◆ mrtk_normalize_args()

void mrtk_normalize_args ( int argc,
char ** argv,
const mrtk_optmap_t * map )

Translate --long flags to their -short aliases in argv (in place).

Walks argv[1..argc-1] and, for each entry that exactly matches a map[i].long_opt, swaps the pointer to point at map[i].short_opt instead. Only the argv pointers are reassigned; the underlying argument strings are never mutated. argv[0] is left untouched. Pass NULL or an empty map to no-op.

Parameters
[in]argcargument count
[in,out]argvargument vector (pointers may be reassigned)
[in]mapNULL-terminated alias table (terminator: {NULL, NULL})

Definition at line 12 of file mrtk_cli.c.

References mrtk_optmap_t::long_opt.