I agree with rtmistler, I guess I don't understand what you mean by "the inverse of getopt()."
Rather than re-inventing a pretty good wheel, maybe you should adapt your arg format and handlers to work within getopt or getopt_long (my favorite).
What you seem to be asking is for a way to pass multiple values to a single option. The obvious easy way to do that would be to aggregate those values into a single string value that could be recovered by getopt(_long), then have your code break out and handle those sub-values.
For example, instead of multiple, space separated values for option -a...
Code:
Foo -a 10 bar1 bar2 bar3 -a 20 bar4
... require a quoted or contiguous comma separated list for each option value...
Code:
Foo -a 10,bar1,bar2,bar3 -a 20,bar4
... then in your case statement for -a iterate over the list found in optarg... done.
This would allow for variable length of the value lists per option as well.