jim_getopt_nvp_unknown() function
Create an appropriate error message for an NVP. This function will set the "interp->result" to a human readable error message listing the available options. This function assumes the previous option argv[-1] is the unknown string. If this option had some prefix, then pass "hadprefix = 1" else pass "hadprefix = 0" Example: \code while (goi.argc) { // Get the next option e = jim_getopt_nvp(&goi, cmd_options, &n); if (e != JIM_OK) { // option was not recognized // pass 'hadprefix = 0' because there is no prefix jim_getopt_nvp_unknown(&goi, cmd_options, 0); return e; } switch (n->value) { case OPT_SEX: // handle: --sex male | female | lots | needmore e = jim_getopt_nvp(&goi, &nvp_sex, &n); if (e != JIM_OK) { jim_getopt_nvp_unknown(&ogi, nvp_sex, 1); return e; } printf("Code: (%d) is %s\n", n->value, n->name); break; case ...: [snip] } } \endcode
Arguments
lookup
- the NVP table that was used.
hadprefix
- 0 or 1 if the option had a prefix.