On Fri, Aug 5, 2022 at 7:36 PM Tim Rice <trice@posteo.net> wrote:
They're not listed in the short options passed to getopt_long(), hence the
error. But ~ isn't actually what CHAR_MIN - 2 is; it's just what you get
when you convert an int outside of the range of chars to a char. Those
values are ints that can't be represented in a char type, meaning they
can't go in the short options so they're ideal for a long-only option to
avoid any chance of future conflicts - only so many single character
options available to use. If you want to make -h a synonym for --help,
you'd have to add it to the short options and change the --help entry in
the long options to return 'h', and adjust the argument-handling switch
too.
I had a hunch it must be something like that, but was afraid it was a
misunderstanding. Thanks for the clear explanation! It sounds like we
should be okay to go ahead with implementing an awk-like -h/-V.
Unless someone has a better idea in mind for those options, yeah, it's
okay.