+ /* Check for required arguments. */
+ for (i = 1; i < a->argc; i++)
+ if (argv[i] == NULL)
+ PANIC ("action `%s' requires %d argument(s)", *argv, a->argc - 1);
+
+ /* Invoke action and advance. */
+ a->function (argv);
+ argv += a->argc;
+ }
+
+}
+
+/* Prints a kernel command line help message and powers off the
+ machine. */
+static void
+usage (void)
+{
+ printf ("\nCommand line syntax: [OPTION...] [ACTION...]\n"
+ "Options must precede actions.\n"
+ "Actions are executed in the order specified.\n"
+ "\nAvailable actions:\n"
+#ifdef USERPROG
+ " run 'PROG [ARG...]' Run PROG and wait for it to complete.\n"
+#else
+ " run TEST Run TEST.\n"
+#endif
+#ifdef FILESYS
+ " ls List files in the root directory.\n"
+ " cat FILE Print FILE to the console.\n"
+ " rm FILE Delete FILE.\n"
+ "Use these actions indirectly via `pintos' -g and -p options:\n"
+ " extract Untar from scratch disk into file system.\n"
+ " append FILE Append FILE to tar file on scratch disk.\n"
+#endif
+ "\nOptions:\n"
+ " -h Print this help message and power off.\n"
+ " -q Power off VM after actions or on panic.\n"
+ " -r Reboot after actions.\n"
+ " -f Format file system disk during startup.\n"
+ " -rs=SEED Set random number seed to SEED.\n"
+ " -mlfqs Use multi-level feedback queue scheduler.\n"
+#ifdef USERPROG
+ " -ul=COUNT Limit user memory to COUNT pages.\n"
+#endif
+ );
+ shutdown_power_off ();