aboutsummaryrefslogtreecommitdiffstats
path: root/man
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2025-12-07 17:01:47 +0100
committerAlejandro Colomar <alx@kernel.org>2025-12-07 17:34:40 +0100
commit46950a0845de91c422efe6c639091ace42cb92f8 (patch)
treea0a0d01528685162f55dbdc4bcaf316771e2a401 /man
parent8caecf0d961bb750e58a2f68ed874da7e0df3c95 (diff)
downloadman-pages-master.tar.gz
man/man3/getopt_long*.3: Split getopt_long_only() from getopt_long(3)HEADmaster
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'man')
-rw-r--r--man/man3/getopt_long.326
-rw-r--r--man/man3/getopt_long_only.356
2 files changed, 61 insertions, 21 deletions
diff --git a/man/man3/getopt_long.3 b/man/man3/getopt_long.3
index f930d3ad37..73e8f3e6f0 100644
--- a/man/man3/getopt_long.3
+++ b/man/man3/getopt_long.3
@@ -5,7 +5,7 @@
.\"
.TH getopt_long 3 (date) "Linux man-pages (unreleased)"
.SH NAME
-getopt_long, getopt_long_only
+getopt_long
\- parse command-line options
.SH LIBRARY
Standard C library
@@ -18,9 +18,6 @@ Standard C library
.BI "int getopt_long(int " argc ", char *" argv [],
.BI " const char *" optstring ,
.BI " const struct option *" longopts ", int *" longindex );
-.BI "int getopt_long_only(int " argc ", char *" argv [],
-.BI " const char *" optstring ,
-.BI " const struct option *" longopts ", int *" longindex );
.fi
.SH DESCRIPTION
The
@@ -105,26 +102,15 @@ If
is not NULL, it
points to a variable which is set to the index of the long option relative to
.IR longopts .
-.P
-.BR getopt_long_only ()
-is like
-.BR getopt_long (),
-but \[aq]\-\[aq] as well
-as "\-\-" can indicate a long option.
-If an option that starts with \[aq]\-\[aq]
-(not "\-\-") doesn't match a long option, but does match a short option,
-it is parsed as a short option instead.
.SH RETURN VALUE
See
.BR getopt (3).
.P
.BR getopt_long ()
-and
-.BR getopt_long_only ()
-also return the option
+also returns the option
character when a short option is recognized.
-For a long option, they
-return
+For a long option,
+it returns
.I val
if
.I flag
@@ -147,8 +133,7 @@ Interface Attribute Value
T{
.na
.nh
-.BR getopt_long (),
-.BR getopt_long_only ()
+.BR getopt_long ()
T} Thread safety T{
.na
.nh
@@ -247,4 +232,5 @@ main(int argc, char *argv[])
.SH SEE ALSO
.BR getopt (1),
.BR getopt (3),
+.BR getopt_long_only (3),
.BR getsubopt (3)
diff --git a/man/man3/getopt_long_only.3 b/man/man3/getopt_long_only.3
index 9ee53fe382..4d811fb43e 100644
--- a/man/man3/getopt_long_only.3
+++ b/man/man3/getopt_long_only.3
@@ -1 +1,55 @@
-.so man3/getopt_long.3
+'\" t
+.\" Copyright, the authors of the Linux man-pages project
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH getopt_long_only 3 (date) "Linux man-pages (unreleased)"
+.SH NAME
+getopt_long_only
+\- parse long command-line options
+.SH LIBRARY
+Standard C library
+.RI ( libc ,\~ \-lc )
+.SH SYNOPSIS
+.nf
+.B #define _GNU_SOURCE
+.B #include <getopt.h>
+.P
+.BI "int getopt_long_only(int " argc ", char *" argv [],
+.BI " const char *" optstring ,
+.BI " const struct option *" longopts ", int *" longindex );
+.fi
+.SH DESCRIPTION
+.BR getopt_long_only ()
+is like
+.BR getopt_long (3),
+but \[aq]\-\[aq] as well
+as "\-\-" can indicate a long option.
+If an option that starts with \[aq]\-\[aq]
+(not "\-\-") doesn't match a long option, but does match a short option,
+it is parsed as a short option instead.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lbx
+l l l.
+Interface Attribute Value
+T{
+.na
+.nh
+.BR getopt_long_only ()
+T} Thread safety T{
+.na
+.nh
+MT-Unsafe race:getopt env
+T}
+.TE
+.SH STANDARDS
+GNU.
+.SH SEE ALSO
+.BR getopt (1),
+.BR getopt (3),
+.BR getopt_long (3),
+.BR getsubopt (3)