- if (!strcmp (argv[i], "-rs"))
- random_init (atoi (argv[++i]));
- else if (!strcmp (argv[i], "-q"))
- power_off_when_done = true;
-#ifdef USERPROG
- else if (!strcmp (argv[i], "-ex"))
- initial_program = argv[++i];
- else if (!strcmp (argv[i], "-ul"))
- user_page_limit = atoi (argv[++i]);
-#endif
+ if (strchr (argv[i], ' ') == NULL)
+ printf (" %s", argv[i]);
+ else
+ printf (" '%s'", argv[i]);
+ printf ("\n");
+
+ return argv;
+}
+
+/* Parses options in ARGV[]
+ and returns the first non-option argument. */
+static char **
+parse_options (char **argv)
+{
+ 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"))
+ power_off_when_done = true;
+ else if (!strcmp (name, "-r"))
+ reboot_when_done = true;