svn commit: trunk/busybox/shell
Bernhard Fischer
rep.nop at aon.at
Tue Dec 19 21:08:30 UTC 2006
On Tue, Dec 19, 2006 at 11:30:37AM -0800, vda at busybox.net wrote:
>Author: vda
>Date: 2006-12-19 11:30:37 -0800 (Tue, 19 Dec 2006)
>New Revision: 17007
>
>Log:
>cmdedit: fix my bug, improve code a bit
erm..
>
>
>Modified:
> trunk/busybox/shell/cmdedit.c
>
>
>Changeset:
>Modified: trunk/busybox/shell/cmdedit.c
>===================================================================
>--- trunk/busybox/shell/cmdedit.c 2006-12-19 16:31:09 UTC (rev 17006)
>+++ trunk/busybox/shell/cmdedit.c 2006-12-19 19:30:37 UTC (rev 17007)
>@@ -989,18 +989,19 @@
> for(nc = 1; nc < ncols && n+nrows < nfiles; n += nrows, nc++) {
> str_add_chr[0] = add_char_to_match[n];
> acol = str_add_chr[0] ? column_width - 1 : column_width;
>- printf("%s%s", matches[n], str_add_chr);
>- l = strlen(matches[n]);
>- while (l < acol) {
>- putchar(' ');
>- l++;
>- }
>+ printf("%s%s%-*s", matches[n], str_add_chr,
>+ acol - strlen(matches[n]), "");
> }
> str_add_chr[0] = add_char_to_match[n];
> printf("%s%s\n", matches[n], str_add_chr);
> }
> }
>
>+static int match_compare(const void *a, const void *b)
>+{
>+ return strcmp(*(char**)a, *(char**)b);
>+}
>+
We keep accumluating that match_strcmp way too much.
With this addition, we have at _least_ two other occurances (IIRC), so
this would really warrant a
int match_strcmp(const void *a, const void *b);
or bb_strcmp_matcher or something like that.
Please fix!
> static void input_tab(int *lastWasTab)
> {
> /* Do TAB completion */
>@@ -1016,7 +1017,6 @@
> return;
> }
> if (! *lastWasTab) {
>-
> char *tmp, *tmp1;
> int len_found;
> char matchBuf[BUFSIZ];
ouch. BIG! RESERVE_CONFIG_BUFFER ? bb_common_bufsiz1 is likely already
used in the users of that..
cheers,
More information about the busybox
mailing list