From 12ab71ee40cf613fc6ae703d7f0a761a8876dcd1 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 14 Sep 2024 15:12:36 +0200 Subject: [PATCH] libos: Support comments in config files --- base/etc/loginui.conf | 3 +++ libos/src/Config.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/base/etc/loginui.conf b/base/etc/loginui.conf index d8fc61ae..9a514af7 100644 --- a/base/etc/loginui.conf +++ b/base/etc/loginui.conf @@ -1,2 +1,5 @@ +# Configuration file for loginui. +# If this parameter is set to "true", loginui automatically spawns a UI session as the below user instead of prompting for a username and password. Autologin=true +# The user to create a session for if "Autologin" is set to true (see above). If the username is invalid, loginui will behave as if "Autologin" was set to false. AutologinUser=selene diff --git a/libos/src/Config.cpp b/libos/src/Config.cpp index c2482ce4..6f2d854d 100644 --- a/libos/src/Config.cpp +++ b/libos/src/Config.cpp @@ -28,6 +28,9 @@ namespace os line.trim("\n"); if (line.is_empty()) continue; + // Skip comment lines. + if (line[0] == '#') continue; + auto parts = TRY(line.split_once('=')); if (parts.size() < 2 || parts[0].is_empty() || parts[1].is_empty()) return err(EINVAL);