bglibs
include
cli.h
1
#ifndef CLI__H__
2
#define CLI__H__
3
4
enum
cli_option_type {
5
CLI_FLAG,
6
CLI_COUNTER,
7
CLI_INTEGER,
8
CLI_UINTEGER,
9
CLI_STRING,
10
CLI_STRINGLIST,
11
CLI_FUNCTION,
12
CLI_SEPARATOR,
13
};
14
typedef
enum
cli_option_type cli_option_type;
15
16
struct
cli_option
17
{
18
char
ch;
19
const
char
* name;
20
cli_option_type type;
21
int
flag_value;
22
void
* dataptr;
23
const
char
* helpstr;
24
const
char
* defaultstr;
25
};
26
typedef
struct
cli_option
cli_option;
27
28
struct
cli_stringlist
29
{
30
const
char
* string;
31
const
struct
cli_option* option;
32
struct
cli_stringlist
* next;
33
};
34
typedef
struct
cli_stringlist
cli_stringlist;
35
36
typedef
void
cli_function(
const
char
*
string
,
const
struct
cli_option* option);
37
38
/* The following are required from the CLI program */
39
extern
const
char
cli_help_prefix[];
40
extern
const
char
cli_help_suffix[];
41
extern
const
char
cli_args_usage[];
42
extern
const
int
cli_args_min;
43
extern
const
int
cli_args_max;
44
extern
cli_option cli_options[];
45
extern
int
cli_main(
int
argc,
char
** argv);
46
47
/* The following are provided to the CLI program */
48
extern
const
char
* argv0;
49
extern
const
char
* argv0base;
50
extern
const
char
* argv0dir;
51
extern
void
usage(
int
exit_value,
const
char
* errorstr);
52
extern
void
cli_show_help(
void
);
53
54
#endif
cli_stringlist
Definition:
cli.h:28
cli_option
Definition:
cli.h:16
Generated on Fri Feb 23 2018 10:24:53 for bglibs by
1.8.13