[syslinux:master] hdt: Adding Silent mode
syslinux-bot for Erwan Velu
erwanaliasr1 at gmail.com
Mon Oct 22 12:51:11 PDT 2012
Commit-ID: c01a7e8a7c5cfb9967142343c2460116f03c08bd
Gitweb: http://www.syslinux.org/commit/c01a7e8a7c5cfb9967142343c2460116f03c08bd
Author: Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Mon, 10 Sep 2012 21:02:02 +0200
Committer: Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Mon, 10 Sep 2012 21:02:02 +0200
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.
---
com32/hdt/floppy/hdt.cfg | 2 +-
com32/hdt/hdt-common.c | 5 +++++
com32/hdt/hdt-common.h | 21 +++++++++++++--------
3 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/com32/hdt/floppy/hdt.cfg b/com32/hdt/floppy/hdt.cfg
index 7cfe6a7..524c4e0 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 0797ddd..dcad28c 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 8c85260..c2299b4 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 */
More information about the Syslinux-commits
mailing list