| 1 |
/** @file getopt_long.h |
| 2 |
** @brief getopt_long |
| 3 |
** @author Andrea Vedaldi |
| 4 |
**/ |
| 5 |
|
| 6 |
/* |
| 7 |
Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. |
| 8 |
All rights reserved. |
| 9 |
|
| 10 |
This file is part of the VLFeat library and is made available under |
| 11 |
the terms of the BSD license (see the COPYING file). |
| 12 |
*/ |
| 13 |
|
| 14 |
#ifndef VL_GETOPT_LONG_H |
| 15 |
#define VL_GETOPT_LONG_H |
| 16 |
|
| 17 |
#include "generic.h" |
| 18 |
|
| 19 |
VL_EXPORT int opterr ; /**< code of the last error occured while parsing an option */ |
| 20 |
VL_EXPORT int optind ; /**< index of the next option to process in @c argv */ |
| 21 |
VL_EXPORT int optopt ; /**< current option */ |
| 22 |
VL_EXPORT char * optarg ; /**< argument of the current option */ |
| 23 |
VL_EXPORT int optreset ; /**< reset flag */ |
| 24 |
|
| 25 |
/** @brief ::getopt_long option */ |
| 26 |
struct option |
| 27 |
{ |
| 28 |
const char *name ; /**< option long name */ |
| 29 |
int has_arg ; /**< flag indicating whether the option has no, required or optional argument */ |
| 30 |
int *flag ; /**< pointer to a variable to set (if @c NULL, the value is returned instead) */ |
| 31 |
int val ; /**< value to set or to return */ |
| 32 |
} ; |
| 33 |
|
| 34 |
#define no_argument 0 /**< ::option with no argument */ |
| 35 |
#define required_argument 1 /**< ::option with required argument */ |
| 36 |
#define optional_argument 2 /**< ::option with optional argument */ |
| 37 |
|
| 38 |
VL_EXPORT int getopt_long(int argc, char * const argv[], |
| 39 |
const char * optstring, |
| 40 |
const struct option * longopts, int * longindex); |
| 41 |
|
| 42 |
/* VL_GETOPT_LONG_H */ |
| 43 |
#endif |