+ for (; *argv != NULL && **argv == '-'; argv++)
+ {
+ char *save_ptr;
+ char *name = strtok_r (*argv, "=", &save_ptr);
+ char *value = strtok_r (NULL, "", &save_ptr);
+
+ if (!strcmp (name, "-h"))
+ usage ();
+ else if (!strcmp (name, "-q"))
+ shutdown_configure (SHUTDOWN_POWER_OFF);
+ else if (!strcmp (name, "-r"))
+ shutdown_configure (SHUTDOWN_REBOOT);
+#ifdef FILESYS
+ else if (!strcmp (name, "-f"))
+ format_filesys = true;
+ else if (!strcmp (name, "-filesys"))
+ filesys_bdev_name = value;
+ else if (!strcmp (name, "-scratch"))
+ scratch_bdev_name = value;
+#ifdef VM
+ else if (!strcmp (name, "-swap"))
+ swap_bdev_name = value;
+#endif
+#endif
+ else if (!strcmp (name, "-rs"))
+ random_init (atoi (value));
+ else if (!strcmp (name, "-mlfqs"))
+ thread_mlfqs = true;
+#ifdef USERPROG
+ else if (!strcmp (name, "-ul"))
+ user_page_limit = atoi (value);
+#endif
+ else
+ PANIC ("unknown option `%s' (use -h for help)", name);
+ }
+
+ /* Initialize the random number generator based on the system
+ time. This has no effect if an "-rs" option was specified.
+
+ When running under Bochs, this is not enough by itself to
+ get a good seed value, because the pintos script sets the
+ initial time to a predictable value, not to the local time,
+ for reproducibility. To fix this, give the "-r" option to
+ the pintos script to request real-time execution. */
+ random_init (rtc_get_time ());
+
+ return argv;