Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
getopt: Add support for :: optional arguments
Adds support for getopt extension: option characters followed by two colons. A character followed by a single colon indicates that an argument is to follow the option on the command line. Two colons indicates that the argument is optional (this is transparent extension not covered by POSIX). optsting = "a:bX" In the string above, option a will accept an optional argument. (Option requires an argument) Usage: Option syntax Meaning -a OK, No argument provided (optional). -afoo OK, argument is foo -a foo Wrong, no space allowed with optional arguments. foo is considered a non-option argument. -bfoo OK, argument is foo (required). -b foo OK, argument is foo (required). -b Wrong, option b requires an argument. Since the argument is optional, you will have to check the value of optarg to see if it is a valid pointer (otherwise, it's NULL). JIRA: RTOS-511
- Loading branch information