[Top][All Lists]

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

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

From: Erik Auerswald
Subject: Re: "CHAR_MIN - X" in help/version flags
Date: Sat, 6 Aug 2022 11:45:08 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0


On 06.08.22 08:13, Shawn Wagner wrote:
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

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

I personally like -h as short alias for --help and -V as short alias
for --version.


reply via email to

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