mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-05 19:30:49 +02:00
final set of ANSI C changes
This commit is contained in:
+19
-25
@@ -1,6 +1,6 @@
|
||||
/* glob.c -- file-name wildcard pattern matching for Bash.
|
||||
|
||||
Copyright (C) 1985-2022 Free Software Foundation, Inc.
|
||||
Copyright (C) 1985-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne-Again SHell.
|
||||
|
||||
@@ -266,8 +266,6 @@ extglob_skipname (char *pat, char *dname, int flags)
|
||||
static int
|
||||
skipname (char *pat, char *dname, int flags)
|
||||
{
|
||||
int i;
|
||||
|
||||
#if EXTENDED_GLOB
|
||||
if (extglob_pattern_p (pat)) /* XXX */
|
||||
return (extglob_skipname (pat, dname, flags));
|
||||
@@ -306,8 +304,6 @@ skipname (char *pat, char *dname, int flags)
|
||||
static int
|
||||
wskipname (wchar_t *pat, wchar_t *dname, int flags)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (glob_always_skip_dot_and_dotdot && WDOT_OR_DOTDOT (dname))
|
||||
return 1;
|
||||
|
||||
@@ -485,7 +481,6 @@ wdequote_pathname (char *pathname)
|
||||
mbstate_t ps;
|
||||
size_t len, n;
|
||||
wchar_t *wpathname;
|
||||
int i, j;
|
||||
wchar_t *orig_wpathname;
|
||||
|
||||
if (mbsmbchar (pathname) == 0)
|
||||
@@ -580,7 +575,7 @@ glob_testdir (char *dir, int flags)
|
||||
static struct globval *
|
||||
finddirs (char *pat, char *sdir, int flags, struct globval **ep, int *np)
|
||||
{
|
||||
char **r, *n;
|
||||
char **r;
|
||||
int ndirs;
|
||||
struct globval *ret, *e, *g;
|
||||
|
||||
@@ -654,14 +649,13 @@ char **
|
||||
glob_vector (char *pat, char *dir, int flags)
|
||||
{
|
||||
DIR *d;
|
||||
register struct dirent *dp;
|
||||
struct globval *lastlink, *e, *dirlist;
|
||||
register struct globval *nextlink;
|
||||
register char *nextname, *npat, *subdir;
|
||||
unsigned int count;
|
||||
int lose, skip, ndirs, isdir, sdlen, add_current, patlen;
|
||||
register char **name_vector;
|
||||
register unsigned int i;
|
||||
struct dirent *dp;
|
||||
struct globval *nextlink, *lastlink, *e, *dirlist;
|
||||
char *nextname, *npat, *subdir;
|
||||
unsigned int count, i;
|
||||
int lose, skip, ndirs, isdir, add_current;
|
||||
size_t patlen, sdlen;
|
||||
char **name_vector;
|
||||
int mflags; /* Flags passed to strmatch (). */
|
||||
int pflags; /* flags passed to sh_makepath () */
|
||||
int hasglob; /* return value from glob_pattern_p */
|
||||
@@ -670,7 +664,8 @@ glob_vector (char *pat, char *dir, int flags)
|
||||
char *convfn;
|
||||
|
||||
lastlink = 0;
|
||||
count = lose = skip = add_current = 0;
|
||||
count = 0;
|
||||
lose = skip = add_current = 0;
|
||||
|
||||
firstmalloc = 0;
|
||||
nalloca = 0;
|
||||
@@ -713,7 +708,7 @@ glob_vector (char *pat, char *dir, int flags)
|
||||
hasglob = 0;
|
||||
if (skip == 0 && ((hasglob = glob_pattern_p (pat)) == 0 || hasglob == 2))
|
||||
{
|
||||
int dirlen;
|
||||
size_t dirlen;
|
||||
struct stat finfo;
|
||||
|
||||
if (glob_testdir (dir, 0) < 0)
|
||||
@@ -1035,7 +1030,8 @@ glob_vector (char *pat, char *dir, int flags)
|
||||
static char **
|
||||
glob_dir_to_array (char *dir, char **array, int flags)
|
||||
{
|
||||
register unsigned int i, l;
|
||||
unsigned int i;
|
||||
size_t l;
|
||||
int add_slash;
|
||||
char **result, *new;
|
||||
struct stat sb;
|
||||
@@ -1125,7 +1121,7 @@ glob_filename (char *pathname, int flags)
|
||||
char **result, **new_result;
|
||||
unsigned int result_size;
|
||||
char *directory_name, *filename, *dname, *fn;
|
||||
unsigned int directory_len;
|
||||
size_t directory_len;
|
||||
int free_dirname; /* flag */
|
||||
int dflags, hasglob;
|
||||
|
||||
@@ -1184,7 +1180,7 @@ glob_filename (char *pathname, int flags)
|
||||
if (directory_len > 0 && (hasglob = glob_pattern_p (directory_name)) == 1)
|
||||
{
|
||||
char **directories, *d, *p;
|
||||
register unsigned int i;
|
||||
unsigned int i;
|
||||
int all_starstar, last_starstar;
|
||||
|
||||
all_starstar = last_starstar = 0;
|
||||
@@ -1220,7 +1216,7 @@ glob_filename (char *pathname, int flags)
|
||||
so we can compensate if filename is [star][star] */
|
||||
if ((flags & GX_GLOBSTAR) && all_starstar == 0)
|
||||
{
|
||||
int dl, prev;
|
||||
size_t dl, prev;
|
||||
prev = dl = directory_len;
|
||||
while (dl >= 4 && d[dl - 1] == '/' &&
|
||||
d[dl - 2] == '*' &&
|
||||
@@ -1306,8 +1302,6 @@ glob_filename (char *pathname, int flags)
|
||||
/* Special handling for symlinks to directories with globstar on */
|
||||
if (all_starstar && (dflags & GX_NULLDIR) == 0)
|
||||
{
|
||||
int dlen;
|
||||
|
||||
/* If we have a directory name that is not null (GX_NULLDIR above)
|
||||
and is a symlink to a directory, we return the symlink if
|
||||
we're not `descending' into it (filename[0] == 0) and return
|
||||
@@ -1350,7 +1344,7 @@ glob_filename (char *pathname, int flags)
|
||||
else
|
||||
{
|
||||
char **array;
|
||||
register unsigned int l;
|
||||
unsigned int l;
|
||||
|
||||
/* If we're expanding **, we don't need to glue the directory
|
||||
name to the results; we've already done it in glob_vector */
|
||||
@@ -1374,7 +1368,7 @@ glob_filename (char *pathname, int flags)
|
||||
NULL_PLACEHOLDER (temp_results))
|
||||
#undef NULL_PLACEHOLDER
|
||||
{
|
||||
register int i, n;
|
||||
int i, n;
|
||||
for (n = 0; temp_results[n] && *temp_results[n] == 0; n++)
|
||||
;
|
||||
i = n;
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991-2017 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991-2017,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -76,7 +76,7 @@ MATCHLEN (pat, max)
|
||||
size_t max;
|
||||
{
|
||||
CHAR c;
|
||||
int matlen, bracklen, t, in_cclass, in_collsym, in_equiv;
|
||||
int matlen, bracklen, in_cclass, in_collsym, in_equiv;
|
||||
|
||||
if (*pat == 0)
|
||||
return (0);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991-2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
|
||||
+1
-4
@@ -1,7 +1,7 @@
|
||||
/* strmatch.c -- ksh-like extended pattern matching for the shell and filename
|
||||
globbing. */
|
||||
|
||||
/* Copyright (C) 1991-2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -103,7 +103,6 @@ charcmp (int c1, int c2, int forcecoll)
|
||||
{
|
||||
static char s1[2] = { ' ', '\0' };
|
||||
static char s2[2] = { ' ', '\0' };
|
||||
int ret;
|
||||
|
||||
/* Eight bits only. Period. */
|
||||
c1 &= 0xFF;
|
||||
@@ -379,7 +378,6 @@ charcmp_wc (wint_t c1, wint_t c2, int forcecoll)
|
||||
{
|
||||
static wchar_t s1[2] = { L' ', L'\0' };
|
||||
static wchar_t s2[2] = { L' ', L'\0' };
|
||||
int r;
|
||||
|
||||
if (c1 == c2)
|
||||
return 0;
|
||||
@@ -582,7 +580,6 @@ xstrmatch (char *pattern, char *string, int flags)
|
||||
int ret;
|
||||
size_t n;
|
||||
wchar_t *wpattern, *wstring;
|
||||
size_t plen, slen, mplen, mslen;
|
||||
|
||||
glob_recursion_depth = 0;
|
||||
|
||||
|
||||
@@ -419,7 +419,6 @@ xwcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
|
||||
size_t cur_max; /* XXX - locale_cur_max */
|
||||
char buf[64], *destptr, *tmp_dest;
|
||||
unsigned char uc;
|
||||
mbstate_t prev_state;
|
||||
|
||||
cur_max = MB_CUR_MAX;
|
||||
if (cur_max > sizeof (buf)) /* Holy cow. */
|
||||
|
||||
+3
-4
@@ -1,6 +1,6 @@
|
||||
/* bind.c -- key binding and startup file support for the readline library. */
|
||||
|
||||
/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
@@ -1247,7 +1247,7 @@ const char *rl_readline_name = "other";
|
||||
/* Stack of previous values of parsing_conditionalized_out. */
|
||||
static unsigned char *if_stack = (unsigned char *)NULL;
|
||||
static int if_stack_depth;
|
||||
static int if_stack_size;
|
||||
static size_t if_stack_size;
|
||||
|
||||
/* Push _rl_parsing_conditionalized_out, and set parser state based
|
||||
on ARGS. */
|
||||
@@ -1672,7 +1672,6 @@ rl_parse_and_bind (char *string)
|
||||
if (_rl_stricmp (string, "set") == 0)
|
||||
{
|
||||
char *var, *value, *e;
|
||||
int s;
|
||||
|
||||
var = string + i;
|
||||
/* Make VAR point to start of variable name. */
|
||||
@@ -1850,7 +1849,7 @@ rl_parse_and_bind (char *string)
|
||||
if (*funname == '\'' || *funname == '"')
|
||||
{
|
||||
char useq[2];
|
||||
int fl = strlen (funname);
|
||||
size_t fl = strlen (funname);
|
||||
|
||||
useq[0] = key; useq[1] = '\0';
|
||||
if (fl && funname[fl - 1] == *funname)
|
||||
|
||||
@@ -2467,7 +2467,8 @@ rl_filename_completion_function (const char *text, int state)
|
||||
static char *users_dirname = (char *)NULL;
|
||||
static int filename_len;
|
||||
char *temp, *dentry, *convfn;
|
||||
int dirlen, dentlen, convlen;
|
||||
size_t dirlen;
|
||||
int dentlen, convlen;
|
||||
int tilde_dirname;
|
||||
struct dirent *entry;
|
||||
|
||||
@@ -2588,6 +2589,7 @@ rl_filename_completion_function (const char *text, int state)
|
||||
/* Now that we have some state, we can read the directory. */
|
||||
|
||||
entry = (struct dirent *)NULL;
|
||||
convfn = dentry = 0;
|
||||
while (directory && (entry = readdir (directory)))
|
||||
{
|
||||
convfn = dentry = entry->d_name;
|
||||
@@ -2837,7 +2839,7 @@ rl_menu_complete (int count, int ignore)
|
||||
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, cstate;
|
||||
static int delimiter;
|
||||
|
||||
/* The first time through, we generate the list of matches and set things
|
||||
up to insert them. */
|
||||
|
||||
+12
-10
@@ -1,6 +1,6 @@
|
||||
/* histexpand.c -- history expansion. */
|
||||
|
||||
/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1989-2021,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the GNU History Library (History), a set of
|
||||
routines for managing the text of previously typed lines.
|
||||
@@ -532,7 +532,7 @@ history_expand_internal (const char *string, int start, int qc, int *end_index_p
|
||||
int i, n, starting_index;
|
||||
int substitute_globally, subst_bywords, want_quotes, print_only;
|
||||
char *event, *temp, *result, *tstr, *t, c, *word_spec;
|
||||
int result_len;
|
||||
size_t result_len;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
mbstate_t ps;
|
||||
|
||||
@@ -881,7 +881,7 @@ history_expand_internal (const char *string, int start, int qc, int *end_index_p
|
||||
#define ADD_STRING(s) \
|
||||
do \
|
||||
{ \
|
||||
int sl = strlen (s); \
|
||||
size_t sl = strlen (s); \
|
||||
j += sl; \
|
||||
if (j >= result_len) \
|
||||
{ \
|
||||
@@ -906,12 +906,13 @@ history_expand_internal (const char *string, int start, int qc, int *end_index_p
|
||||
int
|
||||
history_expand (char *hstring, char **output)
|
||||
{
|
||||
register int j;
|
||||
int i, r, l, passc, cc, modified, eindex, only_printing, dquote, squote, flag;
|
||||
int j;
|
||||
int i, r, passc, cc, modified, eindex, only_printing, dquote, squote, flag;
|
||||
size_t l;
|
||||
char *string;
|
||||
|
||||
/* The output string, and its length. */
|
||||
int result_len;
|
||||
size_t result_len;
|
||||
char *result;
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
@@ -1418,7 +1419,7 @@ history_arg_extract (int first, int last, const char *string)
|
||||
{
|
||||
register int i, len;
|
||||
char *result;
|
||||
int size, offset;
|
||||
size_t size, offset;
|
||||
char **list;
|
||||
|
||||
/* XXX - think about making history_tokenize return a struct array,
|
||||
@@ -1475,7 +1476,7 @@ history_arg_extract (int first, int last, const char *string)
|
||||
static int
|
||||
history_tokenize_word (const char *string, int ind)
|
||||
{
|
||||
register int i, j;
|
||||
int i, j;
|
||||
int delimiter, nestdelim, delimopen;
|
||||
|
||||
i = ind;
|
||||
@@ -1627,7 +1628,8 @@ static char **
|
||||
history_tokenize_internal (const char *string, int wind, int *indp)
|
||||
{
|
||||
char **result;
|
||||
register int i, start, result_index, size;
|
||||
int i, start, result_index;
|
||||
size_t size;
|
||||
|
||||
/* If we're searching for a string that's not part of a word (e.g., " "),
|
||||
make sure we set *INDP to a reasonable value. */
|
||||
@@ -1636,7 +1638,7 @@ history_tokenize_internal (const char *string, int wind, int *indp)
|
||||
|
||||
/* Get a token, and stuff it into RESULT. The tokens are split
|
||||
exactly where the shell would split them. */
|
||||
for (i = result_index = size = 0, result = (char **)NULL; string[i]; )
|
||||
for (i = result_index = 0, size = 0, result = (char **)NULL; string[i]; )
|
||||
{
|
||||
/* Skip leading whitespace. */
|
||||
for (; string[i] && fielddelim (string[i]); i++)
|
||||
|
||||
@@ -153,7 +153,7 @@ history_filename (const char *filename)
|
||||
{
|
||||
char *return_val;
|
||||
const char *home;
|
||||
int home_len;
|
||||
size_t home_len;
|
||||
|
||||
return_val = filename ? savestring (filename) : (char *)NULL;
|
||||
|
||||
@@ -190,7 +190,6 @@ history_backupfile (const char *filename)
|
||||
char *ret, linkbuf[PATH_MAX+1];
|
||||
size_t len;
|
||||
ssize_t n;
|
||||
struct stat fs;
|
||||
|
||||
fn = filename;
|
||||
#if defined (HAVE_READLINK)
|
||||
@@ -218,7 +217,6 @@ history_tempfile (const char *filename)
|
||||
char *ret, linkbuf[PATH_MAX+1];
|
||||
size_t len;
|
||||
ssize_t n;
|
||||
struct stat fs;
|
||||
int pid;
|
||||
|
||||
fn = filename;
|
||||
@@ -680,7 +678,7 @@ history_do_write (const char *filename, int nelements, int overwrite)
|
||||
register int i;
|
||||
char *output, *tempname, *histname;
|
||||
int file, mode, rv, exists;
|
||||
struct stat finfo, nfinfo;
|
||||
struct stat finfo;
|
||||
#ifdef HISTORY_USE_MMAP
|
||||
size_t cursize;
|
||||
|
||||
@@ -718,8 +716,8 @@ history_do_write (const char *filename, int nelements, int overwrite)
|
||||
Suggested by Peter Ho (peter@robosts.oxford.ac.uk). */
|
||||
{
|
||||
HIST_ENTRY **the_history; /* local */
|
||||
register int j;
|
||||
int buffer_size;
|
||||
size_t j;
|
||||
size_t buffer_size;
|
||||
char *buffer;
|
||||
|
||||
the_history = history_list ();
|
||||
|
||||
@@ -283,8 +283,6 @@ add_history (const char *string)
|
||||
|
||||
if (history_stifled && (history_length == history_max_entries))
|
||||
{
|
||||
register int i;
|
||||
|
||||
/* If the history is stifled, and history_length is zero,
|
||||
and it equals history_max_entries, we don't save items. */
|
||||
if (history_length == 0)
|
||||
|
||||
@@ -66,10 +66,11 @@ static int history_search_internal (const char *, int, int);
|
||||
static int
|
||||
history_search_internal (const char *string, int direction, int flags)
|
||||
{
|
||||
register int i, reverse;
|
||||
register char *line;
|
||||
register int line_index;
|
||||
int string_len, anchored, patsearch;
|
||||
int i, reverse;
|
||||
char *line;
|
||||
int line_index;
|
||||
size_t string_len;
|
||||
int anchored, patsearch;
|
||||
HIST_ENTRY **the_history; /* local */
|
||||
|
||||
i = history_offset;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2021,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
@@ -340,7 +340,7 @@ _rl_search_getchar (_rl_search_cxt *cxt)
|
||||
int
|
||||
_rl_isearch_dispatch (_rl_search_cxt *cxt, int c)
|
||||
{
|
||||
int n, wstart, wlen, limit, cval, incr;
|
||||
int n, wstart, wlen, limit, cval;
|
||||
char *paste;
|
||||
size_t pastelen;
|
||||
int j;
|
||||
@@ -725,13 +725,13 @@ opcode_dispatch:
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
int j;
|
||||
int w;
|
||||
|
||||
if (cxt->mb[0] == 0 || cxt->mb[1] == 0)
|
||||
cxt->search_string[cxt->search_string_index++] = cxt->mb[0];
|
||||
else
|
||||
for (j = 0; j < wlen; )
|
||||
cxt->search_string[cxt->search_string_index++] = cxt->mb[j++];
|
||||
for (w = 0; w < wlen; )
|
||||
cxt->search_string[cxt->search_string_index++] = cxt->mb[w++];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
/* kill.c -- kill ring management. */
|
||||
|
||||
/* Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1994-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
@@ -756,8 +756,8 @@ _rl_bracketed_text (size_t *lenp)
|
||||
int
|
||||
rl_bracketed_paste_begin (int count, int key)
|
||||
{
|
||||
int retval, c;
|
||||
size_t len, cap;
|
||||
int retval;
|
||||
size_t len;
|
||||
char *buf;
|
||||
|
||||
buf = _rl_bracketed_text (&len);
|
||||
@@ -774,7 +774,7 @@ int
|
||||
_rl_read_bracketed_paste_prefix (int c)
|
||||
{
|
||||
char pbuf[BRACK_PASTE_SLEN+1], *pbpref;
|
||||
int key, ind, j;
|
||||
int key, ind;
|
||||
|
||||
pbpref = BRACK_PASTE_PREF; /* XXX - debugging */
|
||||
if (c != pbpref[0])
|
||||
@@ -846,7 +846,7 @@ _rl_bracketed_read_key ()
|
||||
int
|
||||
_rl_bracketed_read_mbstring (char *mb, int mlen)
|
||||
{
|
||||
int c, r;
|
||||
int c;
|
||||
|
||||
c = _rl_bracketed_read_key ();
|
||||
if (c < 0)
|
||||
|
||||
@@ -69,7 +69,7 @@ static int executing_macro_index;
|
||||
static char *current_macro = (char *)NULL;
|
||||
|
||||
/* The size of the buffer allocated to current_macro. */
|
||||
static int current_macro_size;
|
||||
static size_t current_macro_size;
|
||||
|
||||
/* The index at which characters are being added to current_macro. */
|
||||
static int current_macro_index;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* mbutil.c -- readline multibyte character utility functions */
|
||||
|
||||
/* Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2001-2021,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
@@ -244,7 +244,6 @@ _rl_test_nonzero (const char *string, int ind, int len)
|
||||
static int
|
||||
_rl_find_prev_utf8char (const char *string, int seed, int find_non_zero)
|
||||
{
|
||||
char *s;
|
||||
unsigned char b;
|
||||
int save, prev;
|
||||
size_t len;
|
||||
@@ -476,7 +475,7 @@ _rl_char_value (const char *buf, int ind)
|
||||
size_t tmp;
|
||||
WCHAR_T wc;
|
||||
mbstate_t ps;
|
||||
int l;
|
||||
size_t l;
|
||||
|
||||
if (MB_LEN_MAX == 1 || rl_byte_oriented)
|
||||
return ((WCHAR_T) buf[ind]);
|
||||
|
||||
@@ -383,8 +383,6 @@ rl_maybe_save_line (void)
|
||||
int
|
||||
_rl_free_saved_history_line (void)
|
||||
{
|
||||
UNDO_LIST *orig;
|
||||
|
||||
if (_rl_saved_line_for_history)
|
||||
{
|
||||
if (rl_undo_list && rl_undo_list == (UNDO_LIST *)_rl_saved_line_for_history->data)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* readline.c -- a general facility for reading lines of input
|
||||
with emacs style editing and completion. */
|
||||
|
||||
/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
@@ -262,7 +262,7 @@ _rl_keyseq_cxt *_rl_kscxt = 0;
|
||||
|
||||
int rl_executing_key;
|
||||
char *rl_executing_keyseq = 0;
|
||||
int _rl_executing_keyseq_size = 0;
|
||||
size_t _rl_executing_keyseq_size = 0;
|
||||
|
||||
struct _rl_cmd _rl_pending_command;
|
||||
struct _rl_cmd *_rl_command_to_execute = (struct _rl_cmd *)NULL;
|
||||
|
||||
@@ -939,7 +939,7 @@ struct readline_state {
|
||||
char *prompt;
|
||||
|
||||
/* global state */
|
||||
int rlstate;
|
||||
int rlstate; /* XXX -- needs to be unsigned long */
|
||||
int done;
|
||||
Keymap kmap;
|
||||
|
||||
|
||||
@@ -570,7 +570,7 @@ extern procenv_t _rl_top_level;
|
||||
extern _rl_keyseq_cxt *_rl_kscxt;
|
||||
extern int _rl_keyseq_timeout;
|
||||
|
||||
extern int _rl_executing_keyseq_size;
|
||||
extern size_t _rl_executing_keyseq_size;
|
||||
|
||||
extern rl_hook_func_t *_rl_internal_startup_hook;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ static int _rl_history_search_len;
|
||||
static int _rl_history_search_flags;
|
||||
|
||||
static char *history_search_string;
|
||||
static int history_string_size;
|
||||
static size_t history_string_size;
|
||||
|
||||
static void make_history_line_current (HIST_ENTRY *);
|
||||
static int noninc_search_from_pos (char *, int, int, int, int *);
|
||||
|
||||
@@ -622,7 +622,6 @@ rl_check_signals (void)
|
||||
/* **************************************************************** */
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
static sigset_t sigint_set, sigint_oset;
|
||||
static sigset_t sigwinch_set, sigwinch_oset;
|
||||
#else /* !HAVE_POSIX_SIGNALS */
|
||||
# if defined (HAVE_BSD_SIGNALS)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/* text.c -- text handling commands for readline. */
|
||||
|
||||
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2021,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ _rl_free_undo_list (UNDO_LIST *ul)
|
||||
void
|
||||
rl_free_undo_list (void)
|
||||
{
|
||||
UNDO_LIST *release, *orig_list;
|
||||
UNDO_LIST *orig_list;
|
||||
|
||||
orig_list = rl_undo_list;
|
||||
_rl_free_undo_list (rl_undo_list);
|
||||
|
||||
+2
-1
@@ -321,7 +321,8 @@ _rl_errmsg (format, arg1, arg2)
|
||||
char *
|
||||
_rl_strindex (const char *s1, const char *s2)
|
||||
{
|
||||
register int i, l, len;
|
||||
int i;
|
||||
size_t l, len;
|
||||
|
||||
for (i = 0, l = strlen (s2), len = strlen (s1); (len - i) >= l; i++)
|
||||
if (_rl_strnicmp (s1 + i, s2, l) == 0)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* vi_mode.c -- A vi emulation mode for Bash.
|
||||
Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */
|
||||
|
||||
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2021,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
@@ -101,7 +101,6 @@ static int vi_replace_count;
|
||||
/* If non-zero, we have text inserted after a c[motion] command that put
|
||||
us implicitly into insert mode. Some people want this text to be
|
||||
attached to the command so that it is `redoable' with `.'. */
|
||||
static int vi_continued_command;
|
||||
static char *vi_insert_buffer;
|
||||
static int vi_insert_buffer_size;
|
||||
|
||||
@@ -1340,7 +1339,6 @@ _rl_vi_domove_callback (_rl_vimotion_cxt *m)
|
||||
int
|
||||
rl_vi_domove (int x, int *ignore)
|
||||
{
|
||||
int r;
|
||||
_rl_vimotion_cxt *m;
|
||||
|
||||
m = _rl_vimvcxt;
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
/* getenv.c - get environment variable value from the shell's variable
|
||||
list. */
|
||||
|
||||
/* Copyright (C) 1997-2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1997-2002,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -70,7 +70,8 @@ getenv (const char *name)
|
||||
}
|
||||
else if (environ)
|
||||
{
|
||||
register int i, len;
|
||||
int i;
|
||||
size_t len;
|
||||
|
||||
/* In some cases, s5r3 invokes getenv() before main(); BSD systems
|
||||
using gprof also exhibit this behavior. This means that
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/* makepath.c - glue PATH and DIR together into a full pathname. */
|
||||
|
||||
/* Copyright (C) 1987-2020,2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2020,2022-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -69,7 +69,7 @@ static char *nullpath = "";
|
||||
char *
|
||||
sh_makepath (const char *path, const char *dir, int flags)
|
||||
{
|
||||
int dirlen, pathlen;
|
||||
size_t dirlen, pathlen;
|
||||
char *ret, *xpath, *xdir, *r, *s;
|
||||
|
||||
if (path == 0 || *path == '\0')
|
||||
|
||||
+5
-3
@@ -1,6 +1,6 @@
|
||||
/* mbscasecmp - case-insensitive multibyte string comparison. */
|
||||
|
||||
/* Copyright (C) 2009-2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2009-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -33,8 +33,10 @@
|
||||
int
|
||||
mbscasecmp (const char *mbs1, const char *mbs2)
|
||||
{
|
||||
int len1, len2, mb_cur_max;
|
||||
wchar_t c1, c2, l1, l2;
|
||||
size_t len1, len2;
|
||||
int mb_cur_max;
|
||||
wchar_t c1, c2;
|
||||
wint_t l1, l2;
|
||||
mbstate_t state1 = { 0 }, state2 = { 0 };
|
||||
|
||||
len1 = len2 = 0;
|
||||
|
||||
+3
-3
@@ -56,7 +56,7 @@ extern int errno;
|
||||
char *
|
||||
strchr (const char *string, int c)
|
||||
{
|
||||
register char *s;
|
||||
char *s;
|
||||
|
||||
for (s = string; s && *s; s++)
|
||||
if (*s == c)
|
||||
@@ -68,9 +68,9 @@ strchr (const char *string, int c)
|
||||
char *
|
||||
strrchr (const char *string, int c)
|
||||
{
|
||||
register char *s, *t;
|
||||
char *s, *t;
|
||||
|
||||
for (s = string, t = (char *)NULL; s && *s; s++)
|
||||
for (s = string, t = NULL; s && *s; s++)
|
||||
if (*s == c)
|
||||
t = s;
|
||||
return (t);
|
||||
|
||||
+4
-3
@@ -1,6 +1,6 @@
|
||||
/* pathphys.c -- return pathname with all symlinks expanded. */
|
||||
|
||||
/* Copyright (C) 2000-2020,2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2000-2020,2022-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -49,7 +49,7 @@ extern int errno;
|
||||
extern char *get_working_directory (char *);
|
||||
|
||||
static inline int
|
||||
_path_readlink (char *path, char *buf, int bufsiz)
|
||||
_path_readlink (char *path, char *buf, size_t bufsiz)
|
||||
{
|
||||
#ifdef HAVE_READLINK
|
||||
return readlink (path, buf, bufsiz);
|
||||
@@ -73,7 +73,8 @@ sh_physpath (char *path, int flags)
|
||||
{
|
||||
char tbuf[PATH_MAX+1], linkbuf[PATH_MAX+1];
|
||||
char *result, *p, *q, *qsave, *qbase, *workpath;
|
||||
int double_slash_path, linklen, nlink;
|
||||
int double_slash_path, nlink;
|
||||
size_t linklen;
|
||||
|
||||
linklen = strlen (path);
|
||||
|
||||
|
||||
+6
-5
@@ -94,7 +94,7 @@ static const char bstab[256] =
|
||||
char *
|
||||
sh_single_quote (const char *string)
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
char *result, *r;
|
||||
const char *s;
|
||||
|
||||
@@ -133,7 +133,7 @@ sh_single_quote (const char *string)
|
||||
char *
|
||||
sh_double_quote (const char *string)
|
||||
{
|
||||
register unsigned char c;
|
||||
unsigned char c;
|
||||
int mb_cur_max;
|
||||
char *result, *r;
|
||||
size_t slen;
|
||||
@@ -178,11 +178,12 @@ sh_double_quote (const char *string)
|
||||
/* Turn S into a simple double-quoted string. If FLAGS is non-zero, quote
|
||||
double quote characters in S with backslashes. */
|
||||
char *
|
||||
sh_mkdoublequoted (const char *s, int slen, int flags)
|
||||
sh_mkdoublequoted (const char *s, size_t slen, int flags)
|
||||
{
|
||||
char *r, *ret;
|
||||
const char *send;
|
||||
int rlen, mb_cur_max;
|
||||
int mb_cur_max;
|
||||
size_t rlen;
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
send = s + slen;
|
||||
@@ -218,7 +219,7 @@ sh_mkdoublequoted (const char *s, int slen, int flags)
|
||||
char *
|
||||
sh_un_double_quote (char *string)
|
||||
{
|
||||
register int c, pass_next;
|
||||
int c, pass_next;
|
||||
char *result, *r, *s;
|
||||
|
||||
r = result = (char *)xmalloc (strlen (string) + 1);
|
||||
|
||||
+1
-1
@@ -1135,7 +1135,7 @@ static char *
|
||||
groupnum (char *s)
|
||||
{
|
||||
char *se, *ret, *re, *g;
|
||||
int len, slen;
|
||||
size_t len, slen;
|
||||
|
||||
if (grouping == 0 || *grouping <= 0 || *grouping == CHAR_MAX)
|
||||
return ((char *)NULL);
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/* spell.c -- spelling correction for pathnames. */
|
||||
|
||||
/* Copyright (C) 2000-2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -184,7 +184,7 @@ spdist(char *cur, char *new)
|
||||
char *
|
||||
dirspell (char *dirname)
|
||||
{
|
||||
int n;
|
||||
size_t n;
|
||||
char *guess;
|
||||
|
||||
n = (strlen (dirname) * 3 + 1) / 2 + 1;
|
||||
|
||||
+8
-8
@@ -40,7 +40,7 @@ STRINGLIST *
|
||||
strlist_create (size_t n)
|
||||
{
|
||||
STRINGLIST *ret;
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
ret = (STRINGLIST *)xmalloc (sizeof (STRINGLIST));
|
||||
if (n)
|
||||
@@ -62,7 +62,7 @@ strlist_create (size_t n)
|
||||
STRINGLIST *
|
||||
strlist_resize (STRINGLIST *sl, size_t n)
|
||||
{
|
||||
register int i;
|
||||
size_t i;
|
||||
|
||||
if (sl == 0)
|
||||
return (sl = strlist_create (n));
|
||||
@@ -114,7 +114,7 @@ STRINGLIST *
|
||||
strlist_copy (STRINGLIST *sl)
|
||||
{
|
||||
STRINGLIST *new;
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (sl == 0)
|
||||
return ((STRINGLIST *)0);
|
||||
@@ -139,7 +139,7 @@ STRINGLIST *
|
||||
strlist_merge (STRINGLIST *m1, STRINGLIST *m2)
|
||||
{
|
||||
STRINGLIST *sl;
|
||||
int i, n, l1, l2;
|
||||
size_t i, n, l1, l2;
|
||||
|
||||
l1 = m1 ? m1->list_len : 0;
|
||||
l2 = m2 ? m2->list_len : 0;
|
||||
@@ -158,7 +158,7 @@ strlist_merge (STRINGLIST *m1, STRINGLIST *m2)
|
||||
STRINGLIST *
|
||||
strlist_append (STRINGLIST *m1, STRINGLIST *m2)
|
||||
{
|
||||
register int i, n, len1, len2;
|
||||
size_t i, n, len1, len2;
|
||||
|
||||
if (m1 == 0)
|
||||
return (m2 ? strlist_copy (m2) : (STRINGLIST *)0);
|
||||
@@ -181,7 +181,7 @@ strlist_append (STRINGLIST *m1, STRINGLIST *m2)
|
||||
STRINGLIST *
|
||||
strlist_prefix_suffix (STRINGLIST *sl, const char *prefix, const char *suffix)
|
||||
{
|
||||
int plen, slen, tlen, llen, i;
|
||||
size_t plen, slen, tlen, llen, i;
|
||||
char *t;
|
||||
|
||||
if (sl == 0 || sl->list == 0 || sl->list_len == 0)
|
||||
@@ -213,7 +213,7 @@ strlist_prefix_suffix (STRINGLIST *sl, const char *prefix, const char *suffix)
|
||||
void
|
||||
strlist_print (STRINGLIST *sl, const char *prefix)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (sl == 0)
|
||||
return;
|
||||
@@ -224,7 +224,7 @@ strlist_print (STRINGLIST *sl, const char *prefix)
|
||||
void
|
||||
strlist_walk (STRINGLIST *sl, sh_strlist_map_func_t *func)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (sl == 0)
|
||||
return;
|
||||
|
||||
+12
-9
@@ -1,6 +1,6 @@
|
||||
/* strtrans.c - Translate and untranslate strings with ANSI-C escape sequences. */
|
||||
|
||||
/* Copyright (C) 2000-2015,2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2000-2015,2022-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -51,16 +51,17 @@ char *
|
||||
ansicstr (const char *string, int len, int flags, int *sawc, int *rlen)
|
||||
{
|
||||
int c, temp;
|
||||
char *ret, *r, *s;
|
||||
char *ret, *r;
|
||||
const char *s;
|
||||
unsigned long v;
|
||||
size_t clen;
|
||||
int b, mb_cur_max;
|
||||
int mb_cur_max;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
wchar_t wc;
|
||||
#endif
|
||||
|
||||
if (string == 0 || *string == '\0')
|
||||
return ((char *)NULL);
|
||||
return ((char *)0);
|
||||
|
||||
mb_cur_max = MB_CUR_MAX;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
@@ -71,7 +72,7 @@ ansicstr (const char *string, int len, int flags, int *sawc, int *rlen)
|
||||
#else
|
||||
ret = (char *)xmalloc (2*len + 1); /* 2*len for possible CTLESC */
|
||||
#endif
|
||||
for (r = ret, s = (char *)string; s && *s; )
|
||||
for (r = ret, s = string; s && *s; )
|
||||
{
|
||||
c = *s++;
|
||||
if (c != '\\' || *s == '\0')
|
||||
@@ -227,8 +228,9 @@ ansicstr (const char *string, int len, int flags, int *sawc, int *rlen)
|
||||
char *
|
||||
ansic_quote (const char *str, int flags, int *rlen)
|
||||
{
|
||||
char *r, *ret, *s;
|
||||
int l, rsize;
|
||||
char *r, *ret;
|
||||
const char *s;
|
||||
size_t l, rsize;
|
||||
unsigned char c;
|
||||
size_t clen;
|
||||
int b;
|
||||
@@ -246,9 +248,10 @@ ansic_quote (const char *str, int flags, int *rlen)
|
||||
*r++ = '$';
|
||||
*r++ = '\'';
|
||||
|
||||
for (s = (char *)str; c = *s; s++)
|
||||
for (s = str; c = *s; s++)
|
||||
{
|
||||
b = l = 1; /* 1 == add backslash; 0 == no backslash */
|
||||
b = 1; /* 1 == add backslash; 0 == no backslash */
|
||||
l = 1;
|
||||
clen = 1;
|
||||
|
||||
switch (c)
|
||||
|
||||
+4
-3
@@ -2,7 +2,7 @@
|
||||
* tmpfile.c - functions to create and safely open temp files for the shell.
|
||||
*/
|
||||
|
||||
/* Copyright (C) 2000-2020,2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2000-2020,2022-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -278,11 +278,12 @@ sh_mktmpfp (const char *nameroot, int flags, char **namep)
|
||||
char *
|
||||
sh_mktmpdir (const char *nameroot, int flags)
|
||||
{
|
||||
char *filename, *tdir, *dirname;
|
||||
char *filename;
|
||||
#ifdef USE_MKDTEMP
|
||||
char *tdir, *dirname;
|
||||
const char *lroot;
|
||||
int fd, tdlen;
|
||||
|
||||
#ifdef USE_MKDTEMP
|
||||
filename = (char *)xmalloc (PATH_MAX + 1);
|
||||
tdir = get_tmpdir (flags);
|
||||
tdlen = strlen (tdir);
|
||||
|
||||
+2
-1
@@ -87,10 +87,11 @@ int
|
||||
fsleep(unsigned int sec, unsigned int usec)
|
||||
{
|
||||
int e, r;
|
||||
sigset_t blocked_sigs, prevmask;
|
||||
sigset_t blocked_sigs;
|
||||
#if defined (HAVE_PSELECT)
|
||||
struct timespec ts;
|
||||
#else
|
||||
sigset_t prevmask;
|
||||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ utf8_mbscmp (const char *s1, const char *s2)
|
||||
char *
|
||||
utf8_mbsmbchar (const char *str)
|
||||
{
|
||||
register char *s;
|
||||
char *s;
|
||||
|
||||
for (s = (char *)str; *s; s++)
|
||||
if ((*s & 0xc0) == 0x80)
|
||||
@@ -59,7 +59,7 @@ utf8_mbsmbchar (const char *str)
|
||||
int
|
||||
utf8_mbsnlen(const char *src, size_t srclen, int maxlen)
|
||||
{
|
||||
register int sind, count;
|
||||
int sind, count;
|
||||
|
||||
for (sind = count = 0; src[sind] && sind <= maxlen; sind++)
|
||||
{
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
/* zgetline - read a line of input from a specified file descriptor and return
|
||||
a pointer to a newly-allocated buffer containing the data. */
|
||||
|
||||
/* Copyright (C) 2008-2020,2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2008-2020,2022-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -63,8 +63,8 @@ typedef ssize_t creadfunc_t (int, char *);
|
||||
ssize_t
|
||||
zgetline (int fd, char **lineptr, size_t *n, int delim, int unbuffered_read)
|
||||
{
|
||||
int retval;
|
||||
size_t nr;
|
||||
ssize_t retval;
|
||||
ssize_t nr;
|
||||
char *line, c;
|
||||
|
||||
if (lineptr == 0 || n == 0 || (*lineptr == 0 && *n != 0))
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ extern ssize_t zread (int, char *, size_t);
|
||||
/* Dump contents of file descriptor FD to *OSTR. FN is the filename for
|
||||
error messages (not used right now). */
|
||||
int
|
||||
zmapfd (int fd, char **ostr, char *fn)
|
||||
zmapfd (int fd, char **ostr, const char *fn)
|
||||
{
|
||||
ssize_t nr;
|
||||
int rval;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). */
|
||||
|
||||
/* Copyright (C) 1988-2020 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1988-2020,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
@@ -318,7 +318,7 @@ static char *
|
||||
glue_prefix_and_suffix (char *prefix, const char *suffix, int suffind)
|
||||
{
|
||||
char *ret;
|
||||
int plen, slen;
|
||||
size_t plen, slen;
|
||||
|
||||
plen = (prefix && *prefix) ? strlen (prefix) : 0;
|
||||
slen = strlen (suffix + suffind);
|
||||
|
||||
Reference in New Issue
Block a user