Hi John! On 24 January 2017 at 18:10, John Wiersba <jrw32982@xxxxxxxxx> wrote: > Hi, Michael! > > These two paragraphs in getopt(3) are confusing to me. Isn't the first > paragraph redundant (and incomplete), based on the second paragraph? > > If getopt() does not recognize an option character, it prints an > error message to stderr, stores the character in optopt, and returns > '?'. The calling program may prevent the error message by setting > opterr to 0. > > 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. > > My understanding is that starting optstring with ":" is sufficient to > prevent an option error being printed by getopt(). > > If my comments are correct, then I can submit a bug report. Yes, you're correct on all counts. I simply removed the first paragraph. I'll give some thought to further clarifications. Thanks for the report. Cheers, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html