svn commit: trunk/busybox/shell

vda at busybox.net vda at busybox.net
Mon Jan 22 08:34:45 UTC 2007


Author: vda
Date: 2007-01-22 00:34:44 -0800 (Mon, 22 Jan 2007)
New Revision: 17449

Log:
cmdedit: fix breakage


Modified:
   trunk/busybox/shell/cmdedit.c


Changeset:
Modified: trunk/busybox/shell/cmdedit.c
===================================================================
--- trunk/busybox/shell/cmdedit.c	2007-01-22 08:17:14 UTC (rev 17448)
+++ trunk/busybox/shell/cmdedit.c	2007-01-22 08:34:44 UTC (rev 17449)
@@ -255,9 +255,9 @@
 		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 @@
 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 @@
 	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 @@
 	}
 
 	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 @@
 		}
 		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 @@
 			/* 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 @@
 			/* 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
 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 @@
 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 @@
 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();
 	}
 }




More information about the busybox-cvs mailing list