
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- MyFirstUnitAd -->
<ins class="adsbygoogle"
     style="display:inline-block;width:970px;height:250px"
     data-ad-client="ca-pub-5778386704669218"
     data-ad-slot="1503492166"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <link rel="stylesheet" type="text/css" href="../../../style.css" title="style" />
    <link rel="stylesheet" type="text/css" href="../style.css" title="style" />
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />

    <title>pmgetoptions(3) - Linux manual page</title>
</head>

<body>

<div class="page-top"><a id="top_of_page"></a></div>
<!--%%%TOP_BAR%%%-->
    <div class="nav-bar">
        <table class="nav-table">
            <tr>
                <td class="nav-cell">
                    <p class="nav-text">
                        <a href="http://man7.org/index.html">man7.org</a> &gt; Linux &gt; <a href="../index.html">man-pages</a>
                    </p>
                </td>
                <td class="training-cell">
                    <p class="training-text"><a class="training-link" href="http://man7.org/training/">Linux/UNIX system programming training</a></p>
                </td>
            </tr>
        </table>
    </div>

<hr class="nav-end" />

<!--%%%PAGE_START%%%-->


<table class="sec-table">
<tr>
    <td>
        <p class="section-dir">
<a href="pmgetopt_r.3.html#NAME">NAME</a> | <a href="pmgetopt_r.3.html#C_SYNOPSIS">C&nbsp;SYNOPSIS</a> | <a href="pmgetopt_r.3.html#DESCRIPTION">DESCRIPTION</a> | <a href="pmgetopt_r.3.html#FLAGS_VALUES">FLAGS&nbsp;VALUES</a> | <a href="pmgetopt_r.3.html#OPTIONS_VIA_ENVIRONMENT_VARIABLES">OPTIONS&nbsp;VIA&nbsp;ENVIRONMENT&nbsp;VARIABLES</a> | <a href="pmgetopt_r.3.html#RETURN_VALUE">RETURN&nbsp;VALUE</a> | <a href="pmgetopt_r.3.html#PCP_ENVIRONMENT">PCP&nbsp;ENVIRONMENT</a> | <a href="pmgetopt_r.3.html#SEE_ALSO">SEE&nbsp;ALSO</a> | <a href="pmgetopt_r.3.html#COLOPHON">COLOPHON</a>
        </p>
    </td>
    <td class="search-box">
        <div class="man-search-box">

            <form method="get" action="http://www.google.com/search">
                <fieldset class="man-search">
                    <input type="text" name="q" size="10" maxlength="255" value="" />
                    <input type="hidden" name="sitesearch" value="man7.org/linux/man-pages" />
                    <input type="submit" name="sa" value="Search online pages" />
                </fieldset>
            </form>

        </div>
    </td>
    <td> </td>
</tr>
</table>

<pre>
<span class="headline">PMGETOPTIONS(3)           Library Functions Manual           PMGETOPTIONS(3)</span>
</pre>
<h2><a id="NAME" href="pmgetopt_r.3.html#NAME"></a>NAME  &nbsp; &nbsp; &nbsp; &nbsp; <a href="pmgetopt_r.3.html#top_of_page"><span class="top-link">top</span></a></h2><pre>
       <b>pmgetopt_r</b>,    <b>pmGetOptions</b>,    <b>pmGetContextOptions</b>,   <b>pmFreeOptions</b>,
       <b>pmUsageMessage </b>- command line handling for PMAPI tools
</pre>
<h2><a id="C_SYNOPSIS" href="pmgetopt_r.3.html#C_SYNOPSIS"></a>C SYNOPSIS  &nbsp; &nbsp; &nbsp; &nbsp; <a href="pmgetopt_r.3.html#top_of_page"><span class="top-link">top</span></a></h2><pre>
       <b>#include &lt;pcp/pmapi.h&gt;</b>

       <b>int pmgetopt_r(int </b><i>argc</i><b>, char *const *</b><i>argv</i><b>, pmOptions *</b><i>opts</i><b>);</b>
       <b>int pmGetOptions(int </b><i>argc</i><b>, char *const *</b><i>argv</i><b>, pmOptions *</b><i>opts</i><b>);</b>
       <b>int pmGetContextOptions(int </b><i>ctx</i><b>, pmOptions *</b><i>opts</i><b>);</b>
       <b>void pmUsageMessage(pmOptions *</b><i>opts</i><b>);</b>
       <b>void pmFreeOptions(pmOptions *</b><i>opts</i><b>);</b>

       <b>cc ... -lpcp</b>
</pre>
<h2><a id="DESCRIPTION" href="pmgetopt_r.3.html#DESCRIPTION"></a>DESCRIPTION  &nbsp; &nbsp; &nbsp; &nbsp; <a href="pmgetopt_r.3.html#top_of_page"><span class="top-link">top</span></a></h2><pre>
       The <b>pmGetOptions </b>function provides command line option processing
       services for both monitor and collector <a href="PMAPI.3.html">PMAPI(3)</a> tools.  It is
       modelled on the thread-safe variants of the GNU <a href="getopt_long.3.html">getopt_long(3)</a> API,
       and primarily differs in its focus on providing generalised
       processing for the (de-facto) standard PCP command line options
       described in <a href="../man1/PCPIntro.1.html">PCPIntro(1)</a>.  These common options include the host and
       archive specification, time windows, timezones, sample counts, time
       intervals, and so on.

       The primary interface is <b>pmGetOptions</b>, which should be passed the
       <i>argc</i> argument count and <i>argv</i> array, as passed to the <i>main()</i> function
       on program invocation.  The final <i>opts</i> argument describes the set of
       long and short options the tools is prepared to process, and other
       metadata regarding how those options should be processed.

       The <b>pmgetopt_r </b>interface, used internally by <b>pmGetOptions</b>, behaves in
       a similar fashion, but it does not perform any common option
       processing.  It is more suited to PCP collector processes, whereas
       PCP monitor tools tend to use <b>pmGetOptions</b>.

       The <i>opts</i> argument consists of an array of <i>pmLongOpts</i> entries
       describing the arguments, as well as the enclosing <i>pmOptions</i> struct,
       which are defined as follows (internal fields are not presented, for
       brevity):

         typedef struct {
             const char *        long_opt;
             int                 has_arg;
             int                 short_opt;
             const char *        argname;
             const char *        message;
         } pmLongOptions;

         typedef struct {
             int                 version;
             int                 flags;
             const char *        short_options;
             pmLongOptions *     long_options;
             const char *        short_usage;
             pmOptionOverride    override;

             int                 index;
             int                 optind;
             int                 opterr;
             int                 optopt;
             char                *optarg;
             /* [internal fields, undocumented] */

             int                 errors;
             int                 context; /* PM_CONTEXT_{HOST,ARCHIVE,LOCAL} */
             int                 nhosts;
             int                 narchives;
             char **             hosts;
             char **             archives;
             struct timeval      start;
             struct timeval      finish;
             struct timeval      origin;
             struct timeval      interval;
             char *              align_optarg;
             char *              start_optarg;
             char *              finish_optarg;
             char *              origin_optarg;
             char *              guiport_optarg;
             char *              timezone;
             int                 samples;
             int                 guiport;
             int                 padding;
             unsigned int        guiflag : 1;
             unsigned int        tzflag  : 1;
             unsigned int        nsflag  : 1;
             unsigned int        Lflag   : 1;
             unsigned int        zeroes  : 28;
         } pmOptions;

       The initial <i>flags</i> and <i>version</i> fields describe how the rest of the
       pmOptions structure is to be interpreted.  These fields can be
       zeroed, specifying a default interpretation.  Alternatively, the
       PMAPI_VERSION macro can be used to specify the API level to use
       (currently, values of 2 or less are allowed).  The <i>flags</i> field can be
       used to modify option processing behaviour as described in the
       ``FLAGS VALUES'' section below.

       The array of <i>long_options</i> pmLongOpts structures must be terminated by
       a sentinel and the PMAPI_OPTIONS_END macro can be used to effect this
       termination.  Individual records within the <i>long_options</i> array can be
       of two types - options headers, or actual options.  An options header
       is constructed using the PMAPI_OPTIONS_HEADER macro, and is used for
       usage message option grouping.  Free form text can be inserted into
       the usage message at any point using the PMAPI_OPTIONS_TEXT macro -
       this is intended for additional explanatory text covering detailed
       usage that is beyond the scope of the individual headers or options.
       Otherwise, the array entry specifies an option.  These should be
       named (<i>long_opt</i>) if a long-option form is allowed, specify whether or
       not they take an argument (<i>has_arg</i>), specify the single character
       variant argument (<i>short_opt</i>) if a short-option form is allowed, and
       finally specify how to present the option in the usage message.  This
       latter component consists of a short, one-word description of the
       optional argument (<i>argname</i>) and a one-line description of what the
       command-line option does (<i>message</i>).

       The <i>short_usage</i> string is also used only when constructing the usage
       message.  It forms the component of the usage message that follows
       the program name (i.e. <i>argv[0]</i>).

       The optional <i>short_options</i> string is the normal <i>getopt</i> command-line
       option specification string, using individual characters (those with
       arguments are designated as such using the ':' character) - as used
       by all <i>getopt</i> implementations.

       A facility is provided to extend the existing set of common options
       with additional options, as well as to re-task the standard options
       into non-standard roles for individual tools.  The latter is achieved
       using the <i>override</i> method, which allows a callback function to be
       provided which will be called on receipt of every argument, prior to
       common processing.  If this callback returns a non-zero value the
       common processing will be short-circuited for that option, otherwise
       processing continues.  Thus, aach client tool is free to choose
       exactly which of the standard options they wish to support - this can
       be all, some, or none, and no matter what they choose, each tool
       always has access to the long option parsing capability and the usage
       message generation facility.

       The remaining pmOptions structure fields are filled in as a result of
       processing the arguments, and are largely self-explanatory.  Further
       discussion of these is deferred to the ``FLAGS VALUES'' section
       below.  The <i>error</i> field contains a count of errors detected during
       option processing.  These can be either usage or runtime errors, as
       indicated by the <i>flags</i> field (set, and passed out to the caller).
       Typically, a command line tool will fail to start successfully and
       will produce an error message (e.g. via <b>pmUsageMessage</b>) if the <i>error</i>
       field is non-zero at the end of either <b>pmGetOptions </b>or
       <b>pmGetContextOptions</b>.

       Some command line option post-processing can only be performed once
       the tool has established a PMAPI context via <a href="pmNewContext.3.html">pmNewContext(3)</a>.  This
       processing includes use of context-aware timezones (<b>-z</b>), and time
       window processing (<b>-A</b>, <b>-O</b>, <b>-S</b>, <b>-T</b>) that may be affected by the
       timezone, for example.  The <b>pmGetContextOptions </b>function is available
       for such situations, and it completes any remaining processing of
       <i>opts</i> with respect to the <i>ctx</i> context identifier given.

       The <b>pmUsageMessage </b>function generates a usage message for the tool,
       and included both standard PCP options and custom options for each
       tool, as specified by the pmLongOptions array.  It supports grouping
       of options (via PMAPI_OPTIONS_HEADER) as well as neat formatting of
       all options - short and long - their arguments, and individual
       explanatory messages.  It will build this usage message using
       <a href="pmprintf.3.html">pmprintf(3)</a> upon which it will issue a single <a href="pmflush.3.html">pmflush(3)</a> before
       returning to the caller, provided the PM_OPTFLAG_USAGE_ERR flag is
       set in <i>flags</i>, which will happen automatically during option parsing,
       when usage errors are detected.

       In certain situations, such as recording lists of host specifications
       or PCP archive paths, the <b>pmGetOptions </b>routine may allocate memory,
       and store pointers to it within <i>opts</i>.  Should a program wish to free
       this memory before exiting, it can use the <b>pmFreeOptions </b>routine to
       do so.  This is safe to call irrespective of whether memory was
       allocated dynamically, provided that <i>opts</i> was zeroed initially.
</pre>
<h2><a id="FLAGS_VALUES" href="pmgetopt_r.3.html#FLAGS_VALUES"></a>FLAGS VALUES  &nbsp; &nbsp; &nbsp; &nbsp; <a href="pmgetopt_r.3.html#top_of_page"><span class="top-link">top</span></a></h2><pre>
       <b>PM_OPTFLAG_INIT</b>
              Used internally within the library to indicate initialisation
              has been done, so that on subsequent calls it will not be done
              again.

       <b>PM_OPTFLAG_DONE</b>
              Used primarily internally within the library to indicate that
              the final option processing has been completed.  This
              processing involves cross-referencing a number of the options,
              to check for mutual exclusion, for example.  There may be
              other post-processing at this stage also, provided it does not
              require a PMAPI context.

       <b>PM_OPTFLAG_MULTI</b>
              Allow more than one host or set of archives to be specified.
              The default is to allow one source of metrics only, however
              some of the more sophisticated tools permit multiple metric
              sources, each of which is handled within a separate context.
              See also <b>PM_OPTFLAG_MIXED</b>.

       <b>PM_OPTFLAG_USAGE_ERR</b>
              Indicates that the library has detected a command-line usage
              error.  This is an error such as when an option requires an
              argument but none is supplied, or conflicting options are
              specified (such as <b>-s </b>and <b>-T</b>).

       <b>PM_OPTFLAG_RUNTIME_ERR</b>
              Indicates that the library has detected an error at run time.
              This is an error such as failing to retrieve timezone
              information from <a href="../man1/pmcd.1.html">pmcd(1)</a> or failing to load an alternate
              metric namespace from a local file (via the <b>-n </b>option).

       <b>PM_OPTFLAG_EXIT</b>
              Indicates a suggestion from the library that the tool exit
              cleanly.  This is used when the version number is requested,
              for example (the <b>-V </b>option and PMOPT_VERSION macro).

       <b>PM_OPTFLAG_POSIX</b>
              Use strict POSIX command line argument handling.  This means
              options and following arguments will not be reordered, so
              additional options cannot follow command line arguments.  This
              may be important for tools where the arguments can be negative
              numbers, for example, as these should not be treated as
              command line options in this case.

       <b>PM_OPTFLAG_MIXED</b>
              Allow both live and archive metric sources to be specified.
              The default is to allow one type of metric context only,
              however some of the more sophisticated tools permit multiple
              context types.  See also <b>PM_OPTFLAG_MULTI</b>.

       <b>PM_OPTFLAG_ENV_ONLY</b>
              Many options can be specified through the either the command
              line or from similarly-named environment variables.  This flag
              disables all argument parsing, and only changes <i>opts</i> based on
              the environment variables.  This may be useful for tools
              wishing to ensure no command line option conflicts occur
              between their own set and the standard PCP option set (such as
              an existing tool, reimplemented using PMAPI services).

       <b>PM_OPTFLAG_LONG_ONLY</b>
              Only process long options, not short options.

       <b>PM_OPTFLAG_BOUNDARIES</b>
              The default <b>pmGetOptions </b>behaviour is to parse the time window
              options (namely, <b>-A</b>, <b>-O</b>, <b>-S </b>and <b>-T</b>), only if one of those
              options has been specified on the command line.  However, this
              flag can be used (particularly with archive contexts) to find
              the <i>start</i> and <i>finish</i> times associated with the context(s) even
              if no time window options were specified.  In the case of
              multiple archives, the time window is defined as the time
              window spanning all of the archives.

       <b>PM_OPTFLAG_STDOUT_TZ</b>
              The timezone being used will be reported on the standard
              output stream during option parsing.  The default behaviour is
              to not report, but simply return timezone information via the
              <i>timezone</i> (<b>-Z</b>) and <i>tzflag</i> (<b>-z</b>) fields in the <i>opts</i> structure.

       <b>PM_OPTFLAG_NOFLUSH</b>
              The final <b>pmflush </b>call issued by <b>pmUsageMessage </b>will be
              skipped if this flag is set.  This is useful in situations
              where the caller wishes to append additional test to the
              generated usage message before flushing.

       <b>PM_OPTFLAG_QUIET</b>
              Suppress messages from <b>pmgetopt_r </b>about unrecognised command
              line options.  This is the equivalent to setting the <i>opterr</i>
              field in the <i>opt</i> parameter (which mimics the <b>getopt </b>variable
              of the same name).
</pre>
<h2><a id="OPTIONS_VIA_ENVIRONMENT_VARIABLES" href="pmgetopt_r.3.html#OPTIONS_VIA_ENVIRONMENT_VARIABLES"></a>OPTIONS VIA ENVIRONMENT VARIABLES  &nbsp; &nbsp; &nbsp; &nbsp; <a href="pmgetopt_r.3.html#top_of_page"><span class="top-link">top</span></a></h2><pre>
       Some environment variables may be used as an alternative to the
       command line options.  The use of these mechanisms is primarily for
       internal use by PCP tools.  General users should choose the command
       line options as this provides a clearer indication of intent, makes
       debugging issues easier and avoids confusion over possible conflicts
       between the command line options and the environment variables (where
       the command line options usually ``win'').

       The following table describes the environment variables that may be
       used to set values as an alternative to command line options.

       ┌───────────────────┬────────┬──────────────────┬────────────────────┐
       │   Environment     │ Short  │      Long        │      Meaning       │
       │                   │ Option │     Option       │                    │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_ALIGN_TIME    </b>│ <b>-A     </b>│ <b>--align          </b>│ align sample       │
       │                   │        │                  │ times on           │
       │                   │        │                  │ natural            │
       │                   │        │                  │ boundaries         │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_ARCHIVE       </b>│ <b>-a     </b>│ <b>--archive        </b>│ metrics source     │
       │                   │        │                  │ is a PCP           │
       │                   │        │                  │ archive            │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_ARCHIVE_LIST  </b>│        │ <b>--archive-list   </b>│ comma-separated    │
       │                   │        │                  │ list of metric     │
       │                   │        │                  │ source archives    │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_FOLIO         </b>│        │ <b>--archive-folio  </b>│ metric source      │
       │                   │        │                  │ is a <a href="../man1/mkaf.1.html">mkaf(1)</a>       │
       │                   │        │                  │ archives folio     │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_DEBUG         </b>│ <b>-D     </b>│ <b>--debug          </b>│ a comma-           │
       │                   │        │                  │ separated list     │
       │                   │        │                  │ of                 │
       │                   │        │                  │ <a href="pmSetDebug.3.html">pmSetDebug(3)</a>      │
       │                   │        │                  │ debugging          │
       │                   │        │                  │ options            │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_GUIMODE       </b>│ <b>-g     </b>│ <b>--guimode        </b>│ start in GUI       │
       │                   │        │                  │ mode with new      │
       │                   │        │                  │ <a href="../man1/pmtime.1.html">pmtime(1)</a> time     │
       │                   │        │                  │ control            │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_HOST          </b>│ <b>-h     </b>│ <b>--host           </b>│ metrics source     │
       │                   │        │                  │ is <a href="../man1/pmcd.1.html">pmcd(1)</a> on a    │
       │                   │        │                  │ host               │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_HOST_LIST     </b>│        │ <b>--host-list      </b>│ comma-separated    │
       │                   │        │                  │ list of metric     │
       │                   │        │                  │ source hosts       │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_SPECLOCAL     </b>│ <b>-K     </b>│ <b>--spec-local     </b>│ optional           │
       │                   │        │                  │ additional DSO     │
       │                   │        │                  │ PMDA               │
       │                   │        │                  │ specification      │
       │                   │        │                  │ for local          │
       │                   │        │                  │ connection, see    │
       │                   │        │                  │ <a href="pmSpecLocalPMDA.3.html">pmSpecLocalPMDA(3)</a> │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_LOCALPMDA </b>or  │ <b>-L     </b>│ <b>--local-PMDA     </b>│ metrics source is  │
       │<b>$PCP_LOCALMODE     </b>│        │                  │ local connection   │
       │                   │        │                  │ to a DSO PMDA      │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_NAMESPACE     </b>│ <b>-n     </b>│ <b>--namespace      </b>│ use an alternative │
       │                   │        │                  │ Performance        │
       │                   │        │                  │ Metrics Name Space │
       │                   │        │                  │ (PMNS)             │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_UNIQNAMES     </b>│ <b>-N     </b>│ <b>--uniqnames      </b>│ like <b>-n </b>but only   │
       │                   │        │                  │ one name allowed   │
       │                   │        │                  │ for each metric in │
       │                   │        │                  │ the PMNS           │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_ORIGIN </b>or     │ <b>-O     </b>│ <b>--origin         </b>│ initial sample     │
       │<b>$ORIGIN_TIME       </b>│        │                  │ time within the    │
       │                   │        │                  │ time window        │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_GUIPORT       </b>│ <b>-p     </b>│ <b>--guiport        </b>│ port for           │
       │                   │        │                  │ connection to an   │
       │                   │        │                  │ existing <a href="../man1/pmtime.1.html">pmtime(1)</a> │
       │                   │        │                  │ time control       │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_START_TIME    </b>│ <b>-S     </b>│ <b>--start          </b>│ start of the time  │
       │                   │        │                  │ window             │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_SAMPLES       </b>│ <b>-s     </b>│ <b>--samples        </b>│ terminate after    │
       │                   │        │                  │ this many samples  │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_FINISH_TIME   </b>│ <b>-T     </b>│ <b>--finish         </b>│ end of the time    │
       │                   │        │                  │ window             │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_INTERVAL      </b>│ <b>-t     </b>│ <b>--interval       </b>│ sampling interval  │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_TIMEZONE      </b>│ <b>-Z     </b>│ <b>--timezone       </b>│ set reporting      │
       │                   │        │                  │ timezone           │
       ├───────────────────┼────────┼──────────────────┼────────────────────┤
       │<b>$PCP_HOSTZONE      </b>│ <b>-z     </b>│ <b>--hostzone       </b>│ set reporting      │
       │                   │        │                  │ timezone to local  │
       │                   │        │                  │ time of metrics    │
       │                   │        │                  │ source             │
       └───────────────────┴────────┴──────────────────┴────────────────────┘
</pre>
<h2><a id="RETURN_VALUE" href="pmgetopt_r.3.html#RETURN_VALUE"></a>RETURN VALUE  &nbsp; &nbsp; &nbsp; &nbsp; <a href="pmgetopt_r.3.html#top_of_page"><span class="top-link">top</span></a></h2><pre>
       The <b>pmGetOptions </b>function returns either when it detects a command-
       line option that is not one of the standard PCP set, or when the end
       of the command line options has been reached (at which point -1 is
       returned).  Both the <b>pmgetopt_r </b>and <b>pmGetOptions </b>routines return
       control to the caller in the same way that a regular <b>getopt </b>call
       would, with the return value indicating either the end of all
       processing (-1), or the single character form of the option currently
       being processed, or zero for the special long-option-only case.  For
       all option-processing cases, the <i>opts</i> structure is returned
       containing filled out <i>optarg</i>, <i>opterr</i>, <i>optopt</i>, <i>optind</i>, and <i>index</i>
       fields as normal (do <b>NOT </b>use the global optarg or optind from your
       platform C library, these will <b>NOT </b>be modified).

       <b>pmGetOptions </b>does not return to the caller when any of the standard
       PCP options are being processed (although the <i>override</i> mechanism can
       be used to still detect such options if needed).

       The <b>pmGetContextOptions </b>function returns zero on success, or a
       negative PCP error code on failure.  The <i>error</i> field within the <i>opts</i>
       parameter will also be non-zero in the latter case.
</pre>
<h2><a id="PCP_ENVIRONMENT" href="pmgetopt_r.3.html#PCP_ENVIRONMENT"></a>PCP ENVIRONMENT  &nbsp; &nbsp; &nbsp; &nbsp; <a href="pmgetopt_r.3.html#top_of_page"><span class="top-link">top</span></a></h2><pre>
       Environment variables with the prefix <b>PCP_ </b>are used to parameterize
       the file and directory names used by PCP.  On each installation, the
       file <i>/etc/pcp.conf</i> contains the local values for these variables.
       The <b>$PCP_CONF </b>variable may be used to specify an alternative
       configuration file, as described in <a href="../man5/pcp.conf.5.html">pcp.conf(5)</a>.  Values for these
       variables may be obtained programmatically using the <a href="pmGetOptions.3.html">pmGetOptions(3)</a>
       function.
</pre>
<h2><a id="SEE_ALSO" href="pmgetopt_r.3.html#SEE_ALSO"></a>SEE ALSO  &nbsp; &nbsp; &nbsp; &nbsp; <a href="pmgetopt_r.3.html#top_of_page"><span class="top-link">top</span></a></h2><pre>
       <a href="../man1/PCPIntro.1.html">PCPIntro(1)</a>, <a href="../man1/pmcd.1.html">pmcd(1)</a>, <a href="../man1/pminfo.1.html">pminfo(1)</a>, <a href="../man1/pmstat.1.html">pmstat(1)</a>, <a href="getopt.3.html">getopt(3)</a>,
       <a href="getopt_long.3.html">getopt_long(3)</a>, <a href="pmNewContext.3.html">pmNewContext(3)</a>, <a href="pmGetConfig.3.html">pmGetConfig(3)</a>, <a href="pmprintf.3.html">pmprintf(3)</a>,
       <a href="pmflush.3.html">pmflush(3)</a> and <a href="PMAPI.3.html">PMAPI(3)</a>.
</pre>
<h2><a id="COLOPHON" href="pmgetopt_r.3.html#COLOPHON"></a>COLOPHON  &nbsp; &nbsp; &nbsp; &nbsp; <a href="pmgetopt_r.3.html#top_of_page"><span class="top-link">top</span></a></h2><pre>
       This page is part of the <i>PCP</i> (Performance Co-Pilot) project.
       Information about the project can be found at ⟨<a href="http://www.pcp.io/">http://www.pcp.io/</a>⟩.
       If you have a bug report for this manual page, send it to
       pcp@groups.io.  This page was obtained from the project's upstream
       Git repository ⟨<a href="https://github.com/performancecopilot/pcp.git">https://github.com/performancecopilot/pcp.git</a>⟩ on
       2018-02-02.  (At that time, the date of the most recent commit that
       was found in the repository was 2018-02-02.)  If you discover any
       rendering problems in this HTML version of the page, or you believe
       there is a better or more up-to-date source for the page, or you have
       corrections or improvements to the information in this COLOPHON
       (which is <i>not</i> part of the original manual page), send a mail to
       man-pages@man7.org

<span class="footline">Performance Co-Pilot                 PCP                     PMGETOPTIONS(3)</span>
</pre>

<hr class="end-man-text" />
<p>Pages that refer to this page: 
    <a href="../man1/pcp2elasticsearch.1.html">pcp2elasticsearch(1)</a>,&nbsp; 
    <a href="../man1/pcp2graphite.1.html">pcp2graphite(1)</a>,&nbsp; 
    <a href="../man1/pcp2influxdb.1.html">pcp2influxdb(1)</a>,&nbsp; 
    <a href="../man1/pcp2json.1.html">pcp2json(1)</a>,&nbsp; 
    <a href="../man1/pcp2xlsx.1.html">pcp2xlsx(1)</a>,&nbsp; 
    <a href="../man1/pcp2xml.1.html">pcp2xml(1)</a>,&nbsp; 
    <a href="../man1/pcp2zabbix.1.html">pcp2zabbix(1)</a>,&nbsp; 
    <a href="../man1/pmgetopt.1.html">pmgetopt(1)</a>,&nbsp; 
    <a href="../man1/pmrep.1.html">pmrep(1)</a>,&nbsp; 
    <a href="pmdagetoptions.3.html">pmdagetoptions(3)</a>,&nbsp; 
    <a href="pmgetoptions.3.html">pmgetoptions(3)</a>,&nbsp; 
    <a href="../man5/pmrep.conf.5.html">pmrep.conf(5)</a>
</p>
<hr/>

 
<hr class="start-footer" />

<div class="footer"> 

<table class="colophon-table">
    <tr>
    <td class="pub-info">
        <p>
            HTML rendering created 2018-02-02
            by <a href="http://man7.org/mtk/index.html">Michael Kerrisk</a>, 
            author of 
            <a href="http://man7.org/tlpi/"><em>The Linux Programming Interface</em></a>, 
            maintainer of the 
            <a href="https://www.kernel.org/doc/man-pages/">Linux <em>man-pages</em> project</a>.
        </p>
        <p>
            For details of in-depth
            <strong>Linux/UNIX system programming training courses</strong>
            that I teach, look <a href="http://man7.org/training/">here</a>.
        </p>
        <p>
            Hosting by <a href="http://www.jambit.com/index_en.html">jambit GmbH</a>.
        </p>
        <p>
            <a href="http://validator.w3.org/check?uri=referer">
            <img src="http://www.w3.org/Icons/valid-xhtml11"
                alt="Valid XHTML 1.1" height="31" width="88" />
            </a>
        </p>
    </td>
    <td class="colophon-divider">
    </td>
    <td class="tlpi-cover">
        <a href="http://man7.org/tlpi/"><img src="../../../tlpi/cover/TLPI-front-cover-vsmall.png" alt="Cover of TLPI" /></a>
    </td>
    </tr>
</table>

</div>

<hr class="end-footer" />



<!--BEGIN-SITETRACKING-->
<!-- SITETRACKING.man7.org_linux_man-pages -->

<!-- Start of StatCounter Code (xhtml) -->

<script type="text/javascript">
//<![CDATA[
var sc_project=7422636; 
var sc_invisible=1; 
var sc_security="9b6714ff"; 
//]]>
</script>
<script type="text/javascript"
src="http://www.statcounter.com/counter/counter_xhtml.js"></script>
<noscript><div class="statcounter"><a title="website
statistics" href="http://statcounter.com/"
class="statcounter"><img class="statcounter"
src="http://c.statcounter.com/7422636/0/9b6714ff/1/"
alt="website statistics" /></a></div></noscript>

<!-- End of StatCounter Code -->


<!-- Start of Google Analytics Code -->

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-9830363-8']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

<!-- End of Google Analytics Code -->

<!--END-SITETRACKING-->

</body>
</html>
