summaryrefslogtreecommitdiffstats
path: root/common/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/common/console.c b/common/console.c
index 47ccf2e54d..b6685ecf6a 100644
--- a/common/console.c
+++ b/common/console.c
@@ -574,18 +574,36 @@ void console_flush(void)
}
EXPORT_SYMBOL(console_flush);
-#ifndef ARCH_HAS_CTRLC
+static int ctrlc_abort;
+
+void ctrlc_handled(void)
+{
+ ctrlc_abort = 0;
+}
+
/* test if ctrl-c was pressed */
-int ctrlc (void)
+int ctrlc(void)
{
+ int ret = 0;
+
+ if (ctrlc_abort)
+ return 1;
+
poller_call();
+#ifdef ARCH_HAS_CTRLC
+ ret = arch_ctrlc();
+#else
if (tstc() && getchar() == 3)
- return 1;
- return 0;
+ ret = 1;
+#endif
+
+ if (ret)
+ ctrlc_abort = 1;
+
+ return ret;
}
EXPORT_SYMBOL(ctrlc);
-#endif /* ARCH_HAS_CTRC */
BAREBOX_MAGICVAR_NAMED(global_linux_bootargs_console, global.linux.bootargs.console,
"console= argument for Linux from the stdout-path property in /chosen node");