Ticket #1256 (new defect)
Minor error in getopt() processing
|Reported by:||shane||Owned by:|
|Sub-Project:||DNS||Feature Depending on Ticket:|
|Estimated Difficulty:||0||Add Hours to Ticket:||0|
According to the getopt() man page:
If getopt() finds an option character in argv that was not included in optstring, or if it detects a missing option argument, it returns '?' and sets the external variable optopt to the actual option character. If the first character (following any optional '+' or '-' described above) of optstring is a colon (':'), then getopt() returns ':' instead of '?' to indicate a missing option argument. If an error was detected, and the first character of optstring is not a colon, and the external variable opterr is nonzero (which is the default), getopt() prints an error message.
We use the leading colon sometimes, I think in an effort to avoid the pre-defined error messages, which are ugly and not helpful. However, we then check for '?' in our while() loop, which is an error.
It doesn't actually show up, since we then follow with the default: statement, however a restructuring of the code could break this. It's a one-line fix.
- Milestone changed from Next-Sprint-Proposed to Year 3 Task Backlog