hdt: Removing remaining printf()
[profile/ivi/syslinux.git] / com32 / hdt / hdt.c
index 1a438a3..653995d 100644 (file)
@@ -48,7 +48,6 @@ int max_console_lines = MAX_CLI_LINES;
 int main(const int argc, const char *argv[])
 {
     char version_string[256];
-    const char *arg;
     struct s_hardware hardware;
 
     snprintf(version_string, sizeof version_string, "%s %s (%s)",
@@ -66,21 +65,30 @@ int main(const int argc, const char *argv[])
     /* Opening the Syslinux console */
     init_console(&hardware);
 
+    /* Detect hardware */
+    detect_hardware(&hardware);
+
     /* Clear the screen and reset position of the cursor */
     clear_screen();
     printf("\033[1;1H");
 
-    printf("%s\n", version_string);
+    more_printf("%s\n", version_string);
+
+    int return_code = 0;
 
-    if ((arg = find_argument(argv + 1, "nomenu"))
-       || (find_argument(argv + 1, "auto")))
+    if (!menumode || automode)
        start_cli_mode(&hardware);
     else {
-       int return_code = start_menu_mode(&hardware, version_string);
+       return_code = start_menu_mode(&hardware, version_string);
        if (return_code == HDT_RETURN_TO_CLI)
            start_cli_mode(&hardware);
-       else
-           return return_code;
     }
-    return 0;
+
+    /* Do we got request to do something at exit time ? */
+    if (strlen(hardware.postexec)>0) {
+           more_printf("Executing postexec instructions : %s\n",hardware.postexec);
+           runsyslinuxcmd(hardware.postexec);
+    }
+
+    return return_code;
 }