[617118d] | 1 | Submitted By: Jeremy Utley <jeremy@linuxfromscratch.org>
|
---|
| 2 | Date: 2003-08-28
|
---|
| 3 | Initial Package Version: 2.05b
|
---|
| 4 | Origin: ftp://ftp.gnu.org/gnu/bash
|
---|
| 5 | Description: Integrates all 7 published bash-2.05b patches into a single
|
---|
| 6 | patch file for LFS use.
|
---|
| 7 |
|
---|
| 8 | diff -Naur bash-2.05b/bashline.c bash-2.05b-new/bashline.c
|
---|
| 9 | --- bash-2.05b/bashline.c 2002-05-07 15:52:42.000000000 -0400
|
---|
| 10 | +++ bash-2.05b-new/bashline.c 2003-08-28 13:29:37.000000000 -0400
|
---|
| 11 | @@ -1044,7 +1044,10 @@
|
---|
| 12 | }
|
---|
| 13 | else
|
---|
| 14 | {
|
---|
| 15 | +#define CMD_IS_DIR(x) (absolute_pathname(x) == 0 && *(x) != '~' && test_for_directory (x))
|
---|
| 16 | +
|
---|
| 17 | matches = rl_completion_matches (text, command_word_completion_function);
|
---|
| 18 | +
|
---|
| 19 | /* If we are attempting command completion and nothing matches, we
|
---|
| 20 | do not want readline to perform filename completion for us. We
|
---|
| 21 | still want to be able to complete partial pathnames, so set the
|
---|
| 22 | @@ -1052,7 +1055,7 @@
|
---|
| 23 | filenames and leave directories in the match list. */
|
---|
| 24 | if (matches == (char **)NULL)
|
---|
| 25 | rl_ignore_some_completions_function = bash_ignore_filenames;
|
---|
| 26 | - else if (matches[1] == 0 && *matches[0] != '/')
|
---|
| 27 | + else if (matches[1] == 0 && CMD_IS_DIR(matches[0]))
|
---|
| 28 | /* Turn off rl_filename_completion_desired so readline doesn't
|
---|
| 29 | append a slash if there is a directory with the same name
|
---|
| 30 | in the current directory, or other filename-specific things.
|
---|
| 31 | @@ -1061,7 +1064,7 @@
|
---|
| 32 | looking in the current directory anyway, so there's no
|
---|
| 33 | conflict. */
|
---|
| 34 | rl_filename_completion_desired = 0;
|
---|
| 35 | - else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && *matches[0] != '/')
|
---|
| 36 | + else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && CMD_IS_DIR (matches[0]))
|
---|
| 37 | /* There are multiple instances of the same match (duplicate
|
---|
| 38 | completions haven't yet been removed). In this case, all of
|
---|
| 39 | the matches will be the same, and the duplicate removal code
|
---|
| 40 | diff -Naur bash-2.05b/lib/readline/bind.c bash-2.05b-new/lib/readline/bind.c
|
---|
| 41 | --- bash-2.05b/lib/readline/bind.c 2002-01-24 11:15:52.000000000 -0500
|
---|
| 42 | +++ bash-2.05b-new/lib/readline/bind.c 2003-08-28 13:29:37.000000000 -0400
|
---|
| 43 | @@ -311,7 +311,7 @@
|
---|
| 44 | mapped to something, `abc' to be mapped to something else,
|
---|
| 45 | and the function bound to `a' to be executed when the user
|
---|
| 46 | types `abx', leaving `bx' in the input queue. */
|
---|
| 47 | - if (k.function /* && k.type == ISFUNC */)
|
---|
| 48 | + if (k.function && ((k.type == ISFUNC && k.function != rl_do_lowercase_version) || k.type == ISMACR))
|
---|
| 49 | {
|
---|
| 50 | map[ANYOTHERKEY] = k;
|
---|
| 51 | k.function = 0;
|
---|
| 52 | diff -Naur bash-2.05b/lib/readline/display.c bash-2.05b-new/lib/readline/display.c
|
---|
| 53 | --- bash-2.05b/lib/readline/display.c 2002-06-04 10:54:47.000000000 -0400
|
---|
| 54 | +++ bash-2.05b-new/lib/readline/display.c 2003-08-28 13:29:37.000000000 -0400
|
---|
| 55 | @@ -70,7 +70,7 @@
|
---|
| 56 | static void cr PARAMS((void));
|
---|
| 57 |
|
---|
| 58 | #if defined (HANDLE_MULTIBYTE)
|
---|
| 59 | -static int _rl_col_width PARAMS((char *, int, int));
|
---|
| 60 | +static int _rl_col_width PARAMS((const char *, int, int));
|
---|
| 61 | static int *_rl_wrapped_line;
|
---|
| 62 | #else
|
---|
| 63 | # define _rl_col_width(l, s, e) (((e) <= (s)) ? 0 : (e) - (s))
|
---|
| 64 | @@ -1348,9 +1348,9 @@
|
---|
| 65 | {
|
---|
| 66 | _rl_output_some_chars (nfd + lendiff, temp - lendiff);
|
---|
| 67 | #if 0
|
---|
| 68 | - _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff) - col_lendiff;
|
---|
| 69 | -#else
|
---|
| 70 | _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
|
---|
| 71 | +#else
|
---|
| 72 | + _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff);
|
---|
| 73 | #endif
|
---|
| 74 | }
|
---|
| 75 | }
|
---|
| 76 | @@ -1510,8 +1510,15 @@
|
---|
| 77 | #if defined (HANDLE_MULTIBYTE)
|
---|
| 78 | /* If we have multibyte characters, NEW is indexed by the buffer point in
|
---|
| 79 | a multibyte string, but _rl_last_c_pos is the display position. In
|
---|
| 80 | - this case, NEW's display position is not obvious. */
|
---|
| 81 | - if ((MB_CUR_MAX == 1 || rl_byte_oriented ) && _rl_last_c_pos == new) return;
|
---|
| 82 | + this case, NEW's display position is not obvious and must be
|
---|
| 83 | + calculated. */
|
---|
| 84 | + if (MB_CUR_MAX == 1 || rl_byte_oriented)
|
---|
| 85 | + {
|
---|
| 86 | + if (_rl_last_c_pos == new)
|
---|
| 87 | + return;
|
---|
| 88 | + }
|
---|
| 89 | + else if (_rl_last_c_pos == _rl_col_width (data, 0, new))
|
---|
| 90 | + return;
|
---|
| 91 | #else
|
---|
| 92 | if (_rl_last_c_pos == new) return;
|
---|
| 93 | #endif
|
---|
| 94 | @@ -1594,11 +1601,7 @@
|
---|
| 95 | #endif
|
---|
| 96 | {
|
---|
| 97 | if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
---|
| 98 | - {
|
---|
| 99 | - tputs (_rl_term_cr, 1, _rl_output_character_function);
|
---|
| 100 | - for (i = 0; i < new; i++)
|
---|
| 101 | - putc (data[i], rl_outstream);
|
---|
| 102 | - }
|
---|
| 103 | + _rl_backspace (_rl_last_c_pos - _rl_col_width (data, 0, new));
|
---|
| 104 | else
|
---|
| 105 | _rl_backspace (_rl_last_c_pos - new);
|
---|
| 106 | }
|
---|
| 107 | @@ -2117,7 +2120,7 @@
|
---|
| 108 | scan from the beginning of the string to take the state into account. */
|
---|
| 109 | static int
|
---|
| 110 | _rl_col_width (str, start, end)
|
---|
| 111 | - char *str;
|
---|
| 112 | + const char *str;
|
---|
| 113 | int start, end;
|
---|
| 114 | {
|
---|
| 115 | wchar_t wc;
|
---|
| 116 | @@ -2193,4 +2196,3 @@
|
---|
| 117 | return width;
|
---|
| 118 | }
|
---|
| 119 | #endif /* HANDLE_MULTIBYTE */
|
---|
| 120 | -
|
---|
| 121 | diff -Naur bash-2.05b/lib/readline/mbutil.c bash-2.05b-new/lib/readline/mbutil.c
|
---|
| 122 | --- bash-2.05b/lib/readline/mbutil.c 2002-06-04 11:54:29.000000000 -0400
|
---|
| 123 | +++ bash-2.05b-new/lib/readline/mbutil.c 2003-08-28 13:29:37.000000000 -0400
|
---|
| 124 | @@ -205,14 +205,16 @@
|
---|
| 125 | if (tmp == (size_t)(-2))
|
---|
| 126 | {
|
---|
| 127 | /* shorted to compose multibyte char */
|
---|
| 128 | - memset (ps, 0, sizeof(mbstate_t));
|
---|
| 129 | + if (ps)
|
---|
| 130 | + memset (ps, 0, sizeof(mbstate_t));
|
---|
| 131 | return -2;
|
---|
| 132 | }
|
---|
| 133 | else if (tmp == (size_t)(-1))
|
---|
| 134 | {
|
---|
| 135 | /* invalid to compose multibyte char */
|
---|
| 136 | /* initialize the conversion state */
|
---|
| 137 | - memset (ps, 0, sizeof(mbstate_t));
|
---|
| 138 | + if (ps)
|
---|
| 139 | + memset (ps, 0, sizeof(mbstate_t));
|
---|
| 140 | return -1;
|
---|
| 141 | }
|
---|
| 142 | else if (tmp == (size_t)0)
|
---|
| 143 | @@ -225,9 +227,12 @@
|
---|
| 144 | return 1. Otherwise return 0. */
|
---|
| 145 | int
|
---|
| 146 | _rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2)
|
---|
| 147 | - char *buf1, *buf2;
|
---|
| 148 | - mbstate_t *ps1, *ps2;
|
---|
| 149 | - int pos1, pos2;
|
---|
| 150 | + char *buf1;
|
---|
| 151 | + int pos1;
|
---|
| 152 | + mbstate_t *ps1;
|
---|
| 153 | + char *buf2;
|
---|
| 154 | + int pos2;
|
---|
| 155 | + mbstate_t *ps2;
|
---|
| 156 | {
|
---|
| 157 | int i, w1, w2;
|
---|
| 158 |
|
---|
| 159 | @@ -276,8 +281,11 @@
|
---|
| 160 | pos++;
|
---|
| 161 | /* clear the state of the byte sequence, because
|
---|
| 162 | in this case effect of mbstate is undefined */
|
---|
| 163 | - memset (ps, 0, sizeof (mbstate_t));
|
---|
| 164 | + if (ps)
|
---|
| 165 | + memset (ps, 0, sizeof (mbstate_t));
|
---|
| 166 | }
|
---|
| 167 | + else if (tmp == 0)
|
---|
| 168 | + pos++;
|
---|
| 169 | else
|
---|
| 170 | pos += tmp;
|
---|
| 171 | }
|
---|
| 172 | diff -Naur bash-2.05b/lib/readline/readline.c bash-2.05b-new/lib/readline/readline.c
|
---|
| 173 | --- bash-2.05b/lib/readline/readline.c 2002-03-13 17:10:46.000000000 -0500
|
---|
| 174 | +++ bash-2.05b-new/lib/readline/readline.c 2003-08-28 13:29:37.000000000 -0400
|
---|
| 175 | @@ -684,6 +684,7 @@
|
---|
| 176 | }
|
---|
| 177 | #if defined (VI_MODE)
|
---|
| 178 | if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap &&
|
---|
| 179 | + key != ANYOTHERKEY &&
|
---|
| 180 | _rl_vi_textmod_command (key))
|
---|
| 181 | _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign);
|
---|
| 182 | #endif
|
---|
| 183 | diff -Naur bash-2.05b/lib/readline/vi_mode.c bash-2.05b-new/lib/readline/vi_mode.c
|
---|
| 184 | --- bash-2.05b/lib/readline/vi_mode.c 2002-05-23 13:27:58.000000000 -0400
|
---|
| 185 | +++ bash-2.05b-new/lib/readline/vi_mode.c 2003-08-28 13:29:37.000000000 -0400
|
---|
| 186 | @@ -680,7 +680,8 @@
|
---|
| 187 | int count;
|
---|
| 188 | {
|
---|
| 189 | wchar_t wc;
|
---|
| 190 | - char mb[MB_LEN_MAX];
|
---|
| 191 | + char mb[MB_LEN_MAX+1];
|
---|
| 192 | + int mblen;
|
---|
| 193 | mbstate_t ps;
|
---|
| 194 |
|
---|
| 195 | memset (&ps, 0, sizeof (mbstate_t));
|
---|
| 196 | @@ -703,7 +704,9 @@
|
---|
| 197 | /* Vi is kind of strange here. */
|
---|
| 198 | if (wc)
|
---|
| 199 | {
|
---|
| 200 | - wctomb (mb, wc);
|
---|
| 201 | + mblen = wctomb (mb, wc);
|
---|
| 202 | + if (mblen >= 0)
|
---|
| 203 | + mb[mblen] = '\0';
|
---|
| 204 | rl_begin_undo_group ();
|
---|
| 205 | rl_delete (1, 0);
|
---|
| 206 | rl_insert_text (mb);
|
---|
| 207 | diff -Naur bash-2.05b/subst.c bash-2.05b-new/subst.c
|
---|
| 208 | --- bash-2.05b/subst.c 2002-06-24 07:59:45.000000000 -0400
|
---|
| 209 | +++ bash-2.05b-new/subst.c 2003-08-28 13:29:37.000000000 -0400
|
---|
| 210 | @@ -1638,11 +1638,10 @@
|
---|
| 211 |
|
---|
| 212 | /* This performs word splitting and quoted null character removal on
|
---|
| 213 | STRING. */
|
---|
| 214 | -#if 0
|
---|
| 215 | -#define issep(c) ((separators)[1] ? (member ((c), separators)) : (c) == (separators)[0])
|
---|
| 216 | -#else
|
---|
| 217 | -#define issep(c) ((separators)[1] ? isifs(c) : (c) == (separators)[0])
|
---|
| 218 | -#endif
|
---|
| 219 | +#define issep(c) \
|
---|
| 220 | + (((separators)[0]) ? ((separators)[1] ? isifs(c) \
|
---|
| 221 | + : (c) == (separators)[0]) \
|
---|
| 222 | + : 0)
|
---|
| 223 |
|
---|
| 224 | WORD_LIST *
|
---|
| 225 | list_string (string, separators, quoted)
|
---|