aboutsummaryrefslogtreecommitdiffstats
path: root/man/man3/getopt_long_only.3
blob: 4d811fb43ecdf220ddf844b6a5c10da431875960 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'\" 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)