Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmergrid/src/metis-5.1.0/GKlib/gk_getopt.h
3206 views
1
/*!
2
\file gk_getopt.h
3
\brief This file contains GNU's externs/structs/prototypes
4
5
\date Started 3/27/2007
6
\author George
7
\version\verbatim $Id: gk_getopt.h 10711 2011-08-31 22:23:04Z karypis $ \endverbatim
8
*/
9
10
#ifndef _GK_GETOPT_H_
11
#define _GK_GETOPT_H_
12
13
14
/* Externals from getopt.c */
15
extern char *gk_optarg;
16
extern int gk_optind;
17
extern int gk_opterr;
18
extern int gk_optopt;
19
20
21
/*! \brief The structure that stores the information about the command-line options
22
23
This structure describes a single long option name for the sake of
24
gk_getopt_long(). The argument <tt>long_options</tt> must be an array
25
of these structures, one for each long option. Terminate the array with
26
an element containing all zeros.
27
*/
28
struct gk_option {
29
char *name; /*!< This field is the name of the option. */
30
int has_arg; /*!< This field says whether the option takes an argument.
31
It is an integer, and there are three legitimate values:
32
no_argument, required_argument and optional_argument.
33
*/
34
int *flag; /*!< See the discussion on ::gk_option#val */
35
int val; /*!< These fields control how to report or act on the option
36
when it occurs.
37
38
If flag is a null pointer, then the val is a value which
39
identifies this option. Often these values are chosen
40
to uniquely identify particular long options.
41
42
If flag is not a null pointer, it should be the address
43
of an int variable which is the flag for this option.
44
The value in val is the value to store in the flag to
45
indicate that the option was seen. */
46
};
47
48
/* Names for the values of the `has_arg' field of `struct gk_option'. */
49
#define no_argument 0
50
#define required_argument 1
51
#define optional_argument 2
52
53
54
/* Function prototypes */
55
#ifndef __MINGW32__
56
extern int gk_getopt(int __argc, char **__argv, char *__shortopts);
57
extern int gk_getopt_long(int __argc, char **__argv, char *__shortopts,
58
struct gk_option *__longopts, int *__longind);
59
extern int gk_getopt_long_only (int __argc, char **__argv,
60
char *__shortopts, struct gk_option *__longopts, int *__longind);
61
#endif
62
63
64
65
#endif
66
67
68