NAME

ACE_Get_Opt - Iterator for parsing command-line arguments.

SYNOPSIS


#include <ace/Get_Opt.h>


class ACE_Get_Opt
{
  public:
    ACE_Get_Opt (
        int argc,
        char **argv,
        char *optstring,
        int skip = 1,
        int report_errors = 0
        );
    int operator () (void);
    char *optarg;
    int optind;
    int opterr;
    int nargc;
    char **nargv;
    char *noptstring;
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  private:
    char *nextchar;
    int first_nonopt;
    int last_nonopt;
};

DESCRIPTION

This version of `get_opt' appears to the caller like standard Unix `get_opt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `get_opt' works, it permutes the elements of `argv' so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable _POSIX_OPTION_ORDER disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments.

Public data members (should be hidden...).

char *optarg;
int optind;
int opterr;

GNU extensions

int nargc;
char **nargv;
char *noptstring;
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;

AUTHOR

Doug Schmidt

LIBRARY

ace