aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2014-04-20 11:35:47 -0700
committerH. Peter Anvin <hpa@zytor.com>2014-04-20 11:46:59 -0700
commit81609df52ac52636a6d4af9249ede641620cb3a7 (patch)
treed9977268d435834ab26ccebb4ad28a2b3d44e50b
parentb8752b88492d8f321037ad29e56a2fdf9e798e15 (diff)
downloadsyslinux-6.03-pre11.tar.gz
syslinux-6.03-pre11.tar.xz
syslinux-6.03-pre11.zip
Centralize shift_is_held(), make it work to force the command linesyslinux-6.03-pre11
Holding down shift is supposed to force a command line unless noescape is provided; make it behave that way. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/elflink/ldlinux/ldlinux.c3
-rw-r--r--com32/include/console.h1
-rw-r--r--com32/menu/menumain.c5
-rw-r--r--core/include/core.h9
4 files changed, 11 insertions, 7 deletions
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 76d117c7..9b01dd3a 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -337,8 +337,7 @@ __export int main(int argc __unused, char **argv)
ldlinux_enter_command();
}
- /* TODO: Check KbdFlags? */
- if (!forceprompt)
+ if (!forceprompt && !shift_is_held())
ldlinux_auto_boot();
if (defaultlevel > 1)
diff --git a/com32/include/console.h b/com32/include/console.h
index 74e68f1a..94ffb9fa 100644
--- a/com32/include/console.h
+++ b/com32/include/console.h
@@ -35,6 +35,7 @@
#define _CONSOLE_H
#include <klibc/extern.h>
+#include <inttypes.h>
#include <dev.h>
__extern int openconsole(const struct input_dev *, const struct output_dev *);
diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c
index 1d239a7f..b8cb06fd 100644
--- a/com32/menu/menumain.c
+++ b/com32/menu/menumain.c
@@ -609,11 +609,6 @@ static const char *edit_cmdline(const char *input, int top)
}
}
-static inline int shift_is_held(void)
-{
- return !!(kbd_shiftflags() & 0x5d); /* Caps/Scroll/Alt/Shift */
-}
-
static void print_timeout_message(int tol, int row, const char *msg)
{
static int last_msg_len = 0;
diff --git a/core/include/core.h b/core/include/core.h
index c8689dfd..4783d75f 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -130,6 +130,15 @@ extern void writechr(char data);
extern void crlf(void);
extern int pollchar(void);
extern char getchar(char *hi);
+extern uint8_t kbd_shiftflags(void);
+static inline bool shift_is_held(void)
+{
+ return !!(kbd_shiftflags() & 0x5d); /* Caps/Scroll/Alt/Shift */
+}
+static inline bool ctrl_is_held(void)
+{
+ return !!(kbd_shiftflags() & 0x04); /* Only Ctrl */
+}
extern void cleanup_hardware(void);
extern void sirq_cleanup(void);