mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-30 08:59:56 +02:00
bash-5.2-alpha release
This commit is contained in:
+11
-4
@@ -178,17 +178,22 @@ strsub (string, pat, rep, global)
|
||||
}
|
||||
|
||||
/* Replace all instances of C in STRING with TEXT. TEXT may be empty or
|
||||
NULL. If DO_GLOB is non-zero, we quote the replacement text for
|
||||
globbing. Backslash may be used to quote C. */
|
||||
NULL. If (FLAGS & 1) is non-zero, we quote the replacement text for
|
||||
globbing. Backslash may be used to quote C. If (FLAGS & 2) we allow
|
||||
backslash to escape backslash as well. */
|
||||
char *
|
||||
strcreplace (string, c, text, do_glob)
|
||||
strcreplace (string, c, text, flags)
|
||||
char *string;
|
||||
int c;
|
||||
const char *text;
|
||||
int do_glob;
|
||||
int flags;
|
||||
{
|
||||
char *ret, *p, *r, *t;
|
||||
int len, rlen, ind, tlen;
|
||||
int do_glob, escape_backslash;
|
||||
|
||||
do_glob = flags & 1;
|
||||
escape_backslash = flags & 2;
|
||||
|
||||
len = STRLEN (text);
|
||||
rlen = len + strlen (string) + 2;
|
||||
@@ -225,6 +230,8 @@ strcreplace (string, c, text, do_glob)
|
||||
|
||||
if (*p == '\\' && p[1] == c)
|
||||
p++;
|
||||
else if (escape_backslash && *p == '\\' && p[1] == '\\')
|
||||
p++;
|
||||
|
||||
ind = r - ret;
|
||||
RESIZE_MALLOCED_BUFFER (ret, ind, 2, rlen, rlen);
|
||||
|
||||
Reference in New Issue
Block a user