Skip to contentSkip to conversation

man/man3/getopt.3: Assist getopt_long() users

PATCH Superseded G. Branden Robinson 2 participants 3 messages Dec 7, 2025 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 man/man3/getopt.3: Assist getopt_long() users

Throw a bone to users of this function who need to report (in a diagnostic message, for instance) the identity of an invalid long option name.

---
 man/man3/getopt.3 | 6 ++++++
 1 file changed, 6 insertions(+)
man/man3/getopt.3 +6 -0
index 8495719af..432ea1252 100644
@@ -300,6 +300,12 @@ .SS getopt_long() and getopt_long_only()
 points to a variable which is set to the index of the long option relative to
 .IR longopts .
 .P
+Its analogue to
+.BR getopt ()'s
+.I optopt
+is
+.RI \[lq] "argv[(optind \- 1)]" \[rq].
+.P
 .BR getopt_long_only ()
 is like
 .BR getopt_long (),
Signature · 1 line
2.30.2
#1 lore raw

Hi Branden,

Quoted 14 lines · G. Branden Robinson

Throw a bone to users of this function who need to report (in a diagnostic message, for instance) the identity of an invalid long option name.

---
 man/man3/getopt.3 | 6 ++++++
 1 file changed, 6 insertions(+)
man/man3/getopt.3 +0 -0
index 8495719af..432ea1252 100644

man/man3/getopt.3 .SS getopt_long() and getopt_long_only() · line 308

Quoted 9 lines
man/man3/getopt.3 +6 -0
@@ -300,6 +300,12 @@ .SS getopt_long() and getopt_long_only()
 points to a variable which is set to the index of the long option relative to
 .IR longopts .
 .P
+Its analogue to
+.BR getopt ()'s
+.I optopt
+is
+.RI \[lq] "argv[(optind \- 1)]" \[rq].
+.P

Ughhh, this page is too crowded already. I'll split the _long* variants into their own separate page.

I'll ping you once that's done, so that you can rebase this patch.

Have a lovely day!
Alex

Quoted 5 lines
man/man3/getopt.3 +0 -0
 .BR getopt_long_only ()
 is like
 .BR getopt_long (),
Signature · 1 line
2.30.2
Signature · 1 line
<https://www.alejandro-colomar.es>
#2 lore raw
Quoted 30 lines · Alejandro Colomar

Hi Branden,

Quoted 14 lines · G. Branden Robinson

Throw a bone to users of this function who need to report (in a diagnostic message, for instance) the identity of an invalid long option name.

---
 man/man3/getopt.3 | 6 ++++++
 1 file changed, 6 insertions(+)
man/man3/getopt.3 +0 -0
index 8495719af..432ea1252 100644

man/man3/getopt.3 .SS getopt_long() and getopt_long_only() · line 308

Quoted 9 lines
man/man3/getopt.3 +6 -0
@@ -300,6 +300,12 @@ .SS getopt_long() and getopt_long_only()
 points to a variable which is set to the index of the long option relative to
 .IR longopts .
 .P
+Its analogue to
+.BR getopt ()'s
+.I optopt
+is
+.RI \[lq] "argv[(optind \- 1)]" \[rq].
+.P

Ughhh, this page is too crowded already. I'll split the _long* variants into their own separate page.

Quoted 1 line

I'll ping you once that's done, so that you can rebase this patch.

Done.

Cheers,
Alex

Quoted 15 lines

Have a lovely day!
Alex

Quoted 5 lines
man/man3/getopt.3 +0 -0
 .BR getopt_long_only ()
 is like
 .BR getopt_long (),
Signature · 1 line
2.30.2
Signature · 1 line
<https://www.alejandro-colomar.es>
Signature · 1 line
<https://www.alejandro-colomar.es>