libusual  0.1
Data Structures | Defines | Functions | Variables
usual/getopt.h File Reference

getopt compat. More...

Data Structures

struct  option
 Long option description. More...

Defines

#define no_argument
 long option takes no argument
#define required_argument
 long option requires argument
#define optional_argument
 long option has optional argument

Functions

int getopt (int argc, char *argv[], const char *options)
 Compat: getopt.
int getopt_long (int argc, char *argv[], const char *options, const struct option *longopts, int *longindex)
 Compat: getopt_long.
int getopt_long_only (int nargc, char *argv[], const char *options, const struct option *long_options, int *idx)
 Compat: getopt_long_only.

Variables

char * optarg
 argument to current option, or NULL if it has none
int optind
 Current position in arg string.
int opterr
 whether getopt() should print error messages on problems.
int optopt
 Option char which caused error.

Detailed Description

getopt compat.

This module provides getopt() and getopt_long().


Define Documentation

#define no_argument

long option takes no argument

long option requires argument

long option has optional argument


Function Documentation

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

Compat: getopt.

int getopt_long ( int  argc,
char *  argv[],
const char *  options,
const struct option longopts,
int *  longindex 
)

Compat: getopt_long.

int getopt_long_only ( int  nargc,
char *  argv[],
const char *  options,
const struct option long_options,
int *  idx 
)

Compat: getopt_long_only.


Variable Documentation

char* optarg

argument to current option, or NULL if it has none

int optind

Current position in arg string.

Starts from 1. Setting to 0 resets state.

int opterr

whether getopt() should print error messages on problems.

Default: 1.

int optopt

Option char which caused error.