NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/59443: getopt/getopt_long prints errors when +/- is present before :
The following reply was made to PR lib/59443; it has been noted by GNATS.
From: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: lib/59443: getopt/getopt_long prints errors when +/- is present before :
Date: Tue, 27 May 2025 05:20:40 -0000 (UTC)
contact+netbsd.org%hacktivis.me@localhost ("Haelwenn (lanodan) Monnier") writes:
$ OPTSTR=":" ./getopt_long_test -f
$ OPTSTR="+:" ./getopt_long_test -f
getopt_long_test: unknown option -- f
$ OPTSTR="-:" ./getopt_long_test -f
getopt_long_test: unknown option -- f
The PRINT_ERROR logic looks wrong.
A leading ':' should suppress the message, but:
#define PRINT_ERROR ((opterr) && ((*options != ':') \
|| (IGNORE_FIRST && options[1] != ':')))
Maybe:
#define PRINT_ERROR ((opterr) && !((*options == ':') \
|| (IGNORE_FIRST && options[1] == ':')))
Home |
Main Index |
Thread Index |
Old Index