[syslinux] [PATCH 1/3] elflink: use 'input' as the prompt of the CLI
Liu Aleaxander
aleaxander at gmail.com
Sun Oct 3 08:54:04 PDT 2010
Use the paramter 'input' of fucntion edit_cmdline as the prompt of the
CLI. I guess this is what the 'input' parameter used for. It's is more
extendable than using a specify prompt.
And, for now, let's use the 'syslinux' as the prompt.:)
Signed-off-by: Liu Aleaxander <Aleaxander at gmail.com>
---
core/elflink/cli.c | 10 +++++-----
core/elflink/load_env32.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/core/elflink/cli.c b/core/elflink/cli.c
index 408921e..9770839 100644
--- a/core/elflink/cli.c
+++ b/core/elflink/cli.c
@@ -89,7 +89,7 @@ const char *edit_cmdline(const char *input, int top /*, int width */ ,
strncpy(cmdline, input, MAX_CMDLINE_LEN);
cmdline[MAX_CMDLINE_LEN - 1] = '\0';
- len = cursor = strlen(cmdline);
+ len = cursor = 0;//strlen(cmdline);
prev_len = 0;
x = y = 0;
@@ -114,9 +114,9 @@ const char *edit_cmdline(const char *input, int top /*, int width */ ,
printf("\033[?7l\033[?25l");
if (y)
printf("\033[%dA", y);
- printf("\033[1G\033[1;36m> \033[0m");
+ printf("\033[1G\033[1;36m%s \033[0m", input);
- x = 2;
+ x = strlen(input);
y = 0;
at = 0;
while (at < prev_len) {
@@ -131,8 +131,8 @@ const char *edit_cmdline(const char *input, int top /*, int width */ ,
}
printf("\033[K\r");
- dy = y - (cursor + 2) / width;
- x = (cursor + 2) % width;
+ dy = y - (cursor + strlen(input) + 1) / width;
+ x = (cursor + strlen(input) + 1) % width;
if (dy) {
printf("\033[%dA", dy);
diff --git a/core/elflink/load_env32.c b/core/elflink/load_env32.c
index 99bf7a3..26ad01f 100644
--- a/core/elflink/load_env32.c
+++ b/core/elflink/load_env32.c
@@ -72,7 +72,7 @@ void enter_cmdline(void)
/* Enter endless command line prompt, should support "exit" */
while (1) {
- cmdline = edit_cmdline("", 1, NULL, NULL);
+ cmdline = edit_cmdline("syslinux$", 1, NULL, NULL);
/* feng: give up the aux check here */
//aux = list_entry(cli_history_head.next, typeof(*aux), list);
//if (strcmp(aux->command, cmdline)) {
--
1.7.2.3
More information about the Syslinux
mailing list