Skip to content

Commit 3121626

Browse files
committedOct 7, 2024
document the values of has_arg for getopt_long
1 parent 2877cc2 commit 3121626

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎intro.tex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2201,7 +2201,7 @@
22012201
\begin{tabbing}
22022202
stru\=ct \funnm{option} \{\\
22032203
\>const char *name; \textrm{/* name of the option */} \\
2204-
\>int has\_arg; \textrm{/* value: yes, no, \emsl{optional} */} \\
2204+
\>int has\_arg; \textrm{/* meaning: yes, no, \emsl{optional} */} \\
22052205
\>int *flag; \textrm{/*~}\=\textrm{if \texttt{NULL}, the function returns
22062206
\texttt{val}}, \\
22072207
\>\>\textrm{otherwise returns 0}
@@ -2224,6 +2224,8 @@
22242224
\item If \texttt{flag} is set, \texttt{getopt\_long} returns 0, which makes
22252225
these long options without the short variant get processed in a single branch of
22262226
\texttt{case}.
2227+
\item The actual permitted values of the \texttt{has\_arg} member are defines
2228+
\texttt{no\_argument}, \texttt{required\_argument} and \texttt{optional\_argument}.
22272229
\item There is also \texttt{getopt\_long\_only}, which allows long options
22282230
to begin with a single dash (\texttt{-option}).
22292231
\item The \texttt{getopt\_long} function is possible to use in two ways.

0 commit comments

Comments
 (0)