rosh: Add argc/argv rosh_reboot(); Allow warm reboots
authorGene Cumm <gene.cumm@gmail.com>
Sun, 3 Oct 2010 11:12:06 +0000 (07:12 -0400)
committerGene Cumm <gene.cumm@gmail.com>
Sat, 9 Oct 2010 11:33:08 +0000 (07:33 -0400)
com32/rosh/rosh.c

index e8c29fa..70010d4 100644 (file)
@@ -41,7 +41,7 @@
 #define APP_NAME       "rosh"
 #define APP_AUTHOR     "Gene Cumm"
 #define APP_YEAR       "2010"
-#define APP_VER                "beta-b080"
+#define APP_VER                "beta-b082"
 
 /* Print version information to stdout
  */
@@ -1095,13 +1095,33 @@ void rosh_pwd(const char *cmdstr)
     ROSH_DEBUG2("  --%08X\n", istr);
 }                              /* rosh_pwd */
 
-/* Reboot
+/* Reboot; use warm reboot if one of certain options set
+ *     argc    Argument count
+ *     argv    Argument values
  */
-void rosh_reboot(void)
+void rosh_reboot(int argc, char *argv[])
 {
-//     char cmdstr[ROSH_CMD_SZ];
-//     printf
-    syslinux_reboot(0);
+    int rtype = 0;
+    if (argc) {
+       /* For now, just use the first */
+       switch (argv[0][0]) {
+       case '1':
+       case 's':
+       case 'w':
+           rtype = 1;
+           break;
+       case '-':
+           switch (argv[0][1]) {
+           case '1':
+           case 's':
+           case 'w':
+               rtype = 1;
+               break;
+           }
+           break;
+       }
+    }
+    syslinux_reboot(rtype);
 }                              /* rosh_reboot */
 
 /* Run a boot string, calling syslinux_run_command
@@ -1268,7 +1288,7 @@ char rosh_command(int argc, char *argv[], const char *ipwdstr)
        case 'e':
        case 'E':
            if (strncasecmp("reboot", argv[0], tlen) == 0)
-               rosh_reboot();
+               rosh_reboot(argc - 1, &argv[1]);
            else
                rosh_help(1, NULL);
            break;