From 9a92abb6f4fe08a8649afd68ab6004417f6961e4 Mon Sep 17 00:00:00 2001 From: Liu Aleaxander Date: Tue, 15 Mar 2011 20:44:53 +0000 Subject: [PATCH] elflink: use 'input' as the prompt of the CLI 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 Signed-off-by: Matt Fleming --- com32/elflink/ldlinux/cli.c | 10 +++++----- com32/elflink/ldlinux/ldlinux.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/com32/elflink/ldlinux/cli.c b/com32/elflink/ldlinux/cli.c index 130dc6d..b482760 100644 --- a/com32/elflink/ldlinux/cli.c +++ b/com32/elflink/ldlinux/cli.c @@ -93,7 +93,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; @@ -118,9 +118,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) { @@ -135,8 +135,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/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c index b5a4409..9c5e248 100644 --- a/com32/elflink/ldlinux/ldlinux.c +++ b/com32/elflink/ldlinux/ldlinux.c @@ -17,7 +17,7 @@ static 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)) { -- 2.7.4