mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 15:43:18 +02:00
change `read -d' on a tty when the delimiter is not a newline to set the terminal EOL character instead of putting the terminal into character-at-a-time mode; change some calls to atoi to use strol instead
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* chet@ins.cwru.edu
|
||||
*/
|
||||
|
||||
/* Copyright (C) 1997-2023 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1997-2026 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -415,6 +415,48 @@ array_subrange (ARRAY *a, arrayind_t start, arrayind_t nelem, int starsub, int q
|
||||
return t;
|
||||
}
|
||||
|
||||
char *
|
||||
array_subslice (ARRAY *a, arrayind_t start, arrayind_t end, int starsub, int quoted, int pflags)
|
||||
{
|
||||
ARRAY *a2;
|
||||
ARRAY_ELEMENT *h, *p;
|
||||
arrayind_t i;
|
||||
char *t;
|
||||
WORD_LIST *wl;
|
||||
|
||||
p = a ? array_head (a) : 0;
|
||||
if (p == 0 || array_empty (a) || start > array_max_index(a))
|
||||
return ((char *)NULL);
|
||||
|
||||
/*
|
||||
* Find element with index START. If START corresponds to an unset
|
||||
* element (arrays can be sparse), use the first element whose index
|
||||
* is >= START. If START is < 0, we count START indices back from
|
||||
* the end of A (not elements, even with sparse arrays -- START is an
|
||||
* index).
|
||||
*/
|
||||
for (p = element_forw(p); p != array_head(a) && start > element_index(p); p = element_forw(p))
|
||||
;
|
||||
|
||||
if (p == a->head)
|
||||
return ((char *)NULL);
|
||||
|
||||
/* Starting at P, find END. */
|
||||
for (i = element_index(p), h = p; p != a->head && end > element_index(p); p = element_forw(p))
|
||||
;
|
||||
|
||||
a2 = array_slice(a, h, p);
|
||||
|
||||
wl = array_to_word_list(a2);
|
||||
array_dispose(a2);
|
||||
if (wl == 0)
|
||||
return (char *)NULL;
|
||||
t = string_list_pos_params(starsub ? '*' : '@', wl, quoted, pflags); /* XXX */
|
||||
dispose_words(wl);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
char *
|
||||
array_patsub (ARRAY *a, char *pat, char *rep, int mflags)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user