< prev index next >

src/share/vm/services/writeableFlags.cpp

Print this page

        

@@ -91,16 +91,16 @@
   err_msg.print("%s", buffer);
 }
 
 // set a boolean global flag
 Flag::Error WriteableFlags::set_bool_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
-  int value = true;
-
-  if (sscanf(arg, "%d", &value)) {
-    return set_bool_flag(name, value != 0, origin, err_msg);
+  if ((strcasecmp(arg, "true") == 0) || (*arg == '1' && *(arg + 1) == 0)) {
+    return set_bool_flag(name, true, origin, err_msg);
+  } else if ((strcasecmp(arg, "false") == 0) || (*arg == '0' && *(arg + 1) == 0)) {
+    return set_bool_flag(name, false, origin, err_msg);
   }
-  err_msg.print("flag value must be a boolean (1 or 0)");
+  err_msg.print("flag value must be a boolean (1/0 or true/false)");
   return Flag::WRONG_FORMAT;
 }
 
 Flag::Error WriteableFlags::set_bool_flag(const char* name, bool value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
   Flag::Error err = CommandLineFlags::boolAtPut(name, &value, origin);
< prev index next >