[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "CHAR_MIN - X" in help/version flags

From: Tim Rice
Subject: Re: "CHAR_MIN - X" in help/version flags
Date: Sat, 6 Aug 2022 02:36:50 +0000

Hey Shawn,

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.

~ Tim

reply via email to

[Prev in Thread] Current Thread [Next in Thread]