getopt_long.c File Reference

#include <stdlib.h>
#include <string.h>

Include dependency graph for getopt_long.c:

Go to the source code of this file.

Defines

#define _CRT_SECURE_NO_WARNINGS   1
#define _DIAGASSERT(X)
#define IGNORE_FIRST   (*options == '-' || *options == '+')
#define PRINT_ERROR
#define IS_POSIXLY_CORRECT   (getenv("POSIXLY_CORRECT") != NULL)
#define PERMUTE   (!IS_POSIXLY_CORRECT && !IGNORE_FIRST)
#define IN_ORDER   (!IS_POSIXLY_CORRECT && *options == '-')
#define BADCH   (int)'?'
#define BADARG
#define INORDER   (int)1
#define EMSG   ""

Functions

static int getopt_internal (int, char *const *, const char *)
static int gcd (int, int)
static void permute_args (int, int, int, char *const *)
int getopt_long (int nargc, char *const *nargv, const char *options, const struct option *long_options, int *idx)

Variables

static char * place = EMSG
static int nonopt_start = -1
static int nonopt_end = -1
static const char recargchar [] = "option requires an argument -- %c"
static const char recargstring [] = "option requires an argument -- %s"
static const char ambig [] = "ambiguous option -- %.*s"
static const char noarg [] = "option doesn't take an argument -- %.*s"
static const char illoptchar [] = "unknown option -- %c"
static const char illoptstring [] = "unknown option -- %s"


Define Documentation

#define _CRT_SECURE_NO_WARNINGS   1

Definition at line 41 of file getopt_long.c.

#define _DIAGASSERT ( X   ) 

Definition at line 80 of file getopt_long.c.

#define BADARG

Value:

((IGNORE_FIRST && options[1] == ':') \
             || (*options == ':') ? (int)':' : (int)'?')

Definition at line 115 of file getopt_long.c.

#define BADCH   (int)'?'

Definition at line 114 of file getopt_long.c.

#define EMSG   ""

Definition at line 119 of file getopt_long.c.

#define IGNORE_FIRST   (*options == '-' || *options == '+')

Definition at line 105 of file getopt_long.c.

#define IN_ORDER   (!IS_POSIXLY_CORRECT && *options == '-')

Definition at line 111 of file getopt_long.c.

#define INORDER   (int)1

Definition at line 117 of file getopt_long.c.

#define IS_POSIXLY_CORRECT   (getenv("POSIXLY_CORRECT") != NULL)

Definition at line 108 of file getopt_long.c.

#define PERMUTE   (!IS_POSIXLY_CORRECT && !IGNORE_FIRST)

Definition at line 109 of file getopt_long.c.

#define PRINT_ERROR

Value:

((opterr) && ((*options != ':') \
                      || (IGNORE_FIRST && options[1] != ':')))

Definition at line 106 of file getopt_long.c.


Function Documentation

static int gcd ( int  a,
int  b 
) [static]

Definition at line 144 of file getopt_long.c.

Here is the caller graph for this function:

static int getopt_internal ( int  nargc,
char *const *  nargv,
const char *  options 
) [static]

Definition at line 208 of file getopt_long.c.

References _DIAGASSERT, BADARG, BADCH, EMSG, IGNORE_FIRST, IN_ORDER, INORDER, PERMUTE, permute_args(), and PRINT_ERROR.

Here is the caller graph for this function:

int getopt_long ( int  nargc,
char * const *  nargv,
const char *  options,
const struct option long_options,
int *  idx 
)

Definition at line 398 of file getopt_long.c.

References _DIAGASSERT, BADARG, BADCH, EMSG, option::flag, getopt_internal(), option::name, no_argument, optional_argument, permute_args(), PRINT_ERROR, required_argument, and option::val.

Here is the caller graph for this function:

static void permute_args ( int  panonopt_start,
int  panonopt_end,
int  opt_end,
char *const *  nargv 
) [static]

Definition at line 166 of file getopt_long.c.

References _DIAGASSERT, gcd(), pos(), and std::swap().

Here is the caller graph for this function:


Variable Documentation

const char ambig[] = "ambiguous option -- %.*s" [static]

Definition at line 134 of file getopt_long.c.

const char illoptchar[] = "unknown option -- %c" [static]

Definition at line 136 of file getopt_long.c.

const char illoptstring[] = "unknown option -- %s" [static]

Definition at line 137 of file getopt_long.c.

const char noarg[] = "option doesn't take an argument -- %.*s" [static]

Definition at line 135 of file getopt_long.c.

int nonopt_end = -1 [static]

Definition at line 129 of file getopt_long.c.

int nonopt_start = -1 [static]

Definition at line 128 of file getopt_long.c.

char* place = EMSG [static]

Definition at line 125 of file getopt_long.c.

const char recargchar[] = "option requires an argument -- %c" [static]

Definition at line 132 of file getopt_long.c.

const char recargstring[] = "option requires an argument -- %s" [static]

Definition at line 133 of file getopt_long.c.


Generated on Fri Dec 4 23:23:52 2009 for OpenCog Framework by  doxygen 1.5.6