* [U-Boot-Users] command compleation in latest u-boot?
@ 2007-11-27 18:29 Joakim Tjernlund
2007-11-27 18:36 ` Stefan Roese
0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2007-11-27 18:29 UTC (permalink / raw)
To: u-boot
Trying to move my boot to latest u-boot and I can't make command
completion work. Does it work in current u-boot and
what config options do you use?
Jocke
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] command compleation in latest u-boot?
2007-11-27 18:29 [U-Boot-Users] command compleation in latest u-boot? Joakim Tjernlund
@ 2007-11-27 18:36 ` Stefan Roese
2007-11-27 19:08 ` Joakim Tjernlund
2007-11-28 9:01 ` Joakim Tjernlund
0 siblings, 2 replies; 7+ messages in thread
From: Stefan Roese @ 2007-11-27 18:36 UTC (permalink / raw)
To: u-boot
Hi Jocke,
On Tuesday 27 November 2007, Joakim Tjernlund wrote:
> Trying to move my boot to latest u-boot and I can't make command
> completion work. Does it work in current u-boot and
> what config options do you use?
IIRC, then you have to choose to enable either command completion
(CONFIG_AUTO_COMPLETE) or command history (CONFIG_CMDLINE_EDITING). Command
history is my choice here.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] command compleation in latest u-boot?
2007-11-27 18:36 ` Stefan Roese
@ 2007-11-27 19:08 ` Joakim Tjernlund
2007-11-28 9:01 ` Joakim Tjernlund
1 sibling, 0 replies; 7+ messages in thread
From: Joakim Tjernlund @ 2007-11-27 19:08 UTC (permalink / raw)
To: u-boot
> -----Original Message-----
> From: Stefan Roese [mailto:sr at denx.de]
> Sent: den 27 november 2007 19:36
> To: u-boot-users at lists.sourceforge.net
> Cc: Joakim Tjernlund
> Subject: Re: [U-Boot-Users] command compleation in latest u-boot?
>
> Hi Jocke,
>
> On Tuesday 27 November 2007, Joakim Tjernlund wrote:
> > Trying to move my boot to latest u-boot and I can't make command
> > completion work. Does it work in current u-boot and
> > what config options do you use?
>
> IIRC, then you have to choose to enable either command completion
> (CONFIG_AUTO_COMPLETE) or command history
> (CONFIG_CMDLINE_EDITING). Command
> history is my choice here.
Using both of them, but TAB still does not complete anything.
Jocke
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] command compleation in latest u-boot?
2007-11-27 18:36 ` Stefan Roese
2007-11-27 19:08 ` Joakim Tjernlund
@ 2007-11-28 9:01 ` Joakim Tjernlund
2007-11-28 9:41 ` Stefan Roese
1 sibling, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2007-11-28 9:01 UTC (permalink / raw)
To: u-boot
On Tue, 2007-11-27 at 19:36 +0100, Stefan Roese wrote:
> Hi Jocke,
>
> On Tuesday 27 November 2007, Joakim Tjernlund wrote:
> > Trying to move my boot to latest u-boot and I can't make command
> > completion work. Does it work in current u-boot and
> > what config options do you use?
>
> IIRC, then you have to choose to enable either command completion
> (CONFIG_AUTO_COMPLETE) or command history (CONFIG_CMDLINE_EDITING). Command
> history is my choice here.
Ahh, I can only use one. In my old boot I can use both because I applied
a patch from Pantelis that I thought was in uboot already. Can you
have a look at Pantelis patch an apply if appropriate?
Here is the patch:
From:
Pantelis Antoniou
<pantelis@embeddedalley.com>
To:
u-boot-users at lists.sourceforge.net
Cc:
Frank Robbins
<frank.robbins@analogue-micro.com>,
Dan Malek <dan@embeddedalley.com>,
Wolfgang Denk <wd@denx.de>, Peter
Tympanick <ptymps@ultsol.com>
Subject:
[U-Boot-Users] [PATCH 1/8] Make
autocomplete work with HUSH parser
too.
Date:
Sun, 03 Dec 2006 00:15:50 +0200
(Sat, 23:15 CET)
Auto complete did not work when the HUSH parser was selected.
Fix this obvious problem.
---
Signed-off-by: Pantelis Antoniou <pantelis@embeddedalley.com>
---
README | 4 ----
common/main.c | 25 +++++++++++++++++++++++--
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/README b/README
index ecfd1f8..e28f935 100644
--- a/README
+++ b/README
@@ -1511,10 +1511,6 @@ The following options need to be configured:
Enable auto completion of commands using TAB.
- Note that this feature has NOT been implemented yet
- for the "hush" shell.
-
-
CFG_HUSH_PARSER
Define this variable to enable the "hush" shell (from
diff --git a/common/main.c b/common/main.c
index cc4b50f..a8ae07c 100644
--- a/common/main.c
+++ b/common/main.c
@@ -718,10 +718,11 @@ static void cread_add_str(char *str, int strsize,
int insert, unsigned long *num
}
}
-static int cread_line(char *buf, unsigned int *len)
+static int cread_line(const char *const prompt, char *buf, unsigned int
*len)
{
unsigned long num = 0;
unsigned long eol_num = 0;
+ int num2, col;
unsigned long rlen;
unsigned long wlen;
char ichar;
@@ -840,6 +841,7 @@ static int cread_line(char *buf, unsigned int *len)
insert = !insert;
break;
case CTL_CH('x'):
+ case CTL_CH('u'): /* like that too */
BEGINNING_OF_LINE();
ERASE_TO_EOL();
break;
@@ -889,6 +891,25 @@ static int cread_line(char *buf, unsigned int *len)
REFRESH_TO_EOL();
continue;
}
+#ifdef CONFIG_AUTO_COMPLETE
+ case '\t':
+
+ /* do not autocomplete when in the middle */
+ if (num < eol_num) {
+ getcmd_cbeep();
+ break;
+ }
+
+ buf[num] = '\0';
+ col = strlen(prompt) + eol_num;
+ num2 = num;
+ if (cmd_auto_complete(prompt, buf, &num2, &col))
{
+ col = num2 - num;
+ num += col;
+ eol_num += col;
+ }
+ break;
+#endif
default:
cread_add_char(ichar, insert, &num, &eol_num,
buf, *len);
break;
@@ -931,7 +952,7 @@ int readline (const char *const prompt)
puts (prompt);
- rc = cread_line(p, &len);
+ rc = cread_line(prompt, p, &len);
return rc < 0 ? rc : len;
#else
char *p = console_buffer;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot-Users] command compleation in latest u-boot?
2007-11-28 9:01 ` Joakim Tjernlund
@ 2007-11-28 9:41 ` Stefan Roese
2007-12-18 4:19 ` Mike Frysinger
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Roese @ 2007-11-28 9:41 UTC (permalink / raw)
To: u-boot
On Wednesday 28 November 2007, Joakim Tjernlund wrote:
> > IIRC, then you have to choose to enable either command completion
> > (CONFIG_AUTO_COMPLETE) or command history (CONFIG_CMDLINE_EDITING).
> > Command history is my choice here.
>
> Ahh, I can only use one. In my old boot I can use both because I applied
> a patch from Pantelis that I thought was in uboot already. Can you
> have a look at Pantelis patch an apply if appropriate?
Yes, would be good if both is possible. Could you do me a favor and redo this
patch against the current source code. Also it seems that this will trigger
some compile warning for unused variables "num2, col" when
CONFIG_AUTO_COMPLETE is not defined. Please check and resend a fixed version
and I'll make sure that it gets applied when the next merge window opens.
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] command compleation in latest u-boot?
2007-11-28 9:41 ` Stefan Roese
@ 2007-12-18 4:19 ` Mike Frysinger
2007-12-22 15:02 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2007-12-18 4:19 UTC (permalink / raw)
To: u-boot
On Wednesday 28 November 2007, Stefan Roese wrote:
> On Wednesday 28 November 2007, Joakim Tjernlund wrote:
> > > IIRC, then you have to choose to enable either command completion
> > > (CONFIG_AUTO_COMPLETE) or command history (CONFIG_CMDLINE_EDITING).
> > > Command history is my choice here.
> >
> > Ahh, I can only use one. In my old boot I can use both because I applied
> > a patch from Pantelis that I thought was in uboot already. Can you
> > have a look at Pantelis patch an apply if appropriate?
>
> Yes, would be good if both is possible. Could you do me a favor and redo
> this patch against the current source code. Also it seems that this will
> trigger some compile warning for unused variables "num2, col" when
> CONFIG_AUTO_COMPLETE is not defined. Please check and resend a fixed
> version and I'll make sure that it gets applied when the next merge window
> opens.
the patch posted still applies cleanly (ignoring offsets and the crappy word
wrapping). for sake of completeness, ive attached patch against current
mainline git after giving it a spin against a recent version.
-mike
diff --git a/common/main.c b/common/main.c
index 379695c..4253eac 100644
--- a/common/main.c
+++ b/common/main.c
@@ -696,7 +696,7 @@ static void cread_add_str(char *str, int strsize, int insert, unsigned long *num
}
}
-static int cread_line(char *buf, unsigned int *len)
+static int cread_line(const char *const prompt, char *buf, unsigned int *len)
{
unsigned long num = 0;
unsigned long eol_num = 0;
@@ -818,6 +818,7 @@ static int cread_line(char *buf, unsigned int *len)
insert = !insert;
break;
case CTL_CH('x'):
+ case CTL_CH('u'):
BEGINNING_OF_LINE();
ERASE_TO_EOL();
break;
@@ -867,6 +868,27 @@ static int cread_line(char *buf, unsigned int *len)
REFRESH_TO_EOL();
continue;
}
+#ifdef CONFIG_AUTO_COMPLETE
+ case '\t': {
+ int num2, col;
+
+ /* do not autocomplete when in the middle */
+ if (num < eol_num) {
+ getcmd_cbeep();
+ break;
+ }
+
+ buf[num] = '\0';
+ col = strlen(prompt) + eol_num;
+ num2 = num;
+ if (cmd_auto_complete(prompt, buf, &num2, &col)) {
+ col = num2 - num;
+ num += col;
+ eol_num += col;
+ }
+ break;
+ }
+#endif
default:
cread_add_char(ichar, insert, &num, &eol_num, buf, *len);
break;
@@ -909,7 +931,7 @@ int readline (const char *const prompt)
puts (prompt);
- rc = cread_line(p, &len);
+ rc = cread_line(prompt, p, &len);
return rc < 0 ? rc : len;
#else
char *p = console_buffer;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot-Users] command compleation in latest u-boot?
2007-12-18 4:19 ` Mike Frysinger
@ 2007-12-22 15:02 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 7+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2007-12-22 15:02 UTC (permalink / raw)
To: u-boot
On 23:19 Mon 17 Dec , Mike Frysinger wrote:
> On Wednesday 28 November 2007, Stefan Roese wrote:
> > On Wednesday 28 November 2007, Joakim Tjernlund wrote:
> > > > IIRC, then you have to choose to enable either command completion
> > > > (CONFIG_AUTO_COMPLETE) or command history (CONFIG_CMDLINE_EDITING).
> > > > Command history is my choice here.
> > >
> > > Ahh, I can only use one. In my old boot I can use both because I applied
> > > a patch from Pantelis that I thought was in uboot already. Can you
> > > have a look at Pantelis patch an apply if appropriate?
> >
> > Yes, would be good if both is possible. Could you do me a favor and redo
> > this patch against the current source code. Also it seems that this will
> > trigger some compile warning for unused variables "num2, col" when
> > CONFIG_AUTO_COMPLETE is not defined. Please check and resend a fixed
> > version and I'll make sure that it gets applied when the next merge window
> > opens.
>
> the patch posted still applies cleanly (ignoring offsets and the crappy word
> wrapping). for sake of completeness, ive attached patch against current
> mainline git after giving it a spin against a recent version.
> -mike
>
Add in ixp repository on testing branch
Best Regards,
J.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-12-22 15:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-27 18:29 [U-Boot-Users] command compleation in latest u-boot? Joakim Tjernlund
2007-11-27 18:36 ` Stefan Roese
2007-11-27 19:08 ` Joakim Tjernlund
2007-11-28 9:01 ` Joakim Tjernlund
2007-11-28 9:41 ` Stefan Roese
2007-12-18 4:19 ` Mike Frysinger
2007-12-22 15:02 ` Jean-Christophe PLAGNIOL-VILLARD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox