[PATCH 10/23] getopt.3: Further clarification of optstring
From: Alejandro Colomar <hidden>
Date: 2021-08-08 08:41:57
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: "James O. D. Hunt" <redacted> Explain that `optstring` cannot contain a semi-colon (`;`) character. Also explain that `optstring` can include `+` as an option character, possibly in addition to that character being used as the first character in `optstring` to denote `POSIXLY_CORRECT` behaviour. Signed-off-by: James O. D. Hunt <redacted> Signed-off-by: Alejandro Colomar <redacted> --- man3/getopt.3 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/man3/getopt.3 b/man3/getopt.3
index ce4c28088..315224c64 100644
--- a/man3/getopt.3
+++ b/man3/getopt.3@@ -130,7 +130,7 @@ A legitimate option character is any visible one byte .BR ascii (7) character (for which .BR isgraph (3) -would return nonzero) that is not \(aq\-\(aq or \(aq:\(aq. +would return nonzero) that is not \(aq\-\(aq, \(aq:\(aq or \(aq;\(aq. If such a character is followed by a colon, the option requires an argument, so .BR getopt ()
@@ -166,6 +166,14 @@ If the first character of .B POSIXLY_CORRECT is set, then option processing stops as soon as a nonoption argument is encountered. +If \(aq+\(aq is not the first character of +.IR optstring , +it is treated as a normal option. +If +.B POSIXLY_CORRECT +behaviour is required in this case +.I optstring +will contain two \(aq+\(aq symbols. If the first character of \fIoptstring\fP is \(aq\-\(aq, then each nonoption \fIargv\fP-element is handled as if it were the argument of an option with character code 1. (This is used by programs that were
--
2.32.0