aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-07-16 14:14:34 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-07-16 14:14:34 +0200
commit5c2e81bb67750fa36e7901182e979cfdf8f5cc41 (patch)
treeb139d5aadff406b770fe3fbda0649ef3b91b0591 /libbb/lineedit.c
parent01ba1676afff4673a7dd5b355e970d52769723df (diff)
downloadbusybox-w32-5c2e81bb67750fa36e7901182e979cfdf8f5cc41.tar.gz
busybox-w32-5c2e81bb67750fa36e7901182e979cfdf8f5cc41.tar.bz2
busybox-w32-5c2e81bb67750fa36e7901182e979cfdf8f5cc41.zip
fix a thinko in lineedit completion code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r--libbb/lineedit.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index cb675f230..a3d939551 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -692,13 +692,12 @@ static void exe_n_cwd_tab_completion(char *command, int type)
692 692
693#define int_buf (S.find_match__int_buf) 693#define int_buf (S.find_match__int_buf)
694#define pos_buf (S.find_match__pos_buf) 694#define pos_buf (S.find_match__pos_buf)
695 695/* is must be <= in */
696static void collapse_pos(int is, int in) 696static void collapse_pos(int is, int in)
697{ 697{
698 memmove(int_buf+is, int_buf+in, (MAX_LINELEN+1 - is - in) * sizeof(int_buf[0])); 698 memmove(int_buf+is, int_buf+in, (MAX_LINELEN+1-in)*sizeof(int_buf[0]));
699 memmove(pos_buf+is, pos_buf+in, (MAX_LINELEN+1 - is - in) * sizeof(pos_buf[0])); 699 memmove(pos_buf+is, pos_buf+in, (MAX_LINELEN+1-in)*sizeof(pos_buf[0]));
700} 700}
701
702static NOINLINE int find_match(char *matchBuf, int *len_with_quotes) 701static NOINLINE int find_match(char *matchBuf, int *len_with_quotes)
703{ 702{
704 int i, j; 703 int i, j;
@@ -866,9 +865,9 @@ static NOINLINE int find_match(char *matchBuf, int *len_with_quotes)
866 *len_with_quotes = j ? j - pos_buf[0] : 0; 865 *len_with_quotes = j ? j - pos_buf[0] : 0;
867 866
868 return command_mode; 867 return command_mode;
868}
869#undef int_buf 869#undef int_buf
870#undef pos_buf 870#undef pos_buf
871}
872 871
873/* 872/*
874 * display by column (original idea from ls applet, 873 * display by column (original idea from ls applet,
@@ -917,7 +916,7 @@ static char *add_quote_for_spec_chars(char *found)
917 char *s = xzalloc((strlen(found) + 1) * 2); 916 char *s = xzalloc((strlen(found) + 1) * 2);
918 917
919 while (*found) { 918 while (*found) {
920 if (strchr(" `\"#$%^&*()=+{}[]:;\'|\\<>", *found)) 919 if (strchr(" `\"#$%^&*()=+{}[]:;'|\\<>", *found))
921 s[l++] = '\\'; 920 s[l++] = '\\';
922 s[l++] = *found++; 921 s[l++] = *found++;
923 } 922 }
@@ -1642,7 +1641,8 @@ static int lineedit_read_key(char *read_key_buffer)
1642#undef CTRL 1641#undef CTRL
1643#define CTRL(a) ((a) & ~0x40) 1642#define CTRL(a) ((a) & ~0x40)
1644 1643
1645/* Returns: 1644/* maxsize must be >= 2.
1645 * Returns:
1646 * -1 on read errors or EOF, or on bare Ctrl-D, 1646 * -1 on read errors or EOF, or on bare Ctrl-D,
1647 * 0 on ctrl-C (the line entered is still returned in 'command'), 1647 * 0 on ctrl-C (the line entered is still returned in 'command'),
1648 * >0 length of input string, including terminating '\n' 1648 * >0 length of input string, including terminating '\n'