jim_getopt_setup() function
GetOpt - how to. Example (short and incomplete): \code struct jim_getopt_info goi; jim_getopt_setup(&goi, interp, argc, argv); while (goi.argc) { e = jim_getopt_nvp(&goi, nvp_options, &n); if (e != JIM_OK) { jim_getopt_nvp_unknown(&goi, nvp_options, 0); return e; } switch (n->value) { case ALIVE: printf("Option ALIVE specified\n"); break; case FIRST: if (goi.argc < 1) { .. not enough args error .. } jim_getopt_string(&goi, &cp, NULL); printf("FIRSTNAME: %s\n", cp); case AGE: jim_getopt_wide(&goi, &w); printf("AGE: %d\n", (int)(w)); break; case POLITICS: e = jim_getopt_nvp(&goi, nvp_politics, &n); if (e != JIM_OK) { jim_getopt_nvp_unknown(&goi, nvp_politics, 1); return e; } } } \endcode Setup GETOPT \code struct jim_getopt_info goi; Jim_GetOptSetup(&goi, interp, argc, argv); \endcode
Arguments
goi
- get opt info to be initialized
argv
- argv (will be copied)