Sometimes we have a parser which would never use the argument.
const Option **ret_option,
const char **ret_arg) {
- assert(ret_arg);
-
/* Check and initialize */
if (state->optind == 0) {
if (state->argc < 1 || strv_isempty(state->argv))
if (ret_option)
/* Return the matched Option structure to allow the caller to "know" what was matched */
*ret_option = option;
- *ret_arg = optval;
+
+ if (ret_arg)
+ *ret_arg = optval;
+ else
+ /* It's fine to omit ret_arg, but only if no options return a value. */
+ assert(!optval);
+
return option->id;
}