-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathcmdline.h
More file actions
28 lines (24 loc) · 541 Bytes
/
cmdline.h
File metadata and controls
28 lines (24 loc) · 541 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef CMDLINE_H_
#define CMDLINE_H_
struct cmdline_option {
int opt_char;
char *opt_long;
char *opt_help;
char *arg_name;
enum {
TYPE_END = 0,
TYPE_SWITCH,
TYPE_REQUIRED,
TYPE_OPTIONAL
} option_type;
enum {
TYPE_NONE,
TYPE_INT,
TYPE_FLOAT,
TYPE_STRING
} option_argument_type;
void *target;
};
#define CMDLINE_ARG_TERMINATOR { 0, 0, 0, 0, TYPE_END, 0, 0 }
int cmdline_parse_args(int argc, char **argv, struct cmdline_option opts[], int num_required_args, int max_args, char *args_text);
#endif /* CMDLINE_H_ */