CUBRID Engine  latest
cubrid_getopt_long.c File Reference
#include <assert.h>
#include "config.h"
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cubrid_getopt.h"
Include dependency graph for cubrid_getopt_long.c:

Go to the source code of this file.

Macros

#define REPLACE_GETOPT
 
#define _DIAGASSERT(e)
 
#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   (int)':'
 
#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 *)
 
static void xwarnx (const char *,...)
 
int getopt (int nargc, char *const *nargv, const char *options)
 
int getopt_long (int nargc, char *const *nargv, const char *options, const struct option *long_options, int *idx)
 

Variables

int opterr = 1
 
int optind = 1
 
int optopt = '?'
 
int optreset
 
char * optarg = NULL
 
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 [] = "illegal option -- %c"
 
static const char illoptstring [] = "illegal option -- %s"
 
static const char * progname
 

Macro Definition Documentation

#define _DIAGASSERT (   e)

Definition at line 44 of file cubrid_getopt_long.c.

Referenced by getopt_internal(), and getopt_long().

#define BADARG   (int)':'

Definition at line 70 of file cubrid_getopt_long.c.

Referenced by getopt_internal(), and getopt_long().

#define BADCH   (int)'?'

Definition at line 69 of file cubrid_getopt_long.c.

Referenced by getopt_internal(), and getopt_long().

#define EMSG   ""

Definition at line 72 of file cubrid_getopt_long.c.

Referenced by getopt_internal(), and getopt_long().

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

Definition at line 61 of file cubrid_getopt_long.c.

Referenced by getopt_internal().

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

Definition at line 67 of file cubrid_getopt_long.c.

Referenced by getopt_internal().

#define INORDER   (int)1

Definition at line 71 of file cubrid_getopt_long.c.

Referenced by getopt_internal().

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

Definition at line 64 of file cubrid_getopt_long.c.

#define PERMUTE   (!IS_POSIXLY_CORRECT && !IGNORE_FIRST)

Definition at line 65 of file cubrid_getopt_long.c.

Referenced by getopt_internal().

#define PRINT_ERROR
Value:
((opterr) && ((*options != ':') \
|| (IGNORE_FIRST && options[1] != ':')))
#define IGNORE_FIRST
int opterr

Definition at line 62 of file cubrid_getopt_long.c.

Referenced by getopt_internal(), and getopt_long().

#define REPLACE_GETOPT

Definition at line 41 of file cubrid_getopt_long.c.

Function Documentation

static int gcd ( int  a,
int  b 
)
static

Definition at line 113 of file cubrid_getopt_long.c.

Referenced by permute_args().

Here is the caller graph for this function:

int getopt ( int  nargc,
char *const nargv,
const char *  options 
)

Definition at line 331 of file cubrid_getopt_long.c.

References getopt_internal(), nonopt_start, optind, and permute_args().

Referenced by admin_getid_cmd(), get_args(), and main().

Here is the caller graph for this function:

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

Definition at line 172 of file cubrid_getopt_long.c.

References _DIAGASSERT, BADARG, BADCH, EMSG, IGNORE_FIRST, IN_ORDER, INORDER, nonopt_start, NULL, optind, PERMUTE, permute_args(), place, PRINT_ERROR, and xwarnx().

Referenced by getopt(), and getopt_long().

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 
)
static void permute_args ( int  nonopt_start,
int  nonopt_end,
int  opt_end,
char *const nargv 
)
static

Definition at line 134 of file cubrid_getopt_long.c.

References gcd(), i, nonopt_end, and nonopt_start.

Referenced by getopt(), getopt_internal(), and getopt_long().

Here is the caller graph for this function:

static void xwarnx ( const char *  fmt,
  ... 
)
static

Definition at line 96 of file cubrid_getopt_long.c.

Referenced by getopt_internal(), and getopt_long().

Here is the caller graph for this function:

Variable Documentation

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

Definition at line 87 of file cubrid_getopt_long.c.

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

Definition at line 89 of file cubrid_getopt_long.c.

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

Definition at line 90 of file cubrid_getopt_long.c.

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

Definition at line 88 of file cubrid_getopt_long.c.

int nonopt_end = -1
static

Definition at line 82 of file cubrid_getopt_long.c.

Referenced by permute_args().

int nonopt_start = -1
static

Definition at line 81 of file cubrid_getopt_long.c.

Referenced by getopt(), getopt_internal(), getopt_long(), and permute_args().

int opterr = 1

Definition at line 51 of file cubrid_getopt_long.c.

int optopt = '?'

Definition at line 53 of file cubrid_getopt_long.c.

int optreset

Definition at line 54 of file cubrid_getopt_long.c.

char* place = EMSG
static

Definition at line 78 of file cubrid_getopt_long.c.

Referenced by getopt_internal(), and getopt_long().

const char* progname
static

Definition at line 92 of file cubrid_getopt_long.c.

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

Definition at line 85 of file cubrid_getopt_long.c.

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

Definition at line 86 of file cubrid_getopt_long.c.