mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] console_countdown: use CTL_CH macro for control characters
@ 2024-10-21 13:38 Ahmad Fatoum
  2024-10-22  9:45 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-10-21 13:38 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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@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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] console_countdown: use CTL_CH macro for control characters
  2024-10-21 13:38 [PATCH] console_countdown: use CTL_CH macro for control characters Ahmad Fatoum
@ 2024-10-22  9:45 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-10-22  9:45 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Mon, 21 Oct 2024 15:38:55 +0200, Ahmad Fatoum wrote:
> This introduces no functional change, but makes code more readable as
> it's directly evident that the 3 here means ctrl+c.
> 
> 

Applied, thanks!

[1/1] console_countdown: use CTL_CH macro for control characters
      https://git.pengutronix.de/cgit/barebox/commit/?id=39fcc58a8e8b (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-22 10:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-21 13:38 [PATCH] console_countdown: use CTL_CH macro for control characters Ahmad Fatoum
2024-10-22  9:45 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox