btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / bin / safemode.c
blobb91815740c2beaf3da49c87f1b4cd41fd8328e8a
1 /*
2 * (c) 2004, Jérôme DUVAL for Haiku
3 * released under the MIT licence.
4 */
7 #include <drivers/driver_settings.h>
8 #include <syscalls.h>
10 #include <stdio.h>
11 #include <strings.h>
14 int
15 main(int argc, char **argv)
17 const char *optionName = B_SAFEMODE_SAFE_MODE;
18 bool realString = false;
19 char buffer[B_FILE_NAME_LENGTH];
20 size_t size = sizeof(buffer);
21 status_t status;
22 int i;
24 for (i = 1; i < argc; i++) {
25 if (!strcmp(argv[i], "-s"))
26 realString = true;
27 else
28 optionName = argv[i];
31 status = _kern_get_safemode_option(optionName, buffer, &size);
32 if (status == B_OK) {
33 if (realString) {
34 puts(buffer);
35 return 0;
37 if (!strncasecmp(buffer, "true", size)
38 || !strncasecmp(buffer, "yes", size)
39 || !strncasecmp(buffer, "on", size)
40 || !strncasecmp(buffer, "enabled", size)) {
41 puts("yes");
42 return 1;
46 puts("no");
47 return 0;