IOR
src
option.h
Go to the documentation of this file.
1
#ifndef _IOR_OPTION_H
2
#define _IOR_OPTION_H
3
4
#include <stdint.h>
5
6
/*
7
* Initial version by JK
8
*/
9
10
typedef
enum
{
11
OPTION_FLAG
,
12
OPTION_OPTIONAL_ARGUMENT
,
13
OPTION_REQUIRED_ARGUMENT
14
}
option_value_type
;
15
16
typedef
struct
{
17
char
shortVar
;
18
char
*
longVar
;
19
char
*
help
;
20
21
option_value_type
arg
;
22
char
type
;
// data type, H = hidden string
23
void
*
variable
;
24
}
option_help
;
25
26
typedef
struct
{
27
char
*
prefix
;
// may be NULL to include it in the standard name
28
option_help
*
options
;
29
}
option_module
;
30
31
typedef
struct
{
32
int
module_count
;
33
option_module
*
modules
;
34
}
options_all
;
35
36
#define LAST_OPTION {0, 0, 0, (option_value_type) 0, 0, NULL}
37
38
int64_t
string_to_bytes
(
char
*size_str);
39
void
option_print_current
(
option_help
* args);
40
41
//@return the number of parsed arguments
42
int
option_parse
(
int
argc,
char
** argv,
options_all
* args);
43
44
#endif
options_all
Definition:
option.h:31
option_parse
int option_parse(int argc, char **argv, options_all *args)
Definition:
option.c:223
option_value_type
option_value_type
Definition:
option.h:10
string_to_bytes
int64_t string_to_bytes(char *size_str)
Definition:
option.c:13
option_help::variable
void * variable
Definition:
option.h:23
options_all::modules
option_module * modules
Definition:
option.h:33
OPTION_OPTIONAL_ARGUMENT
Definition:
option.h:12
option_help
Definition:
option.h:16
OPTION_FLAG
Definition:
option.h:11
option_help::longVar
char * longVar
Definition:
option.h:18
options_all::module_count
int module_count
Definition:
option.h:32
option_help::shortVar
char shortVar
Definition:
option.h:17
option_help::arg
option_value_type arg
Definition:
option.h:21
option_help::help
char * help
Definition:
option.h:19
option_module::options
option_help * options
Definition:
option.h:28
option_module::prefix
char * prefix
Definition:
option.h:27
OPTION_REQUIRED_ARGUMENT
Definition:
option.h:13
option_help::type
char type
Definition:
option.h:22
option_print_current
void option_print_current(option_help *args)
Definition:
option.c:217
option_module
Definition:
option.h:26
Generated by
1.8.13