From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] console_countdown: use CTL_CH macro for control characters
Date: Mon, 21 Oct 2024 15:38:55 +0200 [thread overview]
Message-ID: <20241021133855.266927-1-a.fatoum@pengutronix.de> (raw)
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
next reply other threads:[~2024-10-21 14:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-21 13:38 Ahmad Fatoum [this message]
2024-10-22 9:45 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241021133855.266927-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox