hdt: Removing remaining printf()
authorErwan Velu <erwanaliasr1@gmail.com>
Mon, 10 Sep 2012 18:39:37 +0000 (20:39 +0200)
committerErwan Velu <erwanaliasr1@gmail.com>
Mon, 10 Sep 2012 18:39:37 +0000 (20:39 +0200)
Using more_printf allow to manage more easily several pages printing.

com32/hdt/hdt-cli-hdt.c
com32/hdt/hdt-cli.c
com32/hdt/hdt-common.c
com32/hdt/hdt-dump.c
com32/hdt/hdt.c

index 3af6770..3c571d6 100644 (file)
@@ -54,12 +54,12 @@ static void main_show_modes(int argc __unused, char **argv __unused,
     int i = 0;
 
     reset_more_printf();
-    printf("Available modes:\n");
+    more_printf("Available modes:\n");
     while (list_modes[i]) {
        printf("%s ", list_modes[i]->name);
        i++;
     }
-    printf("\n");
+    more_printf("\n");
 }
 
 /**
@@ -119,7 +119,7 @@ static void show_cli_help(int argc __unused, char **argv __unused,
 
     find_cli_mode_descr(hdt_cli.mode, &current_mode);
 
-    printf("Available commands are:\n");
+    more_printf("Available commands are:\n");
 
     /* List first default modules of the mode */
     if (current_mode->default_modules && current_mode->default_modules->modules) {
@@ -154,7 +154,7 @@ static void show_cli_help(int argc __unused, char **argv __unused,
 
     /* List secondly the show modules of the mode */
     if (current_mode->show_modules && current_mode->show_modules->modules) {
-       printf("\nshow commands:\n");
+       more_printf("\nshow commands:\n");
        j = 0;
        while (current_mode->show_modules->modules[j].name) {
            printf("%s ", current_mode->show_modules->modules[j].name);
@@ -165,7 +165,7 @@ static void show_cli_help(int argc __unused, char **argv __unused,
 
     /* List thirdly the set modules of the mode */
     if (current_mode->set_modules && current_mode->set_modules->modules) {
-       printf("\nset commands:\n");
+       more_printf("\nset commands:\n");
        j = 0;
        while (current_mode->set_modules->modules[j].name) {
            printf("%s ", current_mode->set_modules->modules[j].name);
@@ -267,7 +267,7 @@ static void do_sleep(int argc , char **argv ,
 {
    (void) hardware;
    if (argc != 1) return;
-   printf("Sleep %d milliseconds\n",atoi(argv[0]));
+   more_printf("Sleep %d milliseconds\n",atoi(argv[0]));
    msleep(atoi(argv[0]));
 }
 
@@ -279,7 +279,7 @@ static void do_display(int argc , char **argv ,
 {
    (void) hardware;
    if ((argc != 1) || (vesamode == false)) return;
-   printf("Display %s file\n",argv[0]);
+   more_printf("Display %s file\n",argv[0]);
    vesacon_load_background(argv[0]);
 }
 
@@ -316,7 +316,7 @@ static void do_say(int argc , char **argv ,
        dprintf("SAY CMD = [%s]\n",text_to_say);           
        }
 
-       printf("%s\n",text_to_say);
+       more_printf("%s\n",text_to_say);
   }
 }
 
index 11984e5..7542da8 100644 (file)
@@ -132,7 +132,7 @@ void set_mode(cli_mode_t mode, struct s_hardware *hardware)
        break;
     case PXE_MODE:
        if (hardware->sv->filesystem != SYSLINUX_FS_PXELINUX) {
-           printf("You are not currently using PXELINUX\n");
+           more_printf("You are not currently using PXELINUX\n");
            break;
        }
        hdt_cli.mode = mode;
@@ -160,7 +160,7 @@ void set_mode(cli_mode_t mode, struct s_hardware *hardware)
        break;
     case DMI_MODE:
        if (!hardware->is_dmi_valid) {
-           printf("No valid DMI table found, exiting.\n");
+           more_printf("No valid DMI table found, exiting.\n");
            break;
        }
        hdt_cli.mode = mode;
@@ -172,7 +172,7 @@ void set_mode(cli_mode_t mode, struct s_hardware *hardware)
        break;
     case VPD_MODE:
        if (!hardware->is_vpd_valid) {
-           printf("No valid VPD table found, exiting.\n");
+           more_printf("No valid VPD table found, exiting.\n");
            break;
        }
        hdt_cli.mode = mode;
@@ -188,9 +188,9 @@ void set_mode(cli_mode_t mode, struct s_hardware *hardware)
        break;
     default:
        /* Invalid mode */
-       printf("Unknown mode, please choose among:\n");
+       more_printf("Unknown mode, please choose among:\n");
        while (list_modes[i]) {
-           printf("\t%s\n", list_modes[i]->name);
+           more_printf("\t%s\n", list_modes[i]->name);
            i++;
        }
     }
@@ -199,7 +199,7 @@ void set_mode(cli_mode_t mode, struct s_hardware *hardware)
     /* There is not cli_mode_descr struct for the exit mode */
     if (current_mode == NULL && hdt_cli.mode != EXIT_MODE) {
        /* Shouldn't get here... */
-       printf("!!! BUG: Mode '%d' unknown.\n", hdt_cli.mode);
+       more_printf("!!! BUG: Mode '%d' unknown.\n", hdt_cli.mode);
     }
 }
 
@@ -679,7 +679,7 @@ static void exec_command(char *line, struct s_hardware *hardware)
            if (current_module != NULL)
                current_module->exec(argc, argv, hardware);
            else
-               printf("unknown command: '%s'\n", command);
+               more_printf("unknown command: '%s'\n", command);
        }
     } else {
        /*
@@ -833,7 +833,7 @@ void start_cli_mode(struct s_hardware *hardware)
     find_cli_mode_descr(hdt_cli.mode, &current_mode);
     if (current_mode == NULL) {
        /* Shouldn't get here... */
-       printf("!!! BUG: Mode '%d' unknown.\n", hdt_cli.mode);
+       more_printf("!!! BUG: Mode '%d' unknown.\n", hdt_cli.mode);
        return;
     }
 
@@ -842,7 +842,7 @@ void start_cli_mode(struct s_hardware *hardware)
        start_auto_mode(hardware);
     }
 
-    printf("Entering CLI mode\n");
+    more_printf("Entering CLI mode\n");
 
     reset_prompt();
 
index 8e9a9e6..0797ddd 100644 (file)
@@ -739,8 +739,8 @@ void detect_hardware(struct s_hardware *hardware)
     if (!quiet)
         more_printf("DMI: Detecting Table\n");
     if (detect_dmi(hardware) == -ENODMITABLE) {
-        printf("DMI: ERROR ! Table not found ! \n");
-        printf("DMI: Many hardware components will not be detected ! \n");
+        more_printf("DMI: ERROR ! Table not found ! \n");
+        more_printf("DMI: Many hardware components will not be detected ! \n");
     } else {
         if (!quiet)
             more_printf("DMI: Table found ! (version %u.%u)\n",
index b963e19..b1748c8 100644 (file)
@@ -156,7 +156,7 @@ void flush(ZZJSON_CONFIG * config, ZZJSON ** item)
 void dump(struct s_hardware *hardware)
 {
     if (hardware->is_pxe_valid == false) {
-       printf("PXE stack was not detected, Dump feature is not available\n");
+       more_printf("PXE stack was not detected, Dump feature is not available\n");
        return;
     }
 
index 851b046..653995d 100644 (file)
@@ -72,7 +72,7 @@ int main(const int argc, const char *argv[])
     clear_screen();
     printf("\033[1;1H");
 
-    printf("%s\n", version_string);
+    more_printf("%s\n", version_string);
 
     int return_code = 0;
 
@@ -86,7 +86,7 @@ int main(const int argc, const char *argv[])
 
     /* Do we got request to do something at exit time ? */
     if (strlen(hardware.postexec)>0) {
-           printf("Executing postexec instructions : %s\n",hardware.postexec);
+           more_printf("Executing postexec instructions : %s\n",hardware.postexec);
            runsyslinuxcmd(hardware.postexec);
     }