From 8c26dace6f4db4245b57f05257c07b1253eb7490 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Fri, 26 Feb 2016 12:26:56 +0100 Subject: [PATCH] cat: Don't switch terminal mode when there is nothing to highlight. This just pollutes serial console. --- grub-core/commands/cat.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/grub-core/commands/cat.c b/grub-core/commands/cat.c index 8a7f1af78..88d904436 100644 --- a/grub-core/commands/cat.c +++ b/grub-core/commands/cat.c @@ -140,10 +140,13 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args) grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); } - grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); - for (j = 0; j < utcount; j++) - grub_printf ("<%x>", (unsigned int) utbuf[j]); - grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); + if (utcount) + { + grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); + for (j = 0; j < utcount; j++) + grub_printf ("<%x>", (unsigned int) utbuf[j]); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); + } grub_xputs ("\n"); grub_refresh ();