gnu.getopt java_c – 用于GNU getopt()的-W选项是什么?
The -W (capital-W) option shall be reserved for vendor options.
If optstring contains W followed by a semicolon ( ; ), then -W foo is treated as the long option --foo. (The -W option is reserved by POSIX.2 for implementation extensions.)
有人能夠以更清晰的方式解釋上述句子(直截了當)并解釋為什么這樣的選項有用嗎?
上面的語句讓我感到困惑,因為我認為getopt(不是getopt_long,getopt_long_only)只能理解短選項.
解決方法:
Long options can also be specified using a special POSIX argument
format (one that I highly discourage). This form of entry is enabled
by placing a “W;” (yes, ‘W’ then a semi-colon) in the valid option
string. This causes getopt to treat the name following the “-W” as the
name of the long option. For example, “-W outputdir=foo” would be
equivalent to “–outputdir=foo”. The name can immediately follow the
“-W” like so: “-Woutputdir=foo”. Option arguments are handled
identically to normal long options. If a string follows the “-W” that
does not represent a valid long option, then getopt() returns ‘W’ and
the caller must decide what to do. Otherwise getopt() returns a long
option value as described below.
標簽:c-3,linux,unix,command-line
來源: https://codeday.me/bug/20190729/1569495.html
總結
以上是生活随笔為你收集整理的gnu.getopt java_c – 用于GNU getopt()的-W选项是什么?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html5 css3考试f卷,HTML5
- 下一篇: linux 进程调度源码分析,Linux