-
Notifications
You must be signed in to change notification settings - Fork 0
/
hc_private.h
28 lines (19 loc) · 994 Bytes
/
hc_private.h
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 HIGH_COMMAND_PRIVATE_H__
#define HIGH_COMMAND_PRIVATE_H__
// private stuffs
#define HC_NEW_META { 0, NULL, NULL, 0, 0, 0, NULL, NULL, NULL }
#define HC_MAX_OPTS_CAPACITY (64)
#define HC_INITIAL_OPTS_CAPACITY (8)
#define HC_RESIZE_AT (80) /* percent */
#define HC_META_NEARING_CAPACITY(meta) ((meta->next_index + 1) > (float) meta->capacity * (HC_RESIZE_AT / 100.0))
#define HC_ARG_ISNT_OPTION(arg) (arg != NULL && (strcmp(arg, "-") == 0 || strcmp(arg, "--") == 0 || arg[0] != '-'))
int hc_resize_opts_array_by_ref(struct hc_meta *meta);
char *hc_get_short_options_by_ref(struct hc_meta *meta);
struct option *hc_get_long_options_by_ref(struct hc_meta *meta);
struct hc_option *hc_get_option_by_ref(struct hc_meta *meta, char short_name);
struct hc_option *hc_get_option_by_ref_long(struct hc_meta *meta, char *long_name);
struct hc_command *hc_get_command_by_ref(struct hc_meta *meta, char *name);
// private utils
int hc_extract_argument(char *name);
void hc_atexit();
#endif