How can I make getopt in C ++ really check the parameters?

I am using getopt to analyze the inputs for the CLI written in C ++. I have long and short options, and the struct long_options [] element looks like this:

{"verbose", no_argument, NULL, "v"}

One observation is on the command line, even if I go through

# mycommand --verb

he still takes this and directs a function that handles the detailed behavior. Is there a way to make getopt do a strict option check? It should not accept --verb as -verbose right?

+4
source share
1 answer

[1] [2] [3], .

( ) , .

+2

Source: https://habr.com/ru/post/1613470/


All Articles