bash-4.0 more stray file cleanup

This commit is contained in:
Chet Ramey
2011-12-07 09:46:51 -05:00
parent 023010f8b8
commit 69a1d22cea
1287 changed files with 0 additions and 651548 deletions
File diff suppressed because it is too large Load Diff
-12
View File
@@ -1,12 +0,0 @@
Readline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Readline is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Readline. If not, see <http://www.gnu.org/licenses/>.
-12
View File
@@ -1,12 +0,0 @@
History is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
History is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with History. If not, see <http://www.gnu.org/licenses/>.
-163
View File
@@ -1,163 +0,0 @@
*** ../../../bash-20081120/lib/readline/display.c 2008-11-13 09:55:19.000000000 -0500
--- display.c 2008-11-28 23:37:26.000000000 -0500
***************
*** 497,501 ****
register char *line;
int inv_botlin, lb_botlin, lb_linenum, o_cpos;
! int newlines, lpos, temp, n0, num;
char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
--- 497,501 ----
register char *line;
int inv_botlin, lb_botlin, lb_linenum, o_cpos;
! int newlines, lpos, temp, n0, num, prompt_lines_estimate;
char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
***************
*** 664,668 ****
the first physical line of the prompt.
wrap_offset - prompt_invis_chars_first_line is the number of invis
! chars on the second line. */
/* what if lpos is already >= _rl_screenwidth before we start drawing the
--- 664,671 ----
the first physical line of the prompt.
wrap_offset - prompt_invis_chars_first_line is the number of invis
! chars on the second (or, more generally, last) line. */
!
! /* This is zero-based, used to set the newlines */
! prompt_lines_estimate = lpos / _rl_screenwidth;
/* what if lpos is already >= _rl_screenwidth before we start drawing the
***************
*** 702,710 ****
/* Now account for invisible characters in the current line. */
! /* XXX - this assumes that all of the invisible characters are before
! the line wrap. */
temp += ((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
! : ((newlines == 1) ? wrap_offset : 0))
! : ((newlines == 0) ? wrap_offset :0));
inv_lbreaks[++newlines] = temp;
--- 705,713 ----
/* Now account for invisible characters in the current line. */
! /* XXX - this assumes that the invisible characters may be split, but only
! between the first and the last lines. */
temp += ((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
! : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line))
! : ((newlines == 0) ? wrap_offset : 0));
inv_lbreaks[++newlines] = temp;
***************
*** 969,973 ****
is an absolute cursor position in a multibyte locale. See
if compensating here is the right thing, or if we have to
! change update_line itself. There is one case in which
update_line adjusts _rl_last_c_pos itself (so it can pass
_rl_move_cursor_relative accurate values); it communicates
--- 972,976 ----
is an absolute cursor position in a multibyte locale. See
if compensating here is the right thing, or if we have to
! change update_line itself. There are several cases in which
update_line adjusts _rl_last_c_pos itself (so it can pass
_rl_move_cursor_relative accurate values); it communicates
***************
*** 1609,1614 ****
_rl_term_IC or _rl_term_ic will screw up the screen because of the
invisible characters. We need to just draw them. */
! if (*ols && (!_rl_horizontal_scroll_mode || _rl_last_c_pos > 0 ||
! lendiff <= prompt_visible_length || !current_invis_chars))
{
insert_some_chars (nfd, lendiff, col_lendiff);
--- 1612,1626 ----
_rl_term_IC or _rl_term_ic will screw up the screen because of the
invisible characters. We need to just draw them. */
! /* The same thing happens if we're trying to draw before the last
! invisible character in the prompt string and we're not drawing
! the entire prompt string. */
! if (*ols && ((_rl_horizontal_scroll_mode &&
! _rl_last_c_pos == 0 &&
! lendiff > prompt_visible_length &&
! current_invis_chars > 0) == 0) &&
! (((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
! current_line == 0 && wrap_offset &&
! ((nfd - new) <= prompt_last_invisible) &&
! (col_lendiff < prompt_visible_length)) == 0))
{
insert_some_chars (nfd, lendiff, col_lendiff);
***************
*** 1631,1635 ****
adjust _rl_last_c_pos to account for wrap_offset and set
cpos_adjusted to let the caller know. */
! if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
--- 1643,1647 ----
adjust _rl_last_c_pos to account for wrap_offset and set
cpos_adjusted to let the caller know. */
! if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
***************
*** 1652,1655 ****
--- 1664,1675 ----
twidth = temp - lendiff;
_rl_last_c_pos += twidth;
+ /* If nfd begins before any invisible characters in the prompt,
+ adjust _rl_last_c_pos to account for wrap_offset and set
+ cpos_adjusted to let the caller know. */
+ if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
+ {
+ _rl_last_c_pos -= wrap_offset;
+ cpos_adjusted = 1;
+ }
}
}
***************
*** 1663,1666 ****
--- 1683,1694 ----
characters) we need to adjust _rl_last_c_pos, since it represents
a physical character position. */
+ if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
+ current_line == prompt_last_screen_line && wrap_offset &&
+ wrap_offset != prompt_invis_chars_first_line &&
+ ((nfd-new) < (prompt_last_invisible-(current_line*_rl_screenwidth))))
+ {
+ _rl_last_c_pos -= wrap_offset - prompt_invis_chars_first_line;
+ cpos_adjusted = 1;
+ }
}
}
***************
*** 1728,1732 ****
--- 1756,1769 ----
col_lendiff = lendiff;
+ #if 0
if (col_lendiff)
+ #else
+ /* If we've already printed over the entire width of the screen,
+ including the old material, then col_lendiff doesn't matter and
+ space_to_eol will insert too many spaces. XXX - maybe we should
+ adjust col_lendiff based on the difference between _rl_last_c_pos
+ and _rl_screenwidth */
+ if (col_lendiff && (_rl_last_c_pos < _rl_screenwidth))
+ #endif
{
if (_rl_term_autowrap && current_line < inv_botlin)
***************
*** 1863,1867 ****
_rl_last_v_pos == prompt_last_screen_line &&
wrap_offset != woff &&
! new > (prompt_last_invisible-_rl_screenwidth-wrap_offset)))
{
dpos -= woff;
--- 1900,1905 ----
_rl_last_v_pos == prompt_last_screen_line &&
wrap_offset != woff &&
! new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
! /* XXX last comparison might need to be >= */
{
dpos -= woff;
-276
View File
@@ -1,276 +0,0 @@
/* An initial implementation of a menu completion function a la tcsh. The
first time (if the last readline command was not rl_menu_complete), we
generate the list of matches. This code is very similar to the code in
rl_complete_internal -- there should be a way to combine the two. Then,
for each item in the list of matches, we insert the match in an undoable
fashion, with the appropriate character appended (this happens on the
second and subsequent consecutive calls to rl_menu_complete). When we
hit the end of the match list, we restore the original unmatched text,
ring the bell, and reset the counter to zero. */
int
rl_old_menu_complete (count, ignore)
int count, ignore;
{
rl_compentry_func_t *our_func;
int matching_filenames, found_quote;
static char *orig_text;
static char **matches = (char **)0;
static int match_list_index = 0;
static int match_list_size = 0;
static int orig_start, orig_end;
static char quote_char;
static int delimiter;
/* The first time through, we generate the list of matches and set things
up to insert them. */
if (rl_last_func != rl_menu_complete)
{
/* Clean up from previous call, if any. */
FREE (orig_text);
if (matches)
_rl_free_match_list (matches);
match_list_index = match_list_size = 0;
matches = (char **)NULL;
/* Only the completion entry function can change these. */
set_completion_defaults ('%');
our_func = rl_menu_completion_entry_function;
if (our_func == 0)
our_func = rl_completion_entry_function
? rl_completion_entry_function
: rl_filename_completion_function;
/* We now look backwards for the start of a filename/variable word. */
orig_end = rl_point;
found_quote = delimiter = 0;
quote_char = '\0';
if (rl_point)
/* This (possibly) changes rl_point. If it returns a non-zero char,
we know we have an open quote. */
quote_char = _rl_find_completion_word (&found_quote, &delimiter);
orig_start = rl_point;
rl_point = orig_end;
orig_text = rl_copy_text (orig_start, orig_end);
matches = gen_completion_matches (orig_text, orig_start, orig_end,
our_func, found_quote, quote_char);
/* If we are matching filenames, the attempted completion function will
have set rl_filename_completion_desired to a non-zero value. The basic
rl_filename_completion_function does this. */
matching_filenames = rl_filename_completion_desired;
if (matches == 0 || postprocess_matches (&matches, matching_filenames) == 0)
{
rl_ding ();
FREE (matches);
matches = (char **)0;
FREE (orig_text);
orig_text = (char *)0;
completion_changed_buffer = 0;
return (0);
}
for (match_list_size = 0; matches[match_list_size]; match_list_size++)
;
/* matches[0] is lcd if match_list_size > 1, but the circular buffer
code below should take care of it. */
if (match_list_size > 1 && _rl_complete_show_all)
display_matches (matches);
}
/* Now we have the list of matches. Replace the text between
rl_line_buffer[orig_start] and rl_line_buffer[rl_point] with
matches[match_list_index], and add any necessary closing char. */
if (matches == 0 || match_list_size == 0)
{
rl_ding ();
FREE (matches);
matches = (char **)0;
completion_changed_buffer = 0;
return (0);
}
match_list_index += count;
if (match_list_index < 0)
match_list_index += match_list_size;
else
match_list_index %= match_list_size;
if (match_list_index == 0 && match_list_size > 1)
{
rl_ding ();
insert_match (orig_text, orig_start, MULT_MATCH, &quote_char);
}
else
{
insert_match (matches[match_list_index], orig_start, SINGLE_MATCH, &quote_char);
append_to_match (matches[match_list_index], delimiter, quote_char,
strcmp (orig_text, matches[match_list_index]));
}
completion_changed_buffer = 1;
return (0);
}
int
rl_menu_complete (count, ignore)
int count, ignore;
{
rl_compentry_func_t *our_func;
int matching_filenames, found_quote;
static char *orig_text;
static char **matches = (char **)0;
static int match_list_index = 0;
static int match_list_size = 0;
static int nontrivial_lcd = 0;
static int full_completion = 0; /* set to 1 if menu completion should reinitialize on next call */
static int orig_start, orig_end;
static char quote_char;
static int delimiter;
/* The first time through, we generate the list of matches and set things
up to insert them. */
if (rl_last_func != rl_menu_complete || full_completion)
{
/* Clean up from previous call, if any. */
FREE (orig_text);
if (matches)
_rl_free_match_list (matches);
match_list_index = match_list_size = 0;
matches = (char **)NULL;
full_completion = 0;
/* Only the completion entry function can change these. */
set_completion_defaults ('%');
our_func = rl_menu_completion_entry_function;
if (our_func == 0)
our_func = rl_completion_entry_function
? rl_completion_entry_function
: rl_filename_completion_function;
/* We now look backwards for the start of a filename/variable word. */
orig_end = rl_point;
found_quote = delimiter = 0;
quote_char = '\0';
if (rl_point)
/* This (possibly) changes rl_point. If it returns a non-zero char,
we know we have an open quote. */
quote_char = _rl_find_completion_word (&found_quote, &delimiter);
orig_start = rl_point;
rl_point = orig_end;
orig_text = rl_copy_text (orig_start, orig_end);
matches = gen_completion_matches (orig_text, orig_start, orig_end,
our_func, found_quote, quote_char);
nontrivial_lcd = matches && strcmp (orig_text, matches[0]) != 0;
/* If we are matching filenames, the attempted completion function will
have set rl_filename_completion_desired to a non-zero value. The basic
rl_filename_completion_function does this. */
matching_filenames = rl_filename_completion_desired;
if (matches == 0 || postprocess_matches (&matches, matching_filenames) == 0)
{
rl_ding ();
FREE (matches);
matches = (char **)0;
FREE (orig_text);
orig_text = (char *)0;
completion_changed_buffer = 0;
return (0);
}
for (match_list_size = 0; matches[match_list_size]; match_list_size++)
;
if (match_list_size == 0)
{
rl_ding ();
FREE (matches);
matches = (char **)0;
match_list_index = 0;
completion_changed_buffer = 0;
return (0);
}
/* matches[0] is lcd if match_list_size > 1, but the circular buffer
code below should take care of it. */
if (*matches[0])
{
insert_match (matches[0], orig_start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
orig_end = orig_start + strlen (matches[0]);
completion_changed_buffer = STREQ (orig_text, matches[0]) == 0;
}
if (match_list_size > 1 && _rl_complete_show_all)
{
display_matches (matches);
/* If there are so many matches that the user has to be asked
whether or not he wants to see the matches, menu completion
is unwieldy. */
if (rl_completion_query_items > 0 && match_list_size >= rl_completion_query_items)
{
rl_ding ();
FREE (matches);
matches = (char **)0;
full_completion = 1;
return (0);
}
}
else if (match_list_size <= 1)
{
append_to_match (matches[0], delimiter, quote_char, nontrivial_lcd);
full_completion = 1;
return (0);
}
}
/* Now we have the list of matches. Replace the text between
rl_line_buffer[orig_start] and rl_line_buffer[rl_point] with
matches[match_list_index], and add any necessary closing char. */
if (matches == 0 || match_list_size == 0)
{
rl_ding ();
FREE (matches);
matches = (char **)0;
completion_changed_buffer = 0;
return (0);
}
match_list_index += count;
if (match_list_index < 0)
match_list_index += match_list_size;
else
match_list_index %= match_list_size;
if (match_list_index == 0 && match_list_size > 1)
{
rl_ding ();
insert_match (matches[0], orig_start, MULT_MATCH, &quote_char);
}
else
{
insert_match (matches[match_list_index], orig_start, SINGLE_MATCH, &quote_char);
append_to_match (matches[match_list_index], delimiter, quote_char,
strcmp (orig_text, matches[match_list_index]));
}
completion_changed_buffer = 1;
return (0);
}
-127
View File
@@ -1,127 +0,0 @@
/* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/*
* shmatch.c -- shell interface to posix regular expression matching.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#if defined (HAVE_POSIX_REGEXP)
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "bashansi.h"
#include <stdio.h>
#include <regex.h>
#include "shell.h"
#include "variables.h"
#include "externs.h"
extern int glob_ignore_case, match_ignore_case;
int
sh_regmatch (string, pattern, flags)
const char *string;
const char *pattern;
int flags;
{
regex_t regex = { 0 };
regmatch_t *matches;
int rflags;
#if defined (ARRAY_VARS)
SHELL_VAR *rematch;
ARRAY *amatch;
int subexp_ind;
char *subexp_str;
int subexp_len;
#endif
int result, r;
#if defined (ARRAY_VARS)
rematch = (SHELL_VAR *)NULL;
#endif
rflags = REG_EXTENDED;
if (glob_ignore_case || match_ignore_case)
rflags |= REG_ICASE;
#if !defined (ARRAY_VARS)
rflags |= REG_NOSUB;
#endif
if (regcomp (&regex, pattern, rflags))
return 2; /* flag for printing a warning here. */
#if defined (ARRAY_VARS)
matches = (regmatch_t *)malloc (sizeof (regmatch_t) * (regex.re_nsub + 1));
#else
matches = NULL;
#endif
if (r = regexec (&regex, string, regex.re_nsub + 1, matches, 0))
result = EXECUTION_FAILURE;
else
result = EXECUTION_SUCCESS; /* match */
if (r != 0) {
char errbuf[1024];
regerror(r, &regex, errbuf, sizeof(errbuf));
fprintf(stderr, "sh_regmatch: match failed: %s\n", errbuf);
}
#if defined (ARRAY_VARS)
subexp_len = strlen (string) + 10;
subexp_str = malloc (subexp_len + 1);
/* Store the parenthesized subexpressions in the array BASH_REMATCH.
Element 0 is the portion that matched the entire regexp. Element 1
is the part that matched the first subexpression, and so on. */
unbind_variable ("BASH_REMATCH");
rematch = make_new_array_variable ("BASH_REMATCH");
amatch = array_cell (rematch);
if ((flags & SHMAT_SUBEXP) && result == EXECUTION_SUCCESS && subexp_str)
{
for (subexp_ind = 0; subexp_ind <= regex.re_nsub; subexp_ind++)
{
memset (subexp_str, 0, subexp_len);
strncpy (subexp_str, string + matches[subexp_ind].rm_so,
matches[subexp_ind].rm_eo - matches[subexp_ind].rm_so);
array_insert (amatch, subexp_ind, subexp_str);
}
}
VSETATTR (rematch, att_readonly);
free (subexp_str);
free (matches);
#endif /* ARRAY_VARS */
regfree (&regex);
return result;
}
#endif /* HAVE_POSIX_REGEXP */