aboutsummaryrefslogtreecommitdiffstats
path: root/com32/elflink/ldlinux/cli.c
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@linux.intel.com>2011-03-29 13:06:16 +0100
committerMatt Fleming <matt.fleming@linux.intel.com>2011-03-29 14:27:02 +0100
commitf8d263e69d65c4257a49bc1a70428e89d492e361 (patch)
tree7d9c07f73b1c22ec622cc163cef4d07fc2d34195 /com32/elflink/ldlinux/cli.c
parent8c576f1fe03e34879921311f46613a35c6530000 (diff)
downloadsyslinux-f8d263e69d65c4257a49bc1a70428e89d492e361.tar.gz
syslinux-f8d263e69d65c4257a49bc1a70428e89d492e361.tar.xz
syslinux-f8d263e69d65c4257a49bc1a70428e89d492e361.zip
elflink, cli: TAB key now displays labels
Now, if the user hits the TAB key at a prompt a list of all labels to complete the current label typed on the command-line is printed. If nothing is typed at the command-line all labels are printed. This feature is available in the asm command-line interface so lets make it available in the C version. Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
Diffstat (limited to 'com32/elflink/ldlinux/cli.c')
-rw-r--r--com32/elflink/ldlinux/cli.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/com32/elflink/ldlinux/cli.c b/com32/elflink/ldlinux/cli.c
index 172a9f68..08845252 100644
--- a/com32/elflink/ldlinux/cli.c
+++ b/com32/elflink/ldlinux/cli.c
@@ -18,6 +18,7 @@
#include "getkey.h"
#include "menu.h"
#include "cli.h"
+#include "config.h"
static jmp_buf timeout_jump;
@@ -394,6 +395,26 @@ const char *edit_cmdline(const char *input, int top /*, int width */ ,
redraw = 1;
}
break;
+ case KEY_TAB:
+ {
+ const char *p;
+ size_t len;
+
+ /* Label completion enabled? */
+ if (nocomplete)
+ break;
+
+ p = cmdline;
+ len = 0;
+ while(*p && !my_isspace(*p)) {
+ p++;
+ len++;
+ }
+
+ print_labels(cmdline, len);
+ redraw = 1;
+ break;
+ }
default:
if (key >= ' ' && key <= 0xFF && len < MAX_CMDLINE_LEN - 1) {