diff options
| author | verdant <i@glowisle.me> | 2026-05-17 19:15:38 +0800 |
|---|---|---|
| committer | verdant <i@glowisle.me> | 2026-05-17 19:15:38 +0800 |
| commit | 35576743d13156dd0ccd9dbcbbd66b2cbca29c91 (patch) | |
| tree | 27fa9e1f8c327202f995d411df59d611c7e6ba36 /config.h | |
| parent | 98d39fc8f00ca0331662ae26b3fca8ed20ab49e4 (diff) | |
| download | kl-35576743d13156dd0ccd9dbcbbd66b2cbca29c91.tar.gz kl-35576743d13156dd0ccd9dbcbbd66b2cbca29c91.zip | |
Add config parser and route
Diffstat (limited to 'config.h')
| -rw-r--r-- | config.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/config.h b/config.h new file mode 100644 index 0000000..2911c70 --- /dev/null +++ b/config.h @@ -0,0 +1,36 @@ +#ifndef KC_CONFIG_H +#define KC_CONFIG_H + +#include <stdbool.h> +#include <stdlib.h> +#include <string.h> + +#define PROGRAM_NAME "kl" +#define PROGRAM_FULL_NAME "Keyboard Listener (kl)" +#define PROGRAM_VERSION "0.1.1" +#define PROGRAM_AUTHORS "Verdant <im@verdant.ee>" + +#define CONFIG_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 enable_time; + bool enable_keys_counter; +}; + +struct config* parese_config(struct config* cfg); + +struct config* prepare_config_file(); + +struct config* config_init(); + + +#endif |
