Skip to contentSkip to conversation

man/man3/getopt_long.3: Assist users

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

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 man/man3/getopt_long.3: Assist 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_long.3 | 6 ++++++
 1 file changed, 6 insertions(+)
man/man3/getopt_long.3 +6 -0
index 73e8f3e6f..a464349fe 100644
@@ -102,6 +102,12 @@ .SH DESCRIPTION
 is not NULL, it
 points to a variable which is set to the index of the long option relative to
 .IR longopts .
+.P
+Its analogue to
+.BR getopt (3)'s
+.I optopt
+is
+.RI \[lq] "argv[(optind \- 1)]" \[rq].
 .SH RETURN VALUE
 See
 .BR getopt (3).
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_long.3 | 6 ++++++
 1 file changed, 6 insertions(+)
man/man3/getopt_long.3 +0 -0
index 73e8f3e6f..a464349fe 100644

man/man3/getopt_long.3 .SH DESCRIPTION · line 110

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

Would you mind adding \% to the entire expression?

Have a lovely night!
Alex

Quoted 5 lines
man/man3/getopt_long.3 +0 -0
 .SH RETURN VALUE
 See
 .BR getopt (3).
Signature · 1 line
2.30.2
Signature · 1 line
<https://www.alejandro-colomar.es>
#2 lore raw
Quoted 8 lines · Alejandro Colomar
Quoted 8 lines
man/man3/getopt_long.3 +0 -0
index 73e8f3e6f..a464349fe 100644
@@ -102,6 +102,12 @@ .SH DESCRIPTION
 is not NULL, it
 points to a variable which is set to the index of the long option relative to
 .IR longopts .
Quoted 8 lines

man/man3/getopt_long.3 .SH DESCRIPTION · line 110

Quoted 6 lines
man/man3/getopt_long.3 +6 -0
+.P
+Its analogue to
+.BR getopt (3)'s
+.I optopt
+is
+.RI \[lq] "argv[(optind \- 1)]" \[rq].

Would you mind adding \% to the entire expression?

Strictly speaking, it's not necessary, because in groff's English hyphenation patterns (and when using the hyphenation mode configured by "en.tmac"), "optind" is the only letter sequence long enough to be eligible for hyphenation, and it doesn't.

$ hyphen optind filibuster
optind
fil‐i‐buster

I'm attaching my "hyphen" script.

I can do it, but FYI.

Regards,
Branden

#!/bin/sh

: ${HY:=4}

for W
do

    printf ".hy $HY\n.ll 1u\n%s\n" "$W" | nroff -Wbreak | sed '/^$/d' \
        | tr -d '\n'
    echo

done

# vim:set ai et sw=4 ts=4 tw=80:

#3 lore raw
Quoted 18 lines · G. Branden Robinson
Quoted 8 lines · Alejandro Colomar
Quoted 8 lines
man/man3/getopt_long.3 +0 -0
index 73e8f3e6f..a464349fe 100644
@@ -102,6 +102,12 @@ .SH DESCRIPTION
 is not NULL, it
 points to a variable which is set to the index of the long option relative to
 .IR longopts .
Quoted 8 lines

man/man3/getopt_long.3 .SH DESCRIPTION · line 110

Quoted 6 lines
man/man3/getopt_long.3 +6 -0
+.P
+Its analogue to
+.BR getopt (3)'s
+.I optopt
+is
+.RI \[lq] "argv[(optind \- 1)]" \[rq].

Would you mind adding \% to the entire expression?

Quoted 4 lines

Strictly speaking, it's not necessary, because in groff's English hyphenation patterns (and when using the hyphenation mode configured by "en.tmac"), "optind" is the only letter sequence long enough to be eligible for hyphenation, and it doesn't.

Hmmm, I guess that's fine then.

Quoted 24 lines
$ hyphen optind filibuster
optind
fil‐i‐buster

I'm attaching my "hyphen" script.

I can do it, but FYI.

Regards,
Branden

#!/bin/sh

: ${HY:=4}

for W
do

    printf ".hy $HY\n.ll 1u\n%s\n" "$W" | nroff -Wbreak | sed '/^$/d' \
        | tr -d '\n'
    echo

done

# vim:set ai et sw=4 ts=4 tw=80:

Signature · 1 line
<https://www.alejandro-colomar.es>
#4 lore raw
In reply to G. Branden Robinson

Hi Branden,

Quoted 5 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.

Thanks! I've applied the patch.
<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=c7d74dacc2c3615a26a80209226d186d34b4afcf>

Have a lovely night!
Alex

Quoted 23 lines
---
 man/man3/getopt_long.3 | 6 ++++++
 1 file changed, 6 insertions(+)
man/man3/getopt_long.3 +6 -0
index 73e8f3e6f..a464349fe 100644
@@ -102,6 +102,12 @@ .SH DESCRIPTION
 is not NULL, it
 points to a variable which is set to the index of the long option relative to
 .IR longopts .
+.P
+Its analogue to
+.BR getopt (3)'s
+.I optopt
+is
+.RI \[lq] "argv[(optind \- 1)]" \[rq].
 .SH RETURN VALUE
 See
 .BR getopt (3).
Signature · 1 line
2.30.2
Signature · 1 line
<https://www.alejandro-colomar.es>