Re: [PATCH] options: Fix getopts handling of colon in optstr

Herbert Xu <[email protected]>
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
On Mon, Feb 06, 2023 at 08:38:47PM +0530, Subhaditya Nath wrote:
> Putting a colon at the beginning of optstring to silence errors doesn't
> mean that the colon is a valid option. Before this patch, dash treated
> -: as a valid option if the optstring started with a colon. This patch
> fixes that problem.
> 
> Test:
> 
>     getopts :a opt -:
>     echo $opt$OPTARG
> 
> Correct output - ?:
> Invalid output - :
> ---
>  src/options.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.