mirror of
https://github.com/javalsai/lidm.git
synced 2025-09-03 11:48:00 +02:00
feat: modernize config
- config now is more toml like
- no need to declare all fields, it implements defaults
- no yanderedev code, introspection babbyyy 😎
- desktop and config files parser semi-unification
- misc tweaks all over (mainly allocation failures handling)
This commit is contained in:
11
src/main.c
11
src/main.c
@@ -14,6 +14,7 @@
|
||||
#include "util.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
// Logger
|
||||
char* log_output = getenv("LIDM_LOG");
|
||||
if (log_output) {
|
||||
FILE* log_fd = fopen(log_output, "w");
|
||||
@@ -26,17 +27,17 @@ int main(int argc, char* argv[]) {
|
||||
log_init(log_fd);
|
||||
}
|
||||
|
||||
// Chvt
|
||||
if (argc == 2) chvt_str(argv[1]);
|
||||
|
||||
struct config config = default_config;
|
||||
char* conf_override = getenv("LIDM_CONF");
|
||||
struct config* config =
|
||||
parse_config(conf_override == NULL ? "/etc/lidm.ini" : conf_override);
|
||||
if (config == NULL) {
|
||||
// NOLINT(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling)
|
||||
char* conf_path = conf_override ? conf_override : "/etc/lidm.ini";
|
||||
if (parse_config(&config, conf_path) != 0) {
|
||||
(void)fputs("error parsing config\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
setup(*config);
|
||||
setup(&config);
|
||||
|
||||
struct Vector users = get_human_users();
|
||||
struct Vector sessions = get_avaliable_sessions();
|
||||
|
Reference in New Issue
Block a user