On Fri, Jan 08, 2021 at 05:29:31PM -0600, Edgar Pettijohn wrote:
> In the BUGS section for the getopt(3) manual it mentions not using
> single digits for options. I know spamd uses -4 and -6 there are
> probably others. Should they be changed? Or is the manual mistaken?
> 

That section seems ambiguous (especially in light of your post) on whether
using digits is wrong, or abusing digit support for multi-digit number
option support is wrong. But I think the intention is the latter.

FWIW, POSIX explicitly permits digits:

  Guideline 3:
    Each option name should be a single alphanumeric character (the alnum
    character classification) from the portable character set. The -W
    (capital-W) option shall be reserved for vendor options.

    Multi-digit options should not be allowed.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02

Guideline 3 applies to getopt(3) because,

  The getopt() function... shall follow Utility Syntax Guidelines 3, 4, 5,
  6, 7, 9, and 10 in XBD Utility Syntax Guidelines.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html

Reply via email to