]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Make plymouth_should_be_running() be less manual, and add " init=" handler.
authorPeter Jones <pjones@redhat.com>
Wed, 4 Jun 2008 16:55:32 +0000 (12:55 -0400)
committerPeter Jones <pjones@pjones2.localdomain>
Wed, 4 Jun 2008 16:55:32 +0000 (12:55 -0400)
src/main.c

index a491004559d01ae81dda1b81708f4ce38aa01e8d..a3bf3b5a3278b48df167615fb1b5dcf79394487a 100644 (file)
@@ -415,22 +415,23 @@ plymouth_should_be_running (state_t *state)
 {
   ply_trace ("checking if plymouth should be running");
 
-  if ((strstr (state->kernel_command_line, " single ") != NULL)
-    || (strstr (state->kernel_command_line, "single ") != NULL)
-    || (strstr (state->kernel_command_line, " single") != NULL))
-    {
-      ply_trace ("kernel command line has option 'single'");
-      return false;
-    }
+  const char const *strings[] = {
+      " single ", " single", "single ",
+      " 1 ", " 1", "1 ",
+      " init=",
+      NULL
+  };
+  int i;
 
-  if ((strstr (state->kernel_command_line, " 1 ") != NULL)
-    || (strstr (state->kernel_command_line, "1 ") != NULL)
-    || (strstr (state->kernel_command_line, " 1") != NULL))
+  for (i = 0; strings[i] != NULL; i++)
     {
-      ply_trace ("kernel command line has option '1'");
-      return false;
+      if (strstr (state->kernel_command_line, strings[i]) != NULL)
+        {
+          ply_trace ("kernel command line has option \"%s\"", strings[i]);
+          return false;
+        }
     }
-
+  
   return true;
 }