| 1 |
'\" t |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH getopt_long_only 3 2025-12-07 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
getopt_long_only |
| 9 |
\- parse long command-line options |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #define _GNU_SOURCE |
| 16 |
.B #include <getopt.h> |
| 17 |
.P |
| 18 |
.BI "int getopt_long_only(int " argc ", char *" argv [], |
| 19 |
.BI " const char *" optstring , |
| 20 |
.BI " const struct option *" longopts ", int *" longindex ); |
| 21 |
.fi |
| 22 |
.SH DESCRIPTION |
| 23 |
.BR getopt_long_only () |
| 24 |
is like |
| 25 |
.BR getopt_long (3), |
| 26 |
but \[aq]\-\[aq] as well |
| 27 |
as "\-\-" can indicate a long option. |
| 28 |
If an option that starts with \[aq]\-\[aq] |
| 29 |
(not "\-\-") doesn't match a long option, but does match a short option, |
| 30 |
it is parsed as a short option instead. |
| 31 |
.SH ATTRIBUTES |
| 32 |
For an explanation of the terms used in this section, see |
| 33 |
.BR attributes (7). |
| 34 |
.TS |
| 35 |
allbox; |
| 36 |
lb lb lbx |
| 37 |
l l l. |
| 38 |
Interface Attribute Value |
| 39 |
T{ |
| 40 |
.na |
| 41 |
.nh |
| 42 |
.BR getopt_long_only () |
| 43 |
T} Thread safety T{ |
| 44 |
.na |
| 45 |
.nh |
| 46 |
MT-Unsafe race:getopt env |
| 47 |
T} |
| 48 |
.TE |
| 49 |
.SH STANDARDS |
| 50 |
GNU. |
| 51 |
.SH SEE ALSO |
| 52 |
.BR getopt (1), |
| 53 |
.BR getopt (3), |
| 54 |
.BR getopt_long (3), |
| 55 |
.BR getsubopt (3) |