DPsim
Loading...
Searching...
No Matches
getopt.h File Reference
#include <crtdefs.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
Include dependency graph for getopt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  option
 

Macros

#define __GETOPT_H__
 
#define REPLACE_GETOPT   /* use this getopt as the system getopt(3) */
 
#define optreset   __mingw_optreset
 
#define PRINT_ERROR   ((opterr) && (*options != ':'))
 
#define FLAG_PERMUTE   0x01 /* permute non-options to the end of argv */
 
#define FLAG_ALLARGS   0x02 /* treat non-options as args to option "-1" */
 
#define FLAG_LONGONLY   0x04 /* operate as getopt_long_only */
 
#define BADCH   (int)'?'
 
#define BADARG   ((*options == ':') ? (int)':' : (int)'?')
 
#define INORDER   (int)1
 
#define __progname   __argv[0]
 
#define EMSG   ""
 
#define __GETOPT_LONG_H__
 
#define IDENTICAL_INTERPRETATION(_x, _y)
 
#define HAVE_DECL_GETOPT   1
 

Enumerations

enum  { no_argument = 0 , required_argument , optional_argument }
 

Functions

static int getopt_internal (int, char *const *, const char *, const struct option *, int *, int)
 
static int parse_long_options (char *const *, const char *, const struct option *, int *, int)
 
static int gcd (int, int)
 
static void permute_args (int, int, int, char *const *)
 
static void _vwarnx (const char *fmt, va_list ap)
 
static void warnx (const char *fmt,...)
 
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)
 
int getopt_long_only (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
 
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"
 

Macro Definition Documentation

◆ __GETOPT_H__

#define __GETOPT_H__

DISCLAIMER This file is part of the mingw-w64 runtime package.

The mingw-w64 runtime package and its code is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Definition at line 62 of file getopt.h.

◆ __GETOPT_LONG_H__

#define __GETOPT_LONG_H__

Definition at line 246 of file getopt.h.

◆ __progname

#define __progname   __argv[0]

Definition at line 101 of file getopt.h.

◆ BADARG

#define BADARG   ((*options == ':') ? (int)':' : (int)'?')

Definition at line 97 of file getopt.h.

◆ BADCH

#define BADCH   (int)'?'

Definition at line 96 of file getopt.h.

◆ EMSG

#define EMSG   ""

Definition at line 109 of file getopt.h.

◆ FLAG_ALLARGS

#define FLAG_ALLARGS   0x02 /* treat non-options as args to option "-1" */

Definition at line 92 of file getopt.h.

◆ FLAG_LONGONLY

#define FLAG_LONGONLY   0x04 /* operate as getopt_long_only */

Definition at line 93 of file getopt.h.

◆ FLAG_PERMUTE

#define FLAG_PERMUTE   0x01 /* permute non-options to the end of argv */

Definition at line 91 of file getopt.h.

◆ HAVE_DECL_GETOPT

#define HAVE_DECL_GETOPT   1

Definition at line 611 of file getopt.h.

◆ IDENTICAL_INTERPRETATION

#define IDENTICAL_INTERPRETATION ( _x,
_y )
Value:
(long_options[(_x)].has_arg == long_options[(_y)].has_arg && \
long_options[(_x)].flag == long_options[(_y)].flag && \
long_options[(_x)].val == long_options[(_y)].val)

◆ INORDER

#define INORDER   (int)1

Definition at line 98 of file getopt.h.

◆ optreset

#define optreset   __mingw_optreset

Definition at line 84 of file getopt.h.

◆ PRINT_ERROR

#define PRINT_ERROR   ((opterr) && (*options != ':'))

Definition at line 89 of file getopt.h.

◆ REPLACE_GETOPT

#define REPLACE_GETOPT   /* use this getopt as the system getopt(3) */

Definition at line 77 of file getopt.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
no_argument 
required_argument 
optional_argument 

Definition at line 260 of file getopt.h.

Function Documentation

◆ _vwarnx()

static void _vwarnx ( const char * fmt,
va_list ap )
static

Definition at line 133 of file getopt.h.

◆ gcd()

static int gcd ( int a,
int b )
static

Definition at line 150 of file getopt.h.

◆ getopt()

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

Definition at line 205 of file getopt.h.

◆ getopt_internal()

static int getopt_internal ( int nargc,
char *const * nargv,
const char * options,
const struct option * long_options,
int * idx,
int flags )
static

Definition at line 393 of file getopt.h.

◆ getopt_long()

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

Definition at line 582 of file getopt.h.

◆ getopt_long_only()

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

Definition at line 593 of file getopt.h.

◆ parse_long_options()

static int parse_long_options ( char *const * nargv,
const char * options,
const struct option * long_options,
int * idx,
int short_too )
static

Definition at line 272 of file getopt.h.

◆ permute_args()

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

Definition at line 168 of file getopt.h.

◆ warnx()

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

Definition at line 140 of file getopt.h.

Variable Documentation

◆ ambig

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

Definition at line 128 of file getopt.h.

◆ illoptchar

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

Definition at line 130 of file getopt.h.

◆ illoptstring

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

Definition at line 131 of file getopt.h.

◆ noarg

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

Definition at line 129 of file getopt.h.

◆ nonopt_end

int nonopt_end = -1
static

Definition at line 123 of file getopt.h.

◆ nonopt_start

int nonopt_start = -1
static

Definition at line 122 of file getopt.h.

◆ optarg

char* optarg

Definition at line 86 of file getopt.h.

◆ opterr

int opterr = 1

Definition at line 80 of file getopt.h.

◆ optind

int optind = 1

Definition at line 81 of file getopt.h.

◆ optopt

int optopt = '?'

Definition at line 82 of file getopt.h.

◆ optreset

int optreset

Definition at line 85 of file getopt.h.

◆ place

char* place = EMSG
static

Definition at line 119 of file getopt.h.

◆ recargchar

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

Definition at line 126 of file getopt.h.

◆ recargstring

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

Definition at line 127 of file getopt.h.