blob: 2b1825b56e421024a03dbe0aa76d4cbd193d39a2 (
plain) (
blame)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#ifndef KC_CONFIG_H
#define KC_CONFIG_H
#include <stdbool.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#define PROGRAM_NAME "kl"
#define PROGRAM_FULL_NAME "Keyboard Listener (kl)"
#define PROGRAM_VERSION "0.0.2"
#define PROGRAM_AUTHORS "Verdant <im@verdant.ee>"
#define CFG_FILE_COMMENT \
"# kl config file (v" PROGRAM_VERSION ")\n" \
"#\n" \
"# Please see your README for details.\n" \
"#\n" \
"# This file was auto-generated because it was missing.\n"
#define CFG_COMPLETE(key, val) \
((strcmp((key), (val)) == 0) && ((val)[0] != '\0'))
struct config {
char *home;
char *config_file_path;
char device[256];
bool time;
bool keys_counter;
bool show_shifted;
bool repeat;
};
struct config *parese_config(struct config *cfg);
struct config *prepare_config_file();
struct config *config_init();
typedef enum {
CFG_TYPE_BOOL,
CFG_TYPE_STR,
} cfg_type;
struct config_item {
char *key;
cfg_type type;
size_t offset;
};
extern struct config_item ci[];
void* get_member(struct config_item*, size_t offset);
#define CI_SIZE (int)(sizeof(ci) / sizeof(ci[0]))
#endif
|