From d594d16e241066b1caa88a411ee561429025ecde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 3 Aug 2009 16:25:41 +0000 Subject: [PATCH] Allow getting other safe mode settings than the default one, from command line. Added a -s option to get the string value of the setting directly instead of interpreting it as bool. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32086 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/safemode.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/bin/safemode.c b/src/bin/safemode.c index 0c2dcb94a4..3b690dda21 100644 --- a/src/bin/safemode.c +++ b/src/bin/safemode.c @@ -14,11 +14,25 @@ int main(int argc, char **argv) { + const char *optionName = B_SAFEMODE_SAFE_MODE; + bool realString = false; char buffer[B_FILE_NAME_LENGTH]; size_t size = sizeof(buffer); + int i; - status_t status = _kern_get_safemode_option(B_SAFEMODE_SAFE_MODE, buffer, &size); + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-s")) + realString = true; + else + optionName = argv[i]; + } + + status_t status = _kern_get_safemode_option(optionName, buffer, &size); if (status == B_OK) { + if (realString) { + puts(buffer); + return 0; + } if (!strncasecmp(buffer, "true", size) || !strncasecmp(buffer, "yes", size) || !strncasecmp(buffer, "on", size)