summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2012-09-10 21:02:02 +0200
committerErwan Velu <erwanaliasr1@gmail.com>2012-09-10 21:02:02 +0200
commitc01a7e8a7c5cfb9967142343c2460116f03c08bd (patch)
tree75872df2bfb66f49c963972be8be144a281469ed
parentb75d0c92550e22e048f40440225624a263265c88 (diff)
downloadsyslinux-c01a7e8a7c5cfb9967142343c2460116f03c08bd.tar.gz
hdt: Adding Silent mode
By using the "silent" option at the cmdline, HDT tries not displaying any boring message. This is particulary interesting with the "display" option.
-rw-r--r--com32/hdt/floppy/hdt.cfg2
-rw-r--r--com32/hdt/hdt-common.c5
-rw-r--r--com32/hdt/hdt-common.h21
3 files changed, 19 insertions, 9 deletions
diff --git a/com32/hdt/floppy/hdt.cfg b/com32/hdt/floppy/hdt.cfg
index 7cfe6a7d..524c4e06 100644
--- a/com32/hdt/floppy/hdt.cfg
+++ b/com32/hdt/floppy/hdt.cfg
@@ -103,7 +103,7 @@ TEXT HELP
A Picture is shown by using the display command
ENDTEXT
COM32 hdt.c32
-APPEND modules_pcimap=modules.pcimap modules_alias=modules.alias pciids=pci.ids quiet nomenu vesa auto='display display.png; sleep 5000; display red.png'
+APPEND modules_pcimap=modules.pcimap modules_alias=modules.alias pciids=pci.ids silent nomenu vesa auto='display display.png; sleep 5000; display red.png'
MENU SEPARATOR
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index 0797dddf..dcad28cd 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -63,6 +63,9 @@ void detect_parameters(const int argc, const char *argv[],
/* Quiet mode - make the output more quiet */
quiet = true;
+ /* Silent mode - make not output at all */
+ silent = false;
+
/* Vesa mode isn't set until we explictly call it */
vesamode = false;
@@ -75,6 +78,8 @@ void detect_parameters(const int argc, const char *argv[],
for (int i = 1; i < argc; i++) {
if (!strncmp(argv[i], "quiet", 5)) {
quiet = true;
+ } else if (!strncmp(argv[i], "silent", 6)) {
+ silent = true;
} else if (!strncmp(argv[i], "verbose", 7)) {
quiet = false;
} else if (!strncmp(argv[i], "modules_pcimap=", 15)) {
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index 8c85260b..c2299b48 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -87,6 +87,9 @@ struct upload_backend *upload;
/* Defines if the cli is quiet*/
bool quiet;
+/* Defines if the cli is totally silent*/
+bool silent;
+
/* Defines if we must use the vesa mode */
bool vesamode;
@@ -114,16 +117,18 @@ extern bool disable_more_printf;
* one \n (and only one)
*/
#define more_printf(...) do {\
- if (__likely(!disable_more_printf)) {\
- if (display_line_nb == max_console_lines) {\
- display_line_nb=0;\
- printf("\n--More--");\
- get_key(stdin, 0);\
- printf("\033[2K\033[1G\033[1F");\
+ if (__likely(!silent)) {\
+ if (__likely(!disable_more_printf)) {\
+ if (display_line_nb == max_console_lines) {\
+ display_line_nb=0;\
+ printf("\n--More--");\
+ get_key(stdin, 0);\
+ printf("\033[2K\033[1G\033[1F");\
+ }\
+ display_line_nb++;\
}\
- display_line_nb++;\
+ printf(__VA_ARGS__);\
}\
- printf(__VA_ARGS__);\
} while (0);
/* Display CPU registers for debugging purposes */