-
- if(rc == POPT_ERROR_BADOPT) {
- /* We need to redo the context with information added by modules */
- g_array_append_val(lttv_options_command_popt, endOption);
- poptFreeContext(c);
- c = poptGetContext("lttv", command_argc, (const char**)command_argv,
- (struct poptOption *)lttv_options_command_popt->data,0);
- g_array_remove_index(lttv_options_command_popt,
- lttv_options_command_popt->len);
-
- /* Cut out the already parsed elements */
- if(lastrc != -1)
- while(poptGetNextOpt(c) != lastrc) { } ;
-
- /* Get the same option once again */
- g_assert(rc = poptGetNextOpt(c) != -1) ;
- if(rc == POPT_ERROR_BADOPT) {
- /* If here again we have a parsing error with all context info ok,
- * then there is a problem in the arguments themself, give up */
- g_critical("option %s: %s", poptBadOption(c,0), poptStrerror(rc));
- break ;
+
+ /* The option was recognized and the rc value returned is the argument
+ position in the array. Call the associated hook if present. */
+
+ if(rc > 0) {
+ option = (LttvOption *)(list->pdata[rc - 1]);
+ g_info("Option %s encountered", option->long_name);
+ if(option->hook != NULL) {
+ g_info("Option %s hook called", option->long_name);
+ option->hook(option->hook_data);