Microchip® Advanced Software Framework

getopt.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>

Typedefs

typedef enum GETOPT_ORDERING_T GETOPT_ORDERING_T
 

Enumerations

enum  GETOPT_ORDERING_T {
  PERMUTE,
  RETURN_IN_ORDER,
  REQUIRE_ORDER
}
 

Functions

int getopt (int argc, char *const argv[], const char *optstring)
 
static int getopt_internal (int argc, char *const argv[], const char *shortopts, const struct option *longopts, int *longind, int only)
 
int getopt_long (int argc, char *const argv[], const char *shortopts, const struct option *longopts, int *longind)
 
int getopt_long_only (int argc, char *const argv[], const char *shortopts, const struct option *longopts, int *longind)
 
static int is_option (char *argv_element, int only)
 
static void permute (char *const argv[], int len1, int len2)
 
static void reverse_argv_elements (char **argv, int num)
 

Variables

char * optarg = NULL
 
int opterr = 1
 
int optind = 0
 
int optopt = '?'
 

Enumerator
PERMUTE 
RETURN_IN_ORDER 
REQUIRE_ORDER 

int getopt ( int  argc,
char *const  argv[],
const char *  optstring 
)

References getopt_internal(), and NULL.

Referenced by cmd_ttcp(), and init_ping_info().

static int getopt_internal ( int  argc,
char *const  argv[],
const char *  shortopts,
const struct option longopts,
int *  longind,
int  only 
)
static
int getopt_long ( int  argc,
char *const  argv[],
const char *  shortopts,
const struct option longopts,
int *  longind 
)

References getopt_internal().

int getopt_long_only ( int  argc,
char *const  argv[],
const char *  shortopts,
const struct option longopts,
int *  longind 
)

References getopt_internal().

static int is_option ( char *  argv_element,
int  only 
)
static

References NULL.

Referenced by getopt_internal().

static void permute ( char *const  argv[],
int  len1,
int  len2 
)
static

References reverse_argv_elements().

Referenced by getopt_internal().

static void reverse_argv_elements ( char **  argv,
int  num 
)
static

References i, and tmp.

Referenced by permute().

char* optarg = NULL
int opterr = 1

Referenced by getopt_internal().

int optind = 0
int optopt = '?'

Referenced by getopt_internal().