# nng_opts_parse ## NAME nng_opts_parse --- parse command line options ## SYNOPSIS ```c #include #include typedef struct nng_optspec { const char *o_name; // Long style name (may be NULL for short only) int o_short; // Short option (no clustering!) int o_val; // Value stored on a good parse (>0) bool o_arg; // Option takes an argument if true } nng_optspec; int nng_opts_parse(int argc, char *const *argv, const nng_optspec *spec, int *val, char **arg, int *idx); ``` ## DESCRIPTION The {{i:`nng_opts_parse`}} function is a intended to facilitate parsing {{i:command-line arguments}}. This function exists largely to stand in for {{i:`getopt`}} from POSIX systems, but it is available everywhere that _NNG_ is, and it includes some capabilities missing from `getopt`. The function parses arguments from `main` (using _argc_ and _argv_), starting at the index referenced by _idx_. (New invocations typically set the value pointed to by _idx_ to 1.) Options are parsed as specified by _spec_ (see <