Closed tansy closed 2 years ago
Thanks for pointing it out, I forgot the exit()
call in getopt_impl
when operr=1.
Essentially, the only reason why I am using this and not the GNU getopt
or literally any other implementation is the problem with positional arguments. How I use getopt
and my custom implementation makes it possible to invoke bzip3 as e.g. bzip3 input.txt output.bz3 -feb 16
getopt_impl() loops forever when encounters unknown option
I tried to debug it but couldn't follow the logic of it. Things are not easier by the fact that it uses global variables. And there are variables of the same name (`opt') which seems to confuse gdb. There are other things I don't get, like
if (operr && *optstring != ':')
@main.c:59, where `*optstring' is first character of `optstring' which is unlikely to be ':'.I bet you understand it.