xref: /haiku/src/bin/safemode.c (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 /*
2  * (c) 2004, Jérôme DUVAL for Haiku
3  * released under the MIT licence.
4  */
5 
6 
7 #include <drivers/driver_settings.h>
8 #include <syscalls.h>
9 
10 #include <stdio.h>
11 #include <strings.h>
12 
13 
14 int
15 main(int argc, char **argv)
16 {
17 	char buffer[B_FILE_NAME_LENGTH];
18 	size_t size = sizeof(buffer);
19 
20 	status_t status = _kern_get_safemode_option(B_SAFEMODE_SAFE_MODE, buffer, &size);
21 	if (status == B_OK) {
22 		if (!strncasecmp(buffer, "true", size)
23 			|| !strncasecmp(buffer, "yes", size)
24 			|| !strncasecmp(buffer, "on", size)
25 			|| !strncasecmp(buffer, "enabled", size)) {
26 			puts("yes");
27 			return 1;
28 		}
29 	}
30 
31 	puts("no");
32 	return 0;
33 }
34 
35