summaryrefslogtreecommitdiff
path: root/shell/cmdedit.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-22 08:34:44 +0000
committerDenis Vlasenko2007-01-22 08:34:44 +0000
commit253ce0029669919fbb7cf60b5c9eab2f791939d8 (patch)
tree6eac5537d290bb529c26eddf7fe594ce4ed54c37 /shell/cmdedit.c
parentb01b4e2a1f16d7e5ff8369195421dd80047d55eb (diff)
downloadbusybox-253ce0029669919fbb7cf60b5c9eab2f791939d8.zip
busybox-253ce0029669919fbb7cf60b5c9eab2f791939d8.tar.gz
cmdedit: fix breakage
Diffstat (limited to 'shell/cmdedit.c')
-rw-r--r--shell/cmdedit.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index b0a5de7..7588922 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -255,9 +255,9 @@ static void put(void)
return;
ocursor = cursor;
/* open hole and then fill it */
- memmove(command_ps + cursor + j, command_ps + cursor, len - cursor + 1);
+ memmove(command_ps + cursor + j, command_ps + cursor, command_len - cursor + 1);
strncpy(command_ps + cursor, delbuf, j);
- len += j;
+ command_len += j;
input_end(); /* rewrite new line */
input_backward(cursor - ocursor - j + 1); /* at end of new text */
}
@@ -365,8 +365,8 @@ enum {
static int path_parse(char ***p, int flags)
{
int npth;
- const char *tmp;
const char *pth;
+ char *tmp;
char **res;
/* if not setenv PATH variable, to search cur dir "." */
@@ -381,7 +381,7 @@ static int path_parse(char ***p, int flags)
if (!pth || !pth[0] || LONE_CHAR(pth, ':'))
return 1;
- tmp = pth;
+ tmp = (char*)pth;
npth = 1; /* path component count */
while (1) {
tmp = strchr(tmp, ':');
@@ -393,8 +393,7 @@ static int path_parse(char ***p, int flags)
}
res = xmalloc(npth * sizeof(char*));
- res[0] = xstrdup(pth);
- tmp = pth;
+ res[0] = tmp = xstrdup(pth);
npth = 1;
while (1) {
tmp = strchr(tmp, ':');
@@ -810,7 +809,7 @@ static void input_tab(int *lastWasTab)
}
len_found = strlen(tmp);
/* have space to placed match? */
- if ((len_found - strlen(matchBuf) + len) < BUFSIZ) {
+ if ((len_found - strlen(matchBuf) + command_len) < BUFSIZ) {
/* before word for match */
command_ps[cursor - recalc_pos] = 0;
/* save tail line */
@@ -824,9 +823,9 @@ static void input_tab(int *lastWasTab)
/* new pos */
recalc_pos = cursor + len_found;
/* new len */
- len = strlen(command_ps);
+ command_len = strlen(command_ps);
/* write out the matched command */
- redraw(cmdedit_y, len - recalc_pos);
+ redraw(cmdedit_y, command_len - recalc_pos);
}
free(tmp);
} else {
@@ -839,7 +838,7 @@ static void input_tab(int *lastWasTab)
/* Go to the next line */
goto_new_line();
showfiles();
- redraw(0, len - sav_cursor);
+ redraw(0, command_len - sav_cursor);
}
}
}
@@ -982,9 +981,9 @@ static void remember_in_history(const char *str)
static void
vi_Word_motion(char *command, int eat)
{
- while (cursor < len && !isspace(command[cursor]))
+ while (cursor < command_len && !isspace(command[cursor]))
input_forward();
- if (eat) while (cursor < len && isspace(command[cursor]))
+ if (eat) while (cursor < command_len && isspace(command[cursor]))
input_forward();
}
@@ -992,19 +991,19 @@ static void
vi_word_motion(char *command, int eat)
{
if (isalnum(command[cursor]) || command[cursor] == '_') {
- while (cursor < len
+ while (cursor < command_len
&& (isalnum(command[cursor+1]) || command[cursor+1] == '_'))
input_forward();
} else if (ispunct(command[cursor])) {
- while (cursor < len && ispunct(command[cursor+1]))
+ while (cursor < command_len && ispunct(command[cursor+1]))
input_forward();
}
- if (cursor < len)
+ if (cursor < command_len)
input_forward();
- if (eat && cursor < len && isspace(command[cursor]))
- while (cursor < len && isspace(command[cursor]))
+ if (eat && cursor < command_len && isspace(command[cursor]))
+ while (cursor < command_len && isspace(command[cursor]))
input_forward();
}
@@ -1012,30 +1011,30 @@ static void
vi_End_motion(char *command)
{
input_forward();
- while (cursor < len && isspace(command[cursor]))
+ while (cursor < command_len && isspace(command[cursor]))
input_forward();
- while (cursor < len-1 && !isspace(command[cursor+1]))
+ while (cursor < command_len-1 && !isspace(command[cursor+1]))
input_forward();
}
static void
vi_end_motion(char *command)
{
- if (cursor >= len-1)
+ if (cursor >= command_len-1)
return;
input_forward();
- while (cursor < len-1 && isspace(command[cursor]))
+ while (cursor < command_len-1 && isspace(command[cursor]))
input_forward();
- if (cursor >= len-1)
+ if (cursor >= command_len-1)
return;
if (isalnum(command[cursor]) || command[cursor] == '_') {
- while (cursor < len-1
+ while (cursor < command_len-1
&& (isalnum(command[cursor+1]) || command[cursor+1] == '_')
) {
input_forward();
}
} else if (ispunct(command[cursor])) {
- while (cursor < len-1 && ispunct(command[cursor+1]))
+ while (cursor < command_len-1 && ispunct(command[cursor+1]))
input_forward();
}
}