blob: d27209f284d78a7203557d275ea1ebc3906c5a4e [file] [log] [blame]
<html lang="en">
<head>
<title>Argp Flags - The GNU C Library</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="The GNU C Library">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Argp.html#Argp" title="Argp">
<link rel="prev" href="Argp-Parsers.html#Argp-Parsers" title="Argp Parsers">
<link rel="next" href="Argp-Help.html#Argp-Help" title="Argp Help">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU C library.
This is Edition 0.12, last updated 2007-10-27,
of `The GNU C Library Reference Manual', for version
2.8 (Sourcery G++ Lite 2011.03-41).
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002,
2003, 2007, 2008, 2010 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software Needs Free Documentation''
and ``GNU Lesser General Public License'', the Front-Cover texts being
``A GNU Manual'', and with the Back-Cover Texts as in (a) below. A
copy of the license is included in the section entitled "GNU Free
Documentation License".
(a) The FSF's Back-Cover Text is: ``You have the freedom to
copy and modify this GNU manual. Buying copies from the FSF
supports it in developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
<link rel="stylesheet" type="text/css" href="../cs.css">
</head>
<body>
<div class="node">
<a name="Argp-Flags"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Argp-Help.html#Argp-Help">Argp Help</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Argp-Parsers.html#Argp-Parsers">Argp Parsers</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Argp.html#Argp">Argp</a>
<hr>
</div>
<h4 class="subsection">25.3.7 Flags for <code>argp_parse</code></h4>
<p>The default behavior of <code>argp_parse</code> is designed to be convenient
for the most common case of parsing program command line argument. To
modify these defaults, the following flags may be or'd together in the
<var>flags</var> argument to <code>argp_parse</code>:
<dl>
<!-- argp.h -->
<!-- GNU -->
<dt><code>ARGP_PARSE_ARGV0</code><a name="index-ARGP_005fPARSE_005fARGV0-3067"></a><dd>Don't ignore the first element of the <var>argv</var> argument to
<code>argp_parse</code>. Unless <code>ARGP_NO_ERRS</code> is set, the first element
of the argument vector is skipped for option parsing purposes, as it
corresponds to the program name in a command line.
<!-- argp.h -->
<!-- GNU -->
<br><dt><code>ARGP_NO_ERRS</code><a name="index-ARGP_005fNO_005fERRS-3068"></a><dd>Don't print error messages for unknown options to <code>stderr</code>; unless
this flag is set, <code>ARGP_PARSE_ARGV0</code> is ignored, as <code>argv[0]</code>
is used as the program name in the error messages. This flag implies
<code>ARGP_NO_EXIT</code>. This is based on the assumption that silent exiting
upon errors is bad behavior.
<!-- argp.h -->
<!-- GNU -->
<br><dt><code>ARGP_NO_ARGS</code><a name="index-ARGP_005fNO_005fARGS-3069"></a><dd>Don't parse any non-option args. Normally these are parsed by calling
the parse functions with a key of <code>ARGP_KEY_ARG</code>, the actual
argument being the value. This flag needn't normally be set, as the
default behavior is to stop parsing as soon as an argument fails to be
parsed. See <a href="Argp-Parser-Functions.html#Argp-Parser-Functions">Argp Parser Functions</a>.
<!-- argp.h -->
<!-- GNU -->
<br><dt><code>ARGP_IN_ORDER</code><a name="index-ARGP_005fIN_005fORDER-3070"></a><dd>Parse options and arguments in the same order they occur on the command
line. Normally they're rearranged so that all options come first.
<!-- argp.h -->
<!-- GNU -->
<br><dt><code>ARGP_NO_HELP</code><a name="index-ARGP_005fNO_005fHELP-3071"></a><dd>Don't provide the standard long option &lsquo;<samp><span class="samp">--help</span></samp>&rsquo;, which ordinarily
causes usage and option help information to be output to <code>stdout</code>
and <code>exit (0)</code>.
<!-- argp.h -->
<!-- GNU -->
<br><dt><code>ARGP_NO_EXIT</code><a name="index-ARGP_005fNO_005fEXIT-3072"></a><dd>Don't exit on errors, although they may still result in error messages.
<!-- argp.h -->
<!-- GNU -->
<br><dt><code>ARGP_LONG_ONLY</code><a name="index-ARGP_005fLONG_005fONLY-3073"></a><dd>Use the gnu getopt `long-only' rules for parsing arguments. This allows
long-options to be recognized with only a single &lsquo;<samp><span class="samp">-</span></samp>&rsquo;
(i.e., &lsquo;<samp><span class="samp">-help</span></samp>&rsquo;). This results in a less useful interface, and its
use is discouraged as it conflicts with the way most GNU programs work
as well as the GNU coding standards.
<!-- argp.h -->
<!-- GNU -->
<br><dt><code>ARGP_SILENT</code><a name="index-ARGP_005fSILENT-3074"></a><dd>Turns off any message-printing/exiting options, specifically
<code>ARGP_NO_EXIT</code>, <code>ARGP_NO_ERRS</code>, and <code>ARGP_NO_HELP</code>.
</dl>
</body></html>