[PATCH] console_countdown: use CTL_CH macro for control characters
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Oct 21 06:38:55 PDT 2024
This introduces no functional change, but makes code more readable as
it's directly evident that the 3 here means ctrl+c.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
common/console_countdown.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/common/console_countdown.c b/common/console_countdown.c
index e41641aca23e..832505c1d755 100644
--- a/common/console_countdown.c
+++ b/common/console_countdown.c
@@ -10,6 +10,7 @@
#include <errno.h>
#include <console_countdown.h>
#include <stdio.h>
+#include <readkey.h>
static bool console_countdown_timeout_abort;
@@ -57,7 +58,7 @@ int console_countdown(int timeout_s, unsigned flags, const char *keys,
goto out;
if (flags & CONSOLE_COUNTDOWN_RETURN && (key == '\n' || key == '\r'))
goto out;
- if (flags & CONSOLE_COUNTDOWN_CTRLC && key == 3)
+ if (flags & CONSOLE_COUNTDOWN_CTRLC && key == CTL_CH('c'))
goto out;
}
key = 0;
--
2.39.5
More information about the barebox
mailing list