mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
getopt_commont(): Add some comments
Add a trivial comment about handling in certain corner cases where I am not certain what the correct behavior should be.
This commit is contained in:
@@ -387,7 +387,7 @@ int getopt_common(int argc, FAR char * const argv[],
|
|||||||
ret = getopt_long_option(go, argv, longopts, longindex);
|
ret = getopt_long_option(go, argv, longopts, longindex);
|
||||||
if (ret == '?')
|
if (ret == '?')
|
||||||
{
|
{
|
||||||
/* Skip over the unrecognized long option */
|
/* Skip over the unrecognized long option. */
|
||||||
|
|
||||||
go->go_optind++;
|
go->go_optind++;
|
||||||
go->go_optptr = NULL;
|
go->go_optptr = NULL;
|
||||||
@@ -412,13 +412,23 @@ int getopt_common(int argc, FAR char * const argv[],
|
|||||||
ret = getopt_long_option(go, argv, longopts, longindex);
|
ret = getopt_long_option(go, argv, longopts, longindex);
|
||||||
if (ret != '?')
|
if (ret != '?')
|
||||||
{
|
{
|
||||||
/* Success or ERROR */
|
/* Return success or ERROR */
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check for single character option.
|
||||||
|
*
|
||||||
|
* REVISIT: There is no way to distinguish a sequence of
|
||||||
|
* short arguments like -abc (meaning -a -b -c) from a single
|
||||||
|
* long argument (like "abc"). I am not sure of the correct
|
||||||
|
* behavior in this case. While supported for getopt(), I do
|
||||||
|
* not think that the first interpretation is standard.
|
||||||
|
*/
|
||||||
|
|
||||||
else if (*(go->go_optptr + 1) != '\0')
|
else if (*(go->go_optptr + 1) != '\0')
|
||||||
{
|
{
|
||||||
/* Skip over the unrecognized long option */
|
/* Skip over the unrecognized long option. */
|
||||||
|
|
||||||
go->go_optind++;
|
go->go_optind++;
|
||||||
go->go_optptr = NULL;
|
go->go_optptr = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user